Jump to content

customization SQL query


Recommended Posts

Hi,

I am trying to export some data from Prestashop which includes a column for some customization data that some products have. The problem is, I can find no way to link the customization to a product in the order. This means that I end up with duplicates when someone has placed an order with multiple products. Here is my SQL so far (I'm no expert in SQL queries as you can probably see)!

SELECT ps_orders.id_order, ps_order_detail.id_order_detail, ps_customized_data.id_customization, ps_order_detail.product_name, value FROM ps_order_detail LEFT JOIN ps_orders ON ps_orders.id_order=ps_order_detail.id_order LEFT JOIN ps_customization ON ps_orders.id_cart=ps_customization.id_cart LEFT JOIN ps_customized_data ON ps_customized_data.id_customization=ps_customization.id_customization WHERE ps_orders.id_carrier=0 AND ps_order_detail.product_name NOT LIKE 'Spectator%'



If someone has made an order with a product AND a "Spectator" product, my query will show the customization for the Spectator product even though I don't want it to.

Any help would be greatly appreciated.

Link to comment
Share on other sites

×
×
  • Create New...