Search code examples
magentomagento-1.7magento-1.8

Magento 1 - order with subtotal and grand total 0


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!


Solution

  • 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.