Jump to content

Easy Pick List Trick using Presta's SQL query system


Mat_D1245

Recommended Posts

Hi Presta community,

 

here is a little trick to get your pick list done. 

Go to Advanced Settings > SQL query and save this one:

SELECT SQL_CALC_FOUND_ROWS 			
a.`id_order`,  CONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) AS `Name`, shop.name as shop_name, od.`product_id`,od.`product_reference`, od.`product_name`,od.`product_quantity` AS `qty`,a.`date_add` AS `date order`,
IF(SUBTIME(a.`date_upd`,'0 0:0:3')>a.`date_add`, a.`date_upd`,'---') AS `Updated am`
FROM `ps_orders` a 			 			 		
LEFT JOIN `ps_customer` c ON (c.`id_customer` = a.`id_customer`) 		
INNER JOIN `ps_address` address ON address.id_address = a.id_address_delivery 		
INNER JOIN `ps_country` country ON address.id_country = country.id_country 		
INNER JOIN `ps_country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = 2) 		
LEFT JOIN `ps_order_state` os ON (os.`id_order_state` = a.`current_state`) 		
LEFT JOIN `ps_order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = 2)  			 
LEFT JOIN ps_shop shop 							ON a.id_shop = shop.id_shop 	
LEFT JOIN `ps_order_detail` od ON od.`id_order`=a.`id_order`
WHERE 1  AND os.`id_order_state` IN (2,3,10,11)  AND a.id_shop IN (2, 1)  			 			 			
ORDER BY a.`id_order` DESC

Of course you'll have to fit the "where" clause to your needs...

Line 3 the subtime thing is meant show an update date only if there is a difference of more than 3 seconds between the dat_add and date_upd, just to make the whole list more readable.

 

Make create a shortcut to this query, and call it when you need it, and make paper print directly from your browser (ctrl+P).

 

Et voilà.

 

Hope sharing this will be helpful!

 

In return, I'd like some help in building a multishop with shared products and quantities, _without_ having to reset all quantities, if anyone knows.

 

Have a nice day picking your items before packing ;)
Mathieu. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...