- Posts: 209
- Thank you received: 18
Show price of variant
Is it possible to show the price of a product's variants along with the variant name?
I have a product that has many variants which are sizes. Each size has it's own price.
I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.
I don't particularly want to set all the variants up as products.
I have tried displaying the variants as a "table" but this does not seem to change anything.
Just wondering if there is any quick way of showing the variant prices?
cheers!
Please Log in or Create an account to join the conversation.
There is no option for that.
That would require to do a characteristic display override:
www.hikashop.com/en/support/documentatio...tation.html#override
Please Log in or Create an account to join the conversation.
I have a store with many thousand of products in it and each product has set quantity/price variations.
Example:
Product "A"
Box of 100 - $50.00
Box of 1000 - $80.00
Carton of 5000 - $120.00
Product "B"
Box of 100 - $30.00
Box of 1000 - $40.00
Carton of 5000 - $80.00
From the above, you can see that I have 3 characteristics - "Box of 100", "Box of 1000", "Carton of 5000" - but in order to show the variant prices on the product listing I actually have to add the price to the characteristic's value text, thus I end up with 6 characteristics.
This is the only way I can see to acheive the display of the variant prices so the buyer knows what they are buying. Doing this I can see that I will end up with hundreds of thousands of characteristics and if I ever need to do a price change I'll need to find each charateristic, ensure that it is only attached to one product and then change the text, and then change the variant price in the product. Alternatively, I guess I could put a quantity/price table in each product description. Either way it sounds like a maintenance headache for a store with thousands of products.
I can't use the price variations on the actual main product as this allows the customer to type in a quantity between the three values, which won't work and I can't tell the customer what the configuration is (packet or box or carton etc).
I had a look at the instructions for doing the display override but I can't work out where to put what. The variant text info is in the jos_hikashop_product table but the variant price is in the jos_hikashop_price table. I don't know how to configure the PHP to join the two. Also, I can't find any of the product display views that seem to configure this.
Unless, I'm missing something fundamental here, I think that what's missing is the possibility to have set product/price variations (and I think this would be a great enhancement for Hikashop future versions). Until then I probably need to find an alternative unless there are any better suggestions.
These posts seems to describe similar issues - I'm wondering how they overcame the display of the variant prices?
www.hikashop.com/en/support/forum/2-gene...f-measure.html#21479
www.hikashop.com/en/support/forum/4-how-...r-options.html#21424
www.hikashop.com/en/support/forum/4-how-...each-size.html#21136
Cheers!
Please Log in or Create an account to join the conversation.
There, you can enter your price scheme for your variants and thus you can have one price per variant.
There is no problem on that. It's actually built into HikaShop.
You can actually see the price update on the product page based on the variant selected.
Now, to display the price inside the dropdown with the characteristic name, you will have to change the way it's displaying by creating a characteristic display override. You don't have to join any table data, or load any data, the data you need is already loaded and given to you by the override system. You just need to write the PHP of the override. Now that requires that you know PHP quite well as it's not simple I agree, but it's totally possible to do.
Please Log in or Create an account to join the conversation.
Back to Zen Cart on this one I guess!
thanks anyway.
Please Log in or Create an account to join the conversation.
I have added the following code to characteristic.php:
foreach($characteristic->values as $k => $value){
$price=$element->variants[$k]->prices[0]->price_value;
$price=sprintf("%01.2f", $price);
$values[$k]=$value->characteristic_value." - $".$price;
and I have now got variant dropdown boxes that have the price appended to the vairant text. Problem is, all the prices are zero (ie: Red - $0.00)
See attached pic.
Any help on what I'm doing wrong appreciated!
Tks
Please Log in or Create an account to join the conversation.
So $element->variants[$k] is not correct.
You should loop on $element->variants to check on whether the variant is linked to that characteristic id and then get the price of the variant if it's a match.
Please Log in or Create an account to join the conversation.
IMHO, being able to show the price of the variant in the dropdown box would be a very good addition to future Hikashop versions.
Please Log in or Create an account to join the conversation.
Yes, you're right.
Actually, I think that we should move the characteristic file to a view, like we did for options.
That way, it can easily be overridden and such display modifications can be more easily done.
Please Log in or Create an account to join the conversation.
cheers!
(Up to shop number 15 using Hikashop and loving it!)
Please Log in or Create an account to join the conversation.
We didn't change that yet.
Please Log in or Create an account to join the conversation.
Do you have the correct code that I can copy into characteristic.php?
Many thanks
Please Log in or Create an account to join the conversation.
Is the option to edit the display of product characteristics inclued in the current version? If so, which view controls the way the characteristics are displayed?
I would also like to be able to show the price of the different variants of a product behind the variant name. Ideally this would be the additional price of a characteristic (so price of variant - price of basic item) much the same as is done with product options.
Kind regards,
Chris
Please Log in or Create an account to join the conversation.
No it's not. You need to do it via a template override as explained in the developer documentation:
www.hikashop.com/en/support/documentatio...tation.html#override
Please Log in or Create an account to join the conversation.
But i cant find the way to do that. The only name is dispayed.
Please Log in or Create an account to join the conversation.
That's not variants, but product options.
In your product page you have to select another product as option, and then the customer will be able to use the option or not, and this option has a price displayed.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
There is no option to do that if you really want to do it you'll have to directly edit some hikashop files, but some development skills will be required.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
In HikaShop, we use "view overrides". It means that you create a file in your template folder which will override the original view content.
It is totally safe ; you won't loose your modification with updates etc.
For customization it is often the best way to have your specific result.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.