1

I've added a custom block to the payment step of the onepage checkout. I need to modify something in the cart without the onepage process being interrupted or anything refreshing/redirecting.

I added a form and button above the payment methods, which calls this function onclick :

        function submitPartial(){
            //console.log("worked");
            var url = '<?php echo Mage::getUrl('',array('_secure'=>true)).'checkout/cart/index' ?>';
            var data = jQuery('#wholecart_partialpayment_form').serialize();
            jQuery.ajax({
                type: "POST",
                url: url,
                data: data,
                complete: function(data){
                    return false;
                }
            });
        }

And this works, If I open the cart page it's been updated, but if I then try to continue the onepage process by clicking "continue" the console throws a

Failed to load resource: the server responded with a status of 403 (Forbidden) : /index.php/checkout/onepage/savePayment/

If I don't click on my button and do my custom ajax request, the onepage process works normally.

I'm assuming my ajax call interrupts something in the form submitting of the onepage checkout, maybe it requires some kind of validation and my ajax call breaks it (hence the 403)? I'm honestly a bit lost, the onepage is pretty complicated.

1

I understand the problem now.

The checkout checks, at every step, if the cart has been "changed".

The module I installed (and was trying to modify) was sending an ajax call to the Cart controller index action so it would trigger a custom observer. The cart controller wasn't really used (nothing was changed), just the event/observer it would trigger.

Nevertheless, the cart controller being called would flag the cart as "modified", so the checkout page would fail when checking for cart changes.

Long story short, I changed it to call a custom controller and action instead of the cart controller, problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.