Where does the Price with options price come from and how to control it
6 years 6 months ago #316373
by grayt7
-- HikaShop version -- : 4.2.3
-- Joomla version -- : 3.9
-- PHP version -- : 7.4
Hi,
When there are characteristic variants where does the Price with options base price come from? The product in the URL does have template overides but even with those removed the value is the same.
Price of the master product is 13.45 with VAT
The default variant price is 16.14 with VAT
So why does it pick a varian that isn't default for the Price with options price?
Please let me know how to control this.
Many thanks.
-- Joomla version -- : 3.9
-- PHP version -- : 7.4
Hi,
When there are characteristic variants where does the Price with options base price come from? The product in the URL does have template overides but even with those removed the value is the same.
Price of the master product is 13.45 with VAT
The default variant price is 16.14 with VAT
So why does it pick a varian that isn't default for the Price with options price?
Please let me know how to control this.
Many thanks.
Please Log in or Create an account to join the conversation.
6 years 6 months ago #316374
by nicolas
Replied by nicolas on topic Where does the Price with options price come from and how to control it
Hi,
It's supposed to be the price of the master product. It's calculated with the code:
in the file "show" of the view "product".
Please double check that its price is 13.45 with tax and not without taxes.
However, in your case, when you display the characteristics in "list" mode and with different prices for different variants, I think it makes sense that the price with options should be 0 when no options are applied. To do that, you can add such code after the code I posted above:
It's supposed to be the price of the master product. It's calculated with the code:
Code:
$priceUsed = 0;
$unit_price = false;
if(!empty($this->row->prices)) {
foreach($this->row->prices as $price) {
if(!isset($price->price_min_quantity) || !empty($this->cart_product_price) || $unit_price)
continue;
if($price->price_min_quantity <= 1)
$unit_price = true;
$name = 'price_value';
if($this->params->get('price_with_tax'))
$name = 'price_value_with_tax';
if(!$unit_price && $price->$name > $priceUsed)
continue;
$priceUsed = $price->$name;
}
}
Please double check that its price is 13.45 with tax and not without taxes.
However, in your case, when you display the characteristics in "list" mode and with different prices for different variants, I think it makes sense that the price with options should be 0 when no options are applied. To do that, you can add such code after the code I posted above:
Code:
if(!empty($this->displayVariants['prices']) && $this->params->get('characteristic_display') == 'list') {
$priceUsed = 0;
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.173 seconds