louissss Posted May 25, 2012 Share Posted May 25, 2012 (edited) Hi given the product id, is there an existing function returning the id_product_attribute from the id_attributes? like a "getIdProductAttribute" function...to use in the product.tpl file. Thank you Edited May 27, 2012 by louissss (see edit history) Link to comment Share on other sites More sharing options...
Jeremiie Posted February 1, 2016 Share Posted February 1, 2016 I know it's an old post, but as I was not able to find how to do this either, I share with you a small function I wrote. You have to add it in classes/Product.php. This allow you to get the id_product_attribute (which is required by $cart->updateQty, if you only have the product id, and the attribute id. public function getIdProductAttribute($id_attribute, $id_product) { return Db::getInstance()->getValue(' SELECT psnut_product_attribute_combination.id_product_attribute FROM psnut_product_attribute_combination INNER JOIN psnut_product_attribute ON psnut_product_attribute_combination.id_product_attribute = psnut_product_attribute.id_product_attribute WHERE psnut_product_attribute.id_product = '.(int)$id_product.' AND psnut_product_attribute_combination.id_attribute = '.(int)$id_attribute); } Then you can use $cart->updateQty(1, $id_product, $product->getIdProductAttribute($id_attribute , $id_product), false); Link to comment Share on other sites More sharing options...
softhightech Posted March 14, 2017 Share Posted March 14, 2017 try this one : $attributes = $product->getAttributeCombinations($context->language->id); Link to comment Share on other sites More sharing options...
softhightech Posted March 17, 2017 Share Posted March 17, 2017 this is worked for me SELECT ps_attribute_group_lang.public_name, ps_attribute_lang.name FROM `ps_attribute` join ps_attribute_group_lang on(ps_attribute_group_lang.id_attribute_group = ps_attribute.id_attribute_group) join ps_attribute_langon (ps_attribute_lang.id_attribute = ps_attribute.id_attribute) join ps_product_attribute_shop on (ps_product_attribute_shop.id_product_attribute = ps_attribute.id_attribute) where ps_attribute.id_attribute = 189 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now