Jump to content

[SOLVED] how to get product features access in controller


SonoguN
 Share

Recommended Posts

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())

Share this post


Link to post
Share on other sites

  • 3 years later...

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

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 years later...
  • 4 months later...
  • 7 months later...

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}

 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More