Jump to content
Sign in to follow this  

PS 1.7 Eksport zamówień do CSV z listy zamówień - edycja eksportowanych pozycji.

Recommended Posts

Proszę o pomoc, czy da się zmodyfikować zapytanie SQL eksportu do .csv na liście zamówień, aby były eksportowanie takie pozycje jak:

  • ID zamówienia + data
  • Zamówione produkty (id, nazwa, atrybut, ilość)
  • Imię i Nazwisko klienta
  • Adres dostawy
  • Rodzaj płatności
  • Status

W tej chwili generuje taką samą listę jak jest widoczna. A chodzi o to aby generowało wybrane pozycje jak wyżej.
Gdzie można ewentualnie zmodyfikować to zapytanie sql które jest generowane?

SELECT SQL_CALC_FOUND_ROWS a.`id_order`, `reference`, `total_paid_tax_incl`, `payment`, a.`date_add` AS `date_add`
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) AS `customer`,
		osl.`name` AS `osname`,
		IF((SELECT so.id_order FROM `ps_orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
		country_lang.name as cname,
		IF(a.valid, 1, 0) badge_success, shop.name as shop_name 
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` = 1)
		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` = 1) 
 LEFT JOIN `ps_shop` shop
                            ON a.`id_shop` = shop.`id_shop` WHERE 1  AND a.id_shop IN (1) 

 ORDER BY a.id_order DESC


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More