tinybibiya Posted April 25, 2015 Share Posted April 25, 2015 Hi, I looked into my phpmyadmin SQL table for the quantity for every product combination but from ps_product, ps_product_attribute quantity is all ZERO. suppose to have actual stock count. Googled for answers and v1.5 said look into ps_stock_available but i do not have that table in my case. Where is the actual quantity for v1.6.0.14? I'm not using the warehouse option. Link to comment Share on other sites More sharing options...
kishoreunni Posted April 25, 2015 Share Posted April 25, 2015 (edited) ps_stock_available is there in local prestashop 1.6.0.14 and in remote prestashop 1.6.0.14. It is a table that is coming just after ps_stock table. Hope it may help u. Edited April 25, 2015 by kishoreunni (see edit history) Link to comment Share on other sites More sharing options...
tinybibiya Posted April 25, 2015 Author Share Posted April 25, 2015 Hi, OK i found the table already. Now the problem is I have this SQL query: SELECT p.id_product, p.id_category_default, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ";") as categories, pa.reference, pl.name, GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR "; ") as combination, p.price, pq.quantity FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute) LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product) LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) LEFT JOIN ps_category c ON (cp.id_category = c.id_category) WHERE pl.id_lang = 1 AND pal.id_lang = 1 GROUP BY pa.reference ORDER BY p.id_product, pac.id_attribute The result is I got in attachment. Under the categories, I actually want just the main category. How can I modify the code to just get the main category name? Link to comment Share on other sites More sharing options...
kishoreunni Posted April 25, 2015 Share Posted April 25, 2015 Do the appropriate sql coding in the following so that u can yield ur result. GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ";") as categories, LEFT JOIN ps_category c ON (cp.id_category = c.id_category) Link to comment Share on other sites More sharing options...
tinybibiya Posted April 25, 2015 Author Share Posted April 25, 2015 My code is already like that.... Your reply doesn't solve it. The current code grabs all categories link to that product. I just need 1; which is the default category. Link to comment Share on other sites More sharing options...
Recommended Posts