DARKF3D3 Posted November 7, 2013 Share Posted November 7, 2013 I need a query to show a list of all products, with id-product, product name and manufacturer. Example: 1 iPhone 5 Apple 2 iPhone 4s Apple 3 Galaxy S4 Samsung 4 Galaxy S4 Mini Samsung 5 ... ... 6 ... ... Someone could help me? I'm not so good with sql. PS: I'm using prestashop 1.4.9 Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 8, 2013 Author Share Posted November 8, 2013 No one know which query i can use to do that? Link to comment Share on other sites More sharing options...
vekia Posted November 8, 2013 Share Posted November 8, 2013 select p.id_product, pl.name,ps.name from ps_product AS p INNER JOIN ps_product_lang AS pl ON p.id_product = pl.id_product LEFT JOIN ps_supplier AS ps ON p.id_supplier = ps.id_supplier WHERE pl.id_lang=1 effect: Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 8, 2013 Author Share Posted November 8, 2013 Thanks vekia, using your code i finally got the list, i change supplier with manufacturer, because i need to know the manufacturer and not the supplier. Here's my code: select p.id_product, pl.name,ps.name from ps_product AS p INNER JOIN ps_product_lang AS pl ON p.id_product = pl.id_product LEFT JOIN ps_manufacturer AS ps ON p.id_manufacturer = ps.id_manufacturer WHERE pl.id_lang=1 Thanks a lot Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 8, 2013 Author Share Posted November 8, 2013 I notice a strange things using my last query i posted, few products (like 10 on a catalogue of 500) showed in the list have wrong product name... I don't understand how it's possible. Link to comment Share on other sites More sharing options...
vekia Posted November 8, 2013 Share Posted November 8, 2013 try to change id_lang field to your language, can you chec results then? Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 9, 2013 Author Share Posted November 9, 2013 Ok, I found the problem. Sometimes, to add at catalog a new product, i copy an existing product, and after i change it's name, but when i change it, in the other language it maintain the old name. It's isn't possible to force the same name for every language or disable the other languages? In fact i don't use them. Link to comment Share on other sites More sharing options...
DARKF3D3 Posted November 14, 2013 Author Share Posted November 14, 2013 Now I'm trying to modify the query to show only the products with no manufactured, any help? Link to comment Share on other sites More sharing options...
vekia Posted November 15, 2013 Share Posted November 15, 2013 select p.id_product, pl.name,ps.name from ps_product AS p INNER JOIN ps_product_lang AS pl ON p.id_product = pl.id_product LEFT JOIN ps_manufacturer AS ps ON p.id_manufacturer = ps.id_manufacturer WHERE pl.id_lang=1 AND p.id_manufacturer = '' Link to comment Share on other sites More sharing options...
werklich Posted January 6, 2014 Share Posted January 6, 2014 nice query, thanks :-) what about sold item + manufacturer in one query? does it work also? Version: 1.5.6.1 Link to comment Share on other sites More sharing options...
vekia Posted January 7, 2014 Share Posted January 7, 2014 sold item - you mean number of sold items, or just ordered products list based on "manufacturer" ? Link to comment Share on other sites More sharing options...
werklich Posted January 8, 2014 Share Posted January 8, 2014 think i got - look this way, to get all informations: SELECT * FROM `ps_order_detail` AS od INNER JOIN `ps_product` AS p ON od.product_id = p.id_product LEFT JOIN ps_manufacturer AS ps ON p.id_manufacturer = ps.id_manufacturer backround: the result of the sql query will be imported by excel, qlikview e.g, to send e-mails to manufacturer about ordering; manufacturer will send invoice, delivery note etc. to customer and gets the cash, we get commission. some products must be delivered by manufacturer himself (e.g. container, stairways) so it's a must have to know the manufacturer by each sold product. in this case the handling about delivering is an other great problem :-) Link to comment Share on other sites More sharing options...
Recommended Posts