Jump to content

[1.6.0.14] trying to export quantity of product combinations via mySQL but zero


Recommended Posts

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.

post-943662-0-34891900-1429924067_thumb.jpg

Link to comment
Share on other sites

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?

post-943662-0-45817900-1429937548_thumb.png

Link to comment
Share on other sites

×
×
  • Create New...