Jump to content

Get product combination price


Recommended Posts

Hello

I need to get the specific price from a product.

Here http://doc.prestashop.com/display/PS16/Chapter+10+-+Price+management I only found a URL query:

es. /api/products/1?price[my_price][use_tax]=0&price[mon_prix][product_attribute]=25

 

But I need to use it inside the controller.

Now my code is:

$this->product = new Product(9, true, $this->context->language->id, $this->context->shop->id);

$price = number_format((($this->product->price * 20 / 100) + $this->product->price), 2)." ".$this->context->currency->sign;
 
And I have to edit it to get a specific price for each combination.
Thank you for the help.
Link to comment
Share on other sites

In function updatePrice() located in product.js 

 

Just create the n numbers of div in your product page as per need.

in tpl page: 

 

<div id="att1"></div>

<div id="att_price1"></div>

 

in js file

 
put following ocde in function updatePrice() method in product.js file.
 
$('#att1').text(combination.attributes_values[1]);
$('#att1').show();
 
$('#att_price1').text(formatCurrency(combination.price * currencyRate, currencyFormat, currencySign, currencyBlank));
$('#att_price1').show();
 
do backup .
Link to comment
Share on other sites

Thank you Sandip for your reply.

 

I tried as you wrote me, but I got some errors.

The first concern the combination variable that is not declared, so I search inside the product.js and I found "combinations".

After changed the variable name I got this error:

Uncaught TypeError: Cannot read property '1' of undefined

 

It seems there are no combination inside the array.

Link to comment
Share on other sites

×
×
  • Create New...