Jump to content

Export quotidien des commandes pour transporteur


Recommended Posts

Bonjour,

Je cherche à trouver une requête sql pour exporter les infos des commandes pour les importer ensuite dans mon logiciel de transport.

Je ne suis pas sûr de l'exactitude de ma requête. Lorsque j'essaie d'enregistrer cette requête Prestashop m'affiche une erreur "FROM n'existe pas"...

Auriez-vous une idée du souci ?

Merci

Prestashop 1.7.5

SELECT
   d.id_order,
   o.date_add,
   CONCAT_WS(' ', g.firstname, g.lastname) AS customer,
   g.email,
   os.name AS state,
   d.product_name,
   d.product_reference,
   d.product_quantity,
   d.product_price,
   o.payment,
   c.name AS carrier_name,
   CONCAT_WS(' ', a.lastname, a.firstname, a.address1, a.address2, a.postcode, a.city) AS address_delivery,
   CONCAT_WS(' ', a.lastname, a.firstname, a.address1, a.address2, a.postcode, a.city) AS address_invoice,
   REPLACE(IFNULL(GROUP_CONCAT(cd.value), ''), '"', '\'') AS customized_data 
FROM
   psvj_order_detail d 
   LEFT JOIN
      psvj_orders o 
      ON (d.id_order = o.id_order) 
   LEFT JOIN
      psvj_customer g 
      ON (o.id_customer = g.id_customer) 
   LEFT JOIN
      psvj_carrier c 
      ON (o.id_carrier = c.id_carrier) 
   LEFT JOIN
      psvj_order_state_lang os 
      ON (o.current_state = os.id_order_state) 
   LEFT JOIN
      psvj_address a 
      ON (a.id_address = o.id_address_delivery) 
   LEFT JOIN
      psvj_address ab 
      ON (ab.id_address = o.id_address_invoice) 
   LEFT JOIN
      psvj_customization cu 
      ON (cu.id_cart = o.id_cart) 
   LEFT JOIN
      psvj_customized_data cd 
      ON (cd.id_customization = cu.id_customization) 
WHERE
   os.id_lang = 1 
   AND DAY(o.date_add) = DAY(NOW()) 
GROUP BY
   d.id_order 
ORDER BY
   d.id_order DESC

 

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...