- Posts: 88
- Thank you received: 20
Display prices of all available variants on product detail page
3 years 8 months ago #349557
by dyvel
-- 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
-- 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.
3 years 8 months ago - 3 years 8 months ago #349562
by dyvel
Replied by dyvel on topic Display prices of all available variants on product detail page
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:
with:
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:
Code:
$values[$k] = $value->characteristic_value;
with:
Code:
$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: 3 years 8 months ago by dyvel.
Please Log in or Create an account to join the conversation.
Time to create page: 0.064 seconds