Jump to content

[Prestashop]Underlaying MySql database question regarding fetching products


KernelPanic

Recommended Posts

Dear Sirs and Madams!

 

I am currenctly working on some standalone Prestashop Extension and I want to retreive products from ps underlaying ps database. I am trying to achieve that with following mysql query:

SELECT ps_product.id_product, ps_product_lang.name, ps_product.wholesale_price,ps_product.price, ps_product.id_manufacturer, ps_category_product.id_category, ps_category_lang.name
FROM ps_product INNER JOIN ps_product_lang, ps_category_product, ps_category_lang
WHERE ps_product_lang.id_product=ps_product.id_product AND ps_product_lang.id_lang=1
AND ps_category_product.id_product=ps_product.id_product AND ps_category_lang.id_lang=1

I get products, but for every product I get all categories, but I want to fetch only the category which fetched product belongs to. Can someone help me with this?

 

Sincerely,

Marko

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