Jump to content

Edit History

nawres

nawres

This request gives us all abandoned carts without date limit, if you want you can give an interval of time to execute this one:

select c.email , a.id_cart,a.date_add,
sum(if((IFNULL(cp.quantity,0) || ifnull(p.price,0)), cp.quantity*p.price,null)) as price
 from ps_cart as a 
 LEFT JOIN ps_customer c ON (c.id_customer = a.id_customer)
 LEFT JOIN ps_currency cu ON (cu.id_currency = a.id_currency) 
 LEFT JOIN ps_carrier ca ON (ca.id_carrier = a.id_carrier) 
 LEFT JOIN ps_orders o ON (o.id_cart = a.id_cart) 
  LEFT JOIN ps_cart_product cp ON (cp.id_cart = a.id_cart) 
  LEFT JOIN ps_product p ON (cp.id_product = p.id_product) 

 LEFT JOIN ( SELECT id_guest FROM ps_connections WHERE TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, date_add)) < 1800 LIMIT 1 ) AS co
 ON co.id_guest = a.id_guest
 where  isnull(id_order)
 group by id_cart;

 

It works for me  :) 

nawres

nawres

This request gives us all abandoned baskets without date limit, if you want you can give an interval of time to execute this one:

select c.email , a.id_cart,a.date_add,
sum(if((IFNULL(cp.quantity,0) || ifnull(p.price,0)), cp.quantity*p.price,null)) as price
 from ps_cart as a 
 LEFT JOIN ps_customer c ON (c.id_customer = a.id_customer)
 LEFT JOIN ps_currency cu ON (cu.id_currency = a.id_currency) 
 LEFT JOIN ps_carrier ca ON (ca.id_carrier = a.id_carrier) 
 LEFT JOIN ps_orders o ON (o.id_cart = a.id_cart) 
  LEFT JOIN ps_cart_product cp ON (cp.id_cart = a.id_cart) 
  LEFT JOIN ps_product p ON (cp.id_product = p.id_product) 

 LEFT JOIN ( SELECT id_guest FROM ps_connections WHERE TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, date_add)) < 1800 LIMIT 1 ) AS co
 ON co.id_guest = a.id_guest
 where  isnull(id_order)
 group by id_cart;

 

It works for me  :) 

×
×
  • Create New...