cancel
Showing results for 
Search instead for 
Did you mean: 

problem with url addcart

problem with url addcart

Hello, There is working fine, I not edit nothing.
But when I click the button addtocart there showme the url this "site.com/mage/productAddToCartForm_169.submit()"

I don't know why not in to javascript.
The version is 1.9.2

3 REPLIES 3

Re: problem with url addcart

<button class="button btn-cart" onclick="productAddToCartForm_<?php echo $_product->getId(); ?>.submit()"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                                            </form>

<script type="text/javascript">
                                            var productAddToCartForm_<?php echo $_product->getId(); ?> = new VarienForm('product_addtocart_form_<?php echo $_product->getId(); ?>');
                                            productAddToCartForm_<?php echo $_product->getId(); ?>.submit = function(){
                                                if (this.validator.validate()) {
                                                    this.form.submit();
                                                }
                                            }.bind(productAddToCartForm_<?php echo $_product->getId(); ?>);
                                            </script>

Re: problem with url addcart

That's not what the base template looks like, so looks like it's custom function using ajax which may have problems. Check browser console for javascript errors. None there, did you disable any modules recently or install a module. Still not working? Try reverting it back base javascript so you can atleast add to cart.

 

var productAddToCartForm = new VarienForm('product_addtocart_form');
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;

if (url) {
form.action = url;
}
var e = null;
try {
this.form.submit();
} catch (e) {
}
this.form.action = oldUrl;
if (e) {
throw e;
}

if (button && button != 'undefined') {
button.disabled = true;
}
}
}.bind(productAddToCartForm);

 

Re: problem with url addcart

Hello @elfling.
Thanks for you request. It some strange.
If I put onclick="javascript&colon;productAddToCartForm.submit"

it is working the function. But if I remove the javascript&colon; there not working.

 

Also when I go to checkout pay the product, is not open the steps.

if (response.allow_sections) {
            response.allow_sections.each(function(e){
                $('opc-'+e).addClassName('allow');
                $$('.opc-'+e).first().addClassName('allow');
            });
        }

It some wrong with the javascript. Also I check with different browser. It same result.
Some idea?