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 setFinalPrice() on a non-object in app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php on line 73
I have debugged the code and found out that the issue is created by some old quotes associated to 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 trigger 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
Anyway I would like to understand the following points:
- Is it normal to have old quotes (also multiple for 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