SonoguN Posted October 15, 2013 Share Posted October 15, 2013 Hi I am looking for a way to access product features from a custom module controller. Can anyone offer some guidance on which function I need to use, or how to go about doing this? Thanks, Etienne Link to comment Share on other sites More sharing options...
vekia Posted October 15, 2013 Share Posted October 15, 2013 $product = new Product(2); $product_features = $product->getfeatures(); then you will have features in product $product_features Link to comment Share on other sites More sharing options...
SonoguN Posted October 15, 2013 Author Share Posted October 15, 2013 Awesome, thanks I will try this Link to comment Share on other sites More sharing options...
vekia Posted October 15, 2013 Share Posted October 15, 2013 don't forget to confirm if everything will work as you expect Link to comment Share on other sites More sharing options...
SonoguN Posted October 16, 2013 Author Share Posted October 16, 2013 Hi Vekia, I ended up using the following to get an array of features... $frontfeatures = Product::getFrontFeaturesStatic($this->context->language->id, $thisProductid); Thanks for your help Link to comment Share on other sites More sharing options...
SonoguN Posted October 16, 2013 Author Share Posted October 16, 2013 Just wondering is there a comprehensive list of functions and explanations on how to use them? Or do we need to dig around in the controllers to find this out? Thanks Link to comment Share on other sites More sharing options...
vekia Posted October 16, 2013 Share Posted October 16, 2013 i don't know any list of functions, i'm developing modules, apps etc. and usually you can easily browse available functions in classes, /** * Update a product attribute * * @param integer $id_product_attribute Product attribute id * @param float $wholesale_price Wholesale price * @param float $price Additional price * @param float $weight Additional weight * @param float $unit * @param float $ecotax Additional ecotax * @param integer $id_image Image id * @param string $reference Reference * @param string $ean13 Ean-13 barcode * @param int $default Default On * @param string $upc Upc barcode * @param string $minimal_quantity Minimal quantity * @return array Update result */ public function updateAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity = null, $available_date = null, $update_all_fields = true, array $id_shop_list = array()) Link to comment Share on other sites More sharing options...
SonoguN Posted October 16, 2013 Author Share Posted October 16, 2013 Ok cool, thanks! that''s what I usually do now just thought there may be a wiki or something.. Cheers Link to comment Share on other sites More sharing options...
vekia Posted October 18, 2013 Share Posted October 18, 2013 thank you, im going to mark this thread as [solved] with regards Milos 1 Link to comment Share on other sites More sharing options...
Rom Soul Posted September 4, 2017 Share Posted September 4, 2017 $product = new Product(2); $product_features = $product->getfeatures(); then you will have features in product $product_features I want to access this info in a module but I use Prestashop1.6 : did this code evolve ? I cannot make it work ... 1 Link to comment Share on other sites More sharing options...
Spir Posted October 12, 2020 Share Posted October 12, 2020 in 1.7 this how you would access the features: {foreach from=$product->features item=feature} {$feature['id_feature']} {$feature['name']} {$feature['value']} {/foreach} Link to comment Share on other sites More sharing options...
Inter Svetainė Posted February 22, 2021 Share Posted February 22, 2021 In Prestashop 1.7.7 this Product::getFeaturesStatic($product['id_product']); works fine. 1 Link to comment Share on other sites More sharing options...
Sasni Posted October 3, 2021 Share Posted October 3, 2021 Prestashop 1.7.7.x in BO tpl: $product = new Product($params['id_product']); $features = $product->getFrontFeatures($this->context->language->id); $this->context->smarty->assign( array( 'features' => $features, ) ); in front tpl: global $cookie; $product = new Product(intval($_GET['id_product']), true, intval($cookie->id_lang)); $features = $product->getFrontFeatures(intval($cookie->id_lang)); $this->context->smarty->assign('features', $features); then in tpl file: {foreach from=$features item=$feature} {$feature.id_feature} - {$feature.name} - {$feature.value}<br> {/foreach} 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