KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
tl;dr: There appears to be no other out-of-box mechanism for deleting quote records which were never converted to orders. The Mage_Sales module has a scheduled job to clean expired quotes, but this only deletes sales_flat_quote records which are marked as inactive (i.e. is_active = 0 ). To my knowledge, quotes are only marked as inactive when a quote converts to an order. If this is the case, then the quote table will only grow larger and larger. Ref Mage_Sales_Model_Observer::cleanExpiredQuotes() class Mage_Sales_Model_Observer { //... public function cleanExpiredQuotes($schedule) { Mage::dispatchEvent('clear_expired_quotes_before', array('sales_observer' => $this)); $lifetimes = Mage::getConfig()->getStoresConfigByPath('checkout/cart/delete_quote_after'); foreach ($lifetimes as $storeId=>$lifetime) { $lifetime *= 86400; /** @var $quotes Mage_Sales_Model_Mysql4_Quote_Collection */ $quotes = Mage::getModel('sales/quote')->getCollection(); $quotes->addFieldToFilter('store_id', $storeId); $quotes->addFieldToFilter('updated_at', array('to'=>date("Y-m-d", time()-$lifetime))); $quotes->addFieldToFilter('is_active', 0); foreach ($this->getExpireQuotesAdditionalFilterFields() as $field => $condition) { $quotes->addFieldToFilter($field, $condition); } $quotes->walk('delete'); } return $this; } //... }
Tags (comma-separated)
Save Edits
Cancel