简体   繁体   中英

Magento add to cart button not working

Yes, I've seen the other topics about this problem, but I couldn't solve the problem yet. So I do hope you can help me. The problem is simple in my Magento shop www.koekentrommel.nl the add to cart button doesn't work. I'm a jquery newbie but I've tried the noconflict-code, but with no result. Can you please help? A shop without add to cart is as a car without tires... Thanks a lot!

This is the view.phtml code:

<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>

<script type="text/javascript">
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
$.noConflict();
</script>

    }.bind(productAddToCartForm);

    productAddToCartForm.submitLight = function(button, url){
        if(this.validator) {
            var nv = Validation.methods;
            delete Validation.methods['required-entry'];
            delete Validation.methods['validate-one-required'];
            delete Validation.methods['validate-one-required-by-name'];
            // Remove custom datetime validators
            for (var methodName in Validation.methods) {
                if (methodName.match(/^validate-datetime-.*/i)) {
                    delete Validation.methods[methodName];
                }
            }

            if (this.validator.validate()) {
                if (url) {
                    this.form.action = url;
                }
                this.form.submit();
            }
            Object.extend(Validation.methods, nv);
        }
    }.bind(productAddToCartForm);
//]]>
</script>


Clearly your jQuery is conflicting with prototype. NoConflcit should have resolved it

You have 2 closing script tags, you need to delete the one after $.noConflict();

 <script type="text/javascript">
   $.noConflict();
 </script>  <-- Delete

  }.bind(productAddToCartForm);
   .....
 </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM