结帐页面上的Magento setAttribute错误

时间:2013-07-31 14:27:12

标签: javascript jquery magento magento-1.7

好的,当你“继续结账”时,它会给你一个清单:

  1. 结账方法
  2. 结算信息
  3. 运送信息
  4. 运送方法
  5. 付款信息
  6. 订购回顾
  7. 默认情况下,我们会设置结帐方式,当您点击“继续”时,结算信息将会下拉,类似于:http://www.plazathemes.com/demo/ma_musicgear/index.php/checkout/onepage/

    但是,当我转到该页面时,checkout方法不会被删除,每当我点击它时,都没有任何反应。 现在这些都是我的JS错误:

    Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:5644
    2
    Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:5653
    Uncaught TypeError: Object [object Object] has no method 'setAttribute' clearchannel.halfoffdeals.com/index.php/checkout/onepage/:349
    Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:5644
    Uncaught TypeError: Object [object Object] has no method 'observe' opcheckout.js:236
    Uncaught TypeError: Object [object Object] has no method 'setAttribute' clearchannel.halfoffdeals.com/index.php/checkout/onepage/:544
    Uncaught TypeError: Object [object Object] has no method 'observe' opcheckout.js:374
    Uncaught TypeError: Object [object Object] has no method 'observe' opcheckout.js:537
    Uncaught TypeError: Object [object Object] has no method 'getElementsByTagName' prototype.js:5010
    Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:5653
    Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:828
    Uncaught TypeError: Object [object Object] has no method 'dispatchEvent'
    

    这些都与此有关吗?因为bootstrap,我从原型获得了所有的attachEvent和blah blah。我不知道如何解决这个问题所以我现在暂时搁置了。我猜测setAttribute肯定是导致问题的原因吗?

    感谢您的帮助..

    我不知道这是否会有任何帮助,但在您点击继续结帐之前在购物车页面上,它会在ESTIMATE SHIPPING AND TAX下列出“州/省”标签,但不会选择/输入box ..所以它在结帐页面上显示为无效的region_id:

    所以SetAttribute错误来自这一部分:

                            <div class="field">
                                <label for="shipping:region" class="required"><em>*</em>State/Province</label>
                                <div class="input-box">
                                    <select id="shipping:region_id" name="shipping[region_id]" title="State/Province" class="validate-select" style="display:none;">
                                        <option value="">Please select region, state or province</option>
                                    </select>
                                    <script type="text/javascript">
                                    //<![CDATA[
                                        $('shipping:region_id').setAttribute('defaultValue',  "");
    Uncaught TypeError: Object [object Object] has no method 'setAttribute'
                                    //]]>
                                    </script>
                                    <input type="text" id="shipping:region" name="shipping[region]" value="" title="State/Province" class="input-text " style="display:none;" />
                                </div>
                            </div>
    

    这是说$('shipping:region_id')没有方法setAttribute ..

3 个答案:

答案 0 :(得分:2)

@ROMMEL帮助解决了这个问题。这些是我为解决问题而采取的步骤:

  • 将它放在jquery-noconflict.js文件中:jQuery.noConflict();
  • 中的jQuery.js文件后面添加它

DONE! =)犯了许多错误,人们说引导程序和原型相互干扰。发出noConflict()后,所有这些错误都消失了!

答案 1 :(得分:1)

始终在jQuery.noConflict(); JS file prototype.js文件之前添加page.xml。 意思是这样的

<action method="addJs"><script>global.js</script></action> <action method="addJs"><script>jquery.jcarousel.pack.js</script></action> <action method="addJs"><script>jquery.noconflict.js</script></action> <action method="addJs"><script>prototype/prototype.js</script></action>

答案 2 :(得分:0)

将prototype.js文件替换为新的magento备份并再次检查。