I'm facing this strange issue on add to cart action:
sometime after I checkout (with a registered customer) correctly my order, if I try to purchase another item I got the following error:
Call to a member function set final price() on a non-object in app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php online 73
I have debugged the code and found out that the issue is created by some old quotes associated with my user that are still active and have not items associated with it.
If I check the problematic quote in the Db it has items_count = 0
any way Mage_Sales_Model_Resource_Quote_Item_Collection::_assignProducts()
method try to load an item using null as Id :
$product = $productCollection->getItemById($item->getProductId());
This triggers the above error.
Now the fast fix it to set to is_active = 0
in all these quote, something like:
UPDATE `sales_flat_quote` SET `is_active` = 0 WHERE `is_active` = 1 AND `items_count`= 0 and customer_id is not null and customer_id <> 0
Question
Anyway, I would like to understand the following points:
- Is it normal to have old quotes (also multiple for the same user) with 0 items and
is_active = 1
? - Is ok to delete all these quotes? ( I have 10000+ quotes like this )
Any suggestion is welcome
Best Answer
If it is throwing for all the customers then you can delete sales_flat_quote_item table. If this happens only for the particular customer then do the following thing. In this case, all the quotes won't be deleted.