Magento Strange Redirect Behavior on OnePage Checkout

My Magento Verison - 1.4.1.1

I have two problems:

1) When I look at the various stages of Onepage verification (registration, billing, shipping and payment), sometimes during this process I get redirected to the cart page. No error, exception, the report is not created in var / report. I don’t know how to debug it. Are there any magazines I can find?

2) In the same Onepage Checkout process, after clicking on the order (the last step), it is redirected several times to the cart page, sends an e-mail with a message stating that the message failed to execute the command:

The amount of quotes must be collected before this operation.

To solve this problem, I commented on this line in prepareRecurringPaymentProfiles in the magento/app/code/core/Mage/Sales/Model/Quote.php , which solved the problem:

 throw new Exception("Quote totals must be collected before this operation."); 

I do not know if these 2 problems are related or not. But now I do not have a second problem, but I have the 1st rather frequent character. What could be the reason and how to solve it?

further update - I checked the Firebug trace, these are 500 internal server errors that sometimes appear at any stage of verification on one page. I was able to dig into savebillingaction, saveshippingaction functions in onepagecontroller.php and found that the error occurs when $ this-> getRequest () β†’ isPost () is empty, if it is 1, then it goes forward and goes to the next step else redirects it Add to cart. No, I don’t know why it is not 1 or because ajax cannot send post data, but I checked the XHR request, Ajax sends message data every time (checked with the firebug extension). Can someone tell me what I could do next to troubleshooting. Where can I search for these Ajax prizes? Shipping.phtml (any step.phtml) has JS at the bottom, how does it call the OnePagecontroller saveshippingaction function?

+4
source share
5 answers

Since this is an internal server error, try accessing the server error log. Tell me where the problem is. I had the same problem in 1.7.0. In my example, the problem was in /app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php

+1
source

Firstly, commenting on an error message is almost never a solution to the problem, as you simply hide some problems that could have serious consequences for your system.

Smoothing errors like this can be difficult, but there are a few places to look for in the first place:

  • Did you install this system on a lower version and then upgrade it? If so, how?
  • Do you use any extensions that change part of the sales / site checks?
  • Have you redefined any models associated with this part of the site?
  • Have you changed JS or HTML to place an order?

If this is one of those cases, you should look at these changes for errors. If not, try turning on the default theme for the site and checking again. If the error goes away, the problem is with the theme you are using. If it still appears, the problem is in the code.

In this latter case, use Firebug to verify that offensive page requests cause Magento to send redirect commands to the frontend. If this is not the case, it may be some kind of JS error, but most likely you end up with invalid data on the system somewhere that causes Magento to suffocate during validation.

Also (just thinking about it, not trying), try multicast checking. As far as I remember, it uses regular page-by-page messages and may even have more useful messaging than OnePage checking. Please edit your post with your conclusions from the foregoing, so that we can help more if we do not.

Hope this helps!

0
source

For anyone who is confronted with "quotes totals should be collected before this operation." errors, check your Apache logs for a 500 internal server error. If this is something like this:

 mod_fcgid: read data timeout in 40 seconds Premature end of script headers: index.php process 26126 graceful kill fail, sending SIGKILL 

.. PHP has been reacting for too long. Usually this is the onepage / checkout saveOrder action, because it is quite heavy and often needs to be connected to third-party services (payment gateways, newsletter services such as mailchimp, etc.). These calls to third-party services may take some time, depending on the state of the network and may cause PHP to fail.

You can start by increasing the timeout, but this is not a very good permanent solution, because you want to know why this happens in the first place.

The new Relic is a good tool for monitoring these calls (and a good tool for monitoring your Magento store as a whole).

0
source

Just in case, someone will receive "The amount of quotes must be collected before this operation." error, and none of these solutions fix their particular problem, I mention that my problem was related to this:

skin / interface / base / default /JS/opcheckout.js

 var params = Form.serialize(payment.form); 

There was a unique JS error on this site that cleared the payment form and prevented JS from reading its contents. The module or theme you use will be different, but make sure that the payment form can be correctly serialized. If not, then this may be your problem.

0
source

I had the same issue in my Princessly store:

  • For "Sending order information ..." it takes from 20 to 130 seconds or even more to go through and redirect to a payment gateway, for example PayPal, after clicking the Place an order button, the last check step is one page.

  • If this does not work, it is very likely that because something has dragged on since it took too long, it will redirect back to the basket , leaving the client with an empty basket and Waiting for Payment order, OR, it will give an exception:

    The amount of quotes must be collected before this operation.

    Since, obviously, something has expired, and the script ends before the totals are collected (this is only my theory), thus sending an email confirming the transaction with payment for transactions.

After 12 hours of research and debugging, I finally found the culprit and solution.

Magento allows you to add an RSS feed and a new order notification by default, so each time you click Place an order (the "sales / order" resources are saved), the cache is updated, so the RSS will be published. For Magento, cleaning caches can be very expensive. Therefore, the solution is simple. Just turn off the RSS notification to save sales / order resources.

Locate /app/code/core/Mage/Rss/etc/config.xml and find this block:

 <sales_order_item_save_after> <observers> <notifystock> <class>rss/observer</class> <method>salesOrderItemSaveAfterNotifyStock</method> </notifystock> </observers> </sales_order_item_save_after> <sales_order_item_save_after> <observers> <ordernew> <class>rss/observer</class> <method>salesOrderItemSaveAfterOrderNew</method> </ordernew> </observers> </sales_order_item_save_after> 

Just delete or comment and update the Magento cache in System => Cache Management => Select All => Submit.

Now for my store it only takes 1 second or less to go through the Place reservation and redirect to the payment gateway.

0
source

Source: https://habr.com/ru/post/1346542/


All Articles