show the price of a product's variants along with the variant name

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
2 years 10 months ago #338409

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.10.2

Hi,
I know i have to alter the product/show_block_characteristics for this..
But how do i show the price of a product's variants along with the variant name.
I read this old post .. www.hikashop.com/forum/4-how-to/27065-sh...rice-of-variant.html but can not find the solution in this..
Can you please help..
Thanks.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 10 months ago #338414

Hi,

Well, it depends...
If you have the "characteristics selection method" setting set to "list" in the HikaShop configuration, the variants of each product will display as a listing on the product page, and each variant listed there will have its price displayed next to it automatically.

If you don't, then the variants are not directly visible. What you select is a value in each characteristic of the product, and the combination of the selection triggers the selection of a variant. And at that point, the price display of the product page is refreshed with the price of the selected variant.

For example, on the page demo.hikashop.com/index.php/en/hikashop/...with-characteristics
You can't display the price for each color or the price for each shoe size. That's because the price is set for each variant which is a combination of the color and shoe size. And thus, the price can only be displayed when you change the selection and the system knows the combination you're talking about.
For example, we can't put a price next to each shoe size because for the same 4.5 shoe size, the price will vary based on the selected color.

If you want to have different prices displayed for different choices of selection dropdowns on the product page, then it's likely that you want to use options, like here: demo.hikashop.com/index.php/en/hikashop/...ct-page/with-options
There, the price is displayed for each choice and there is a total price which is the sum of the product base price, and the price of each selected option.

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
2 years 10 months ago #338558

Hi nicolas,

Yes that i know when we use options, the + price is shown that is great we use that also..
But some products have a variant and also options..
At some points we would like to have the price of the variant also be shown in the dropdown.
As i read in this old post:
www.hikashop.com/forum/4-how-to/27065-sh...rice-of-variant.html
Thanks ..

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 10 months ago #338560

Hi,

One problem with that is that it can only work when you have only one characteristic attached to the product.
If you have several characteristics, then the value you select in the dropdown of one characteristic doesn't correspond to one variant but to several.
But the solution I gave in the last post of the thread you're pointing at is still good. The only difference is that we moved the code from administrator/components/com_hikashop/types/characteristic.php to the view file product / show_block_characteristic.php
That's great since you can now make the modification as a view override and thus not loose the change when you update HikaShop.
www.hikashop.com/forum/4-how-to/27065-sh...html?start=20#293632

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

Time to create page: 0.059 seconds
Powered by Kunena Forum