0

I host a website that has been up and running for years. It's worked fantastically up until now, but in the past couple days I had a very strange error arise.

In my shopping cart on magento, it gives the user the option of typing in the shipping zip code and getting an estimate on shipping. before the problems arose, the estimate shipping cost wouldn't appear until a zip code was typed. Now, it automatically defaults to $30.00 and I can't figure out how to fix it. I'm not sure if something was updated, like PHP, Magento, or some extension, but I need it fixed ASAP. I've been in Magento's admin area and changed shipping options, looked through tax options and everything I could possibly think of. I've even been in Magento's cart.phtml file and commented out the line:

if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif;

Doing this just takes the estimate shipping out completely. I don't want it out, I just want it to produce an estimate AFTER the zip code is typed in as opposed to before. I'm at a loss here, and my boss wants this done tomorrow. Any advice would be greatly appreciated. Thanks

EDIT

I've done everything i could possibly think of to fix the problem, even going as far as to completely replace the file with the original clean copy provided by magento. It's still defaulting to 30.00 shipping before anything is pressed; on page load. The site is using one step checkout as an extension on magento, and I'm completely at a loss with this one. I am guessing that it's a bug in the internal software because i've completely replaced all code with clean code except for core functionality of magento/one step checkout. Any input on it? Maybe i can make the radio button invisible until it's pressed? any ideas how to do that?

4

1 回答 1

1

事实证明,一切都设置为默认值。它在文件中将最高运费显示为默认值。客户只是不想那样做。我最终要做的是

/app/design/frontend/default/scottsflowers/template/checkout/cart/shipping.phtml

文件并将 ID 添加到单选按钮及其相应的标签,并使它们在页面加载时不可见:

<input id="radioone" name="estimate_method" style="display:'none';" type="radio"...

<label id="labelone" style="display:'none';"

然后我在将这两个项目放入代码后不久添加了一个脚本,以检查邮政编码是否为空白或是否已填写。如果已填写,则使这两个项目可见。如果没有,请保持它们不可见。这是我用于该任务的代码:

            <script type="text/javascript">
                if (document.getElementById("postcode").value != "") {
                    document.getElementById("radioone").style.display='block';
                    document.getElementById("labelone").style.display='block';
                } else {
                    document.getElementById("radioone").style.display='none';
                    document.getElementById("labelone").style.display='none';
                }
            </script>

问题解决了。虽然我被聘为一名 PHP 程序员,但不需要做太多前端工作(如果有的话)。这非常令人沮丧,因为我首先对 javscript 不太满意。谢谢大家的帮助。您的意见进一步推动了我的研究和理解,如果不是我在这里收到的答案,我将无法解决问题。

于 2013-07-22T17:53:01.207 回答