0

I am looking for a table in the database where the Abandoned Carts are saved, but I cannot find the correct place. Where are the Abandoned Carts saved in the database? Or are they saved in a different matter (for example by combining data)?

2

There is no specific table that holds this data, this is the default SQL query which Magento will use to find abandoned carts.

SELECT
  `main_table`.*,
  (main_table.base_subtotal_with_discount * main_table.base_to_global_rate) AS `subtotal`,
  `cust_email`.`email`,
  `cust_fname`.`value`                                                      AS `firstname`,
  `cust_lname`.`value`                                                      AS `lastname`,
  CONCAT_WS(' ', cust_fname.value, cust_lname.value)                        AS `customer_name`
FROM `sales_flat_quote` AS `main_table`
  INNER JOIN `customer_entity` AS `cust_email` ON cust_email.entity_id = main_table.customer_id
  INNER JOIN `customer_entity_varchar` AS `cust_fname`
    ON cust_fname.entity_id = main_table.customer_id AND cust_fname.attribute_id = 5
  INNER JOIN `customer_entity_varchar` AS `cust_lname`
    ON cust_lname.entity_id = main_table.customer_id AND cust_lname.attribute_id = 7
WHERE (items_count != '0') AND (main_table.is_active = '1');

In case you weren't aware, you can find this data by going into the admin panel under Reports > Shopping Bag > Abandoned Shopping Bags.

  • I have indeed seen the list of abandoned shopping carts. In the meantime, I also found out, as you said, that the sales_flat_quote table holds the data for the abandoned cart. The only thing I am wondering now, what makes the abandoned cart 'abandoned'? As I am looking at your SQL query, I am guessing they are just looking if the user is currently online? Because, if I want to fire my own method, while a cart is considered abandoned, how can I do that? – Maarten Wolfsen Jul 20 '18 at 12:50
0

You can simply use:

    $collection = Mage::getResourceModel('reports/quote_collection');
    $collection->prepareForAbandonedReport(array());
    echo '<pre>';
    print_r($collection->getData());// will print all abandoned carts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.