Jump to content

Get product by feature name (mySQL)


Frenchy

Recommended Posts

Hello, I'm trying to get all product by feature name in SQL.

I have some difficulties with Prestashop Database Architecture. I know there is the feature_value_lang with the value of feature and the id_feature_value.I know there is the feature_product with the id_product and the id_feature_value. I want to get in a array all products with a feature in parameter.

 

How can I do this ? I'm a newbie, Join SQL ? How I can do this ?

Link to comment
Share on other sites

You can try

Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(" 
	SELECT p.id_product
    FROM `'._DB_PREFIX_.'feature_product` as p
    LEFT JOIN `'._DB_PREFIX_.'feature_value` as f ON (f.`id_feature_value` = p.`id_feature_value`)
    LEFT JOIN `'._DB_PREFIX_.'feature_shop` fs ON (f.`id_feature` = fs.`id_feature`)
    WHERE ...
")

 

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