Thursday, August 22, 2013

Magento abandoned cart for guest/unconfirmed users

http://stackoverflow.com/questions/13584054/magento-abandoned-cart-for-guest-unconfirmed-users



SELECT entity_id, customer_firstname, customer_email, items_count, grand_total, created_at
FROM sales_flat_quote
WHERE entity_id NOT IN (SELECT quote_item_id AS quote_id FROM sales_flat_order_item) 
AND items_count >0
AND customer_email IS NOT NULL
ORDER BY `sales_flat_quote`.`created_at` DESC

http://stackoverflow.com/questions/15148275/when-does-magento-consider-a-cart-to-be-abandoned-wheres-that-time-limit-set
As you probably know the setting is located here:
Admin => system => Configuration => Sales => Checkout => Quote Lifetime (days)
This will add the setting to the database (core_config_data table) with path:
checkout/cart/delete_quote_after
This path is used in the code on:
app/code/core/Mage/Sales/Model/Observer.php line 54
So when someone is adding something to a cart it will be updated. When a customer logs in and his cart is there it will be updated. When a cart is not updated for the last 30 days. It will be removed.
Extra information:
In case you wonder when this code is used, It is used by the cronjob of magento.
check: App/code/core/Mage/Sales/etc/config.xml line 1732

    
        
            
                0 0 * * *
sales/observer::cleanExpiredQuotes
Hope this helps.

No comments:

Post a Comment