Show product price in variants?

  • Posts: 175
  • Thank you received: 0
9 years 7 months ago #228819

-- url of the page with the problem -- : localhost
-- HikaShop version -- : 1.6.0

Hello

is it possible to show price in variants like this

imgur.com/AvhB5Tw

also, there is 2 variant, only variant 1 shows the price, and the price will be updated when variant 2 changed
for example, if clothes size is changed, the price for each color is updated

Thank you

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 7 months ago #228826

Hi,

By customizing the display view files, I don't see a problem in doing that.

Having the price change based on the variants selected is possible by default. So that's not a problem either.

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

  • Posts: 175
  • Thank you received: 0
9 years 7 months ago #228959

nicolas wrote: Hi,

By customizing the display view files, I don't see a problem in doing that.

Having the price change based on the variants selected is possible by default. So that's not a problem either.


Hello

Could you please guide me how to do it?

What i want is for each variant from characteristics A show it's price and when variants from characteristics B changed, the price displayed in variants A also changed

in the image there are actually 2 variants, weight and type. The type variant shows price while the weight variant only show the unit. When user click on the weight, the price in type also changed the price

Thank you in advance

Last edit: 9 years 7 months ago by veeco.

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 7 months ago #228994

Hi,

Well, as I said it requires customizing the display view files. It's not easy to do.
So you need to see that with a developer.
You'll have to add custom javascript to refresh the values in the selection dropdown so that the prices are updated. So it will also require adding additional HTML in order to store the different prices in order to swap them with the custom javascript code.
Then, it's just a matter of setting the price of each variant and the main price will refresh automatically.

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

  • Posts: 175
  • Thank you received: 0
9 years 7 months ago #229797

nicolas wrote: Hi,

Well, as I said it requires customizing the display view files. It's not easy to do.
So you need to see that with a developer.
You'll have to add custom javascript to refresh the values in the selection dropdown so that the prices are updated. So it will also require adding additional HTML in order to store the different prices in order to swap them with the custom javascript code.
Then, it's just a matter of setting the price of each variant and the main price will refresh automatically.


hi

Could you please give me the list location of files that i need to modify? I tried to find it but cant find which one to modify, especially the variant since i need to add the price in the variant button
And maybe some hint and tips for the logic using the hikashop view?

Thank you

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 7 months ago #229800

Hi,

It should be possible to add all your custom code in just the file "show_block_characteristic" via the menu Display>Views.
In fact you should even be able to add it to the show_default view file.
The characteristic dropdowns are generated in administrator/components/com_hikashop/types/characteristic.php
You could add a call to your custom javascript update function in the onclick of the characteristic dropdowns there, but you could easily do the same in the show_block_characteristic file with a str_replace on the returned HTML of the type.characteristic file:
echo $this->characteristic->displayFE($this->element, $this->params) . '</div>';
As I said, you need to refresh the dropdown values with javascript. So it's not really related to how HikaShop works. It's just standard javascript whereby you search for the characteristic dropdowns in the dom and update their options with new values.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum