- Posts: 91
- Thank you received: 5
Show price of variant
I was also looking for an option to show price of a variant and after some trying I found out that this code works:
In file
/administrator/components/com_hikashop/types/characteristic.php
line about 227
instead of
But I also know that after HikaShop upgrade I will lose it. Is there a chance to implement this option by HikaShop Team?
Please Log in or Create an account to join the conversation.
We're thinking about doing something but it's a complex issue. Most of the time, you don't want the price there. Especially, since it can only work with one characteristic on the products. But even with only one characteristic, there are many cases when you don't want to display the price there.
We'll have to figure out something but we try to avoid adding too many options.
In fact, we're thinking of redoing the whole characteristic system in order to be ajax like we did with HikaShop 3 and the cart/checkout system. So when we do, we'll make sure that you can override the display properly.
But that won't happen in the short term.
For now, you'll have to keep your hack of the core or develop a small class override plugin to override the whole class of the file to have your change taken into account.
Here is a thread where we talk about class overrides:
www.hikashop.com/forum/2-general-talk-ab...custom-features.html
Please Log in or Create an account to join the conversation.
I am trying to create a plugin as you said.
Can you take a look at the code?
github.com/bolando/plg_hika_char_prices/
Is the logic OK?
It doesn't seem to work now.
Please Log in or Create an account to join the conversation.
Change the class name to hikashopCharacteristicTypeOverride and it should be taken into account by HikaShop automatically.
You can add temporarily an exit; at the beginning of the load function just to make sure that your override class is used by HikaShop.
Please Log in or Create an account to join the conversation.
your code nearly worked for me.
I had to change $cena[ ] to $cena in both lines, and then it worked.
Why did you make $cena[ ] and array?
Thanks
Thomas
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 5
- Thank you received: 0
Please Log in or Create an account to join the conversation.
If you want to have the price added to the variants, you can just change the code:
Please Log in or Create an account to join the conversation.
- Posts: 424
- Thank you received: 11
This gives the variants value and only price (€ 0,00) behind all the variants..
or am i missing something?
Please Log in or Create an account to join the conversation.
This won't work anymore as we moved things around.
You now have to change the line:
Please Log in or Create an account to join the conversation.
- Posts: 424
- Thank you received: 11
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Can you check via "Hikashop->Display->Views" that you have edited the "show_block_characteristic" file of the "product" view of your front-end template that you are currently using on your website :
www.hikashop.com/support/documentation/1...-display.html#layout
Kind regards,
Mohamed.
Please Log in or Create an account to join the conversation.
- Posts: 424
- Thank you received: 11
I editted the right view..
Just checked it.
Please Log in or Create an account to join the conversation.
I checked the code and did some debugging and the issue is that the variants array keys are modified before reaching the view file to sort them based on the order configured in the shop while it's not yet the case in the location where the code was to be modified in old versions of HikaShop.
This means that the code needs to be a bit more complex, like this:
Please Log in or Create an account to join the conversation.