4

I am observing the strange situation of orders with subtotal and grand total of 0, but with products in it. The products row have prices and no promo rules or discounts are being used. This happens sporadically and not only with one site. The version of Magento is 1.7.0.2. There are also no additional extensions installed. system.log and exception.log do not contain traces of errors that may have something to do with this problem.

At first i thought it may be because of server overload. I think this may have something to do with it but the last "0"-subtotal order happened when the server was not loaded at all.

Any ideas? Thanks!

Nikolay Dimitrov
  • 340
  • 5
  • 12

4 Answers4

3

I 've had the same problem with you guys and it was really annoying because I could not reproduce it and could not find a proper solution. I started to believe that it was just another Magento bug caused by some bad timing in database operations.

Anthony's post really helped me and guide me to find a practical fix.

So here it is. Indeed the error is caused by the trigger recollect flag that is set in markQuotesRecollect (for instance when a product is saved) and causes all active quotes to recollect their totals.

I had to spent a lot of hours in debugging IWD OnepageCheckout code to understand that in Geo.php saveBilling function creates a new shipping address by cloning the billing address (in case shipping is same as billing) and passes (almost) all data from billing address to the shipping address which later on is saved (through the parent quote save). This way cached_items_* data are set and when Geo.php saves payment even if you intentionally set quote to recollect totals (i.e by setting collected flag to false) shipping totals are not calculated correctly.

Eventually I had to add this lines of code in saveBilling method after line that writes:

    $ship->addData($bill->getData());)

    $ship->setSameAsBilling(1)->setShippingMethod($ship_method)->setCollectShippingRates(true);
    $ship->unsetData('cached_items_nominal');
    $ship->unsetData('cached_items_nonnominal');
    $ship->unsetData('cached_items_all');

So far (after 10 days and around 1000 orders) had no random zero total orders.

Hope this helps you all

Kind Regards

Lefteris

1

I have had the same problem. And I have done some researches here. I used IWD onepagecheckout module. And the issue was inside this module.

Lets consider situation. You are doing smth in adminpanel or cron is doing some tasks this products or you could apply some catalog rules. In any kind of these actions will be called event catalog_product_status_update or catalog_product_save_after.

So every time you're changing smth in products all current quotes will be updates by events.

ok, here you'll ask me - what does it mean?

It means that each quote changes the field trigger_recollect in sales_flat_quote table. You can find it here app/code/core/Mage/Sales/Model/Resource/Quote.php::[markQuotesRecollectOnCatalogRules and markQuotesRecollect methods] to get more in details.

The trigger_recollect field is a trigger/signal to recollect whole quote total sums. You can find this step here app/code/Mage/Sales/Model/Quote.php::_afterLoad.

protected function _afterLoad()
{
        // collect totals and save me, if required
        if (1 == $this->getData('trigger_recollect')) {
            $this->collectTotals()->save();
        }
        return parent::_afterLoad();
}

And accurate at this moment all current quote total sums became 0. The follow step is to get address collection and for some reason we have not product items it the address object now. Magento cannot recollect correct here. But it occur only when you or system are doing smth with a products and at the same time customer is pressing the button "send order". Why - I do not know yet. By the issue was occurred and catched.

Anthony
  • 3,218
  • 3
  • 43
  • 73
  • This sounds legit. I am using the same module. Did you found a solution? And why do you think the problem is in the module. Isn't this a global issue? – Nikolay Dimitrov Nov 01 '16 at 05:57
  • I assume that the reason is in module. Lets compare IWD_OnepageCheckout_IndexController and Mage_Checkout_OnepageController on saveOrder action. Mage_Checkout_OnepageController does not have payment data saving on this step rather than IWD_OnepageCheckout_IndexController. See _saveOrderPurchase method in IWD_OnepageCheckout_IndexController for more details. This bug occures on this step. So IWD checkout is inializating quote recollect at moment when the product is changing in admin panel for example. Correct me if I'm wrong here. – Anthony Nov 02 '16 at 08:45
  • My solution is a hack here) - I just ignore recollect in case it is called under the saveOrder action. Not so good solution but it works) – Anthony Nov 02 '16 at 08:49
  • Does it help you? – Anthony Nov 17 '16 at 13:55
-2

Just check in the Configuration->Advanced->advanced->Disabled Module Outputs Mage_Tax option is enabled or not.

Ashlesha
  • 162
  • 7
-2

Zero Subtotal Checkout

Using this

System > Configuration > Payment Methods > Zero Subtotal Checkout

More info to go hear

enter image description here

enter image description here

Ravi Patel
  • 5,121
  • 2
  • 25
  • 44