Display prices of all available variants on product detail page

  • Posts: 88
  • Thank you received: 19
1 year 1 month ago #349557

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.1

Hi

On my product detail page, I'm displaying variants as a radio group.
The product price is dynamically updated based on the selected radio input. This is all fine.

However, I'm looking for a way to display all the prices for each variant, while maintaining the layout using a radio group to list the variants.
I've looked at show_block_characteristic and listing_price, but before I dig deeper, I thought I'd ask if you know of an easy way to accomplish this?

Thanks

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

  • Posts: 88
  • Thank you received: 19
1 year 1 month ago #349562

Actually I found a way. This post helped me: www.hikashop.com/forum/4-how-to/27065-sh...-variant.html#293632
I adapted the code, so it would work as a layout override in show_block_characteristic.

In my case, I modified line 156 and replaced:

$values[$k] = $value->characteristic_value;

with:
$currencyHelper = hikashop_get('class.currency');
$values[$k] = $value->characteristic_value.' ('.$currencyHelper->format($this->element->variants[sprintf("%04d", $k).'+'.$value->variant_product_id]->prices[0]->price_value,$this->element->variants[sprintf("%04d", $k).'+'.$value->variant_product_id]->prices[0]->price_currency_id).')';

Last edit: 1 year 1 month ago by dyvel.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum