Where does the Price with options price come from and how to control it

  • Posts: 366
  • Thank you received: 7
  • Hikashop Business
5 years 1 week ago #316373

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

Please Log in or Create an account to join the conversation.

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
5 years 1 week ago #316374

Hi,

It's supposed to be the price of the master product. It's calculated with the 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;
			}
		}
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:
		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.054 seconds
Powered by Kunena Forum