Product options with pricing in radio button

  • Posts: 27
  • Thank you received: 0
11 years 9 months ago #52482

Hello,

I'm trying to change the product options ( that will affect the "price with options" ) to radio button instead of drop down.
However I can't find the option to change it just like the product characteristic.

I tried to modify the code at option.php, changing from
$html = JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox" size="1" onchange="hikashopChangeOption();"', 'value', 'text', (int)$value,$id );

to

$html = JHTML::_('select.radiolist', $this->values, $map, 'class="inputbox" size="1" onclick="hikashopChangeOption();"', 'value', 'text', (int)$value, $id );

but that doesn't work. The options changed to radiobutton, but the pricing doesn't change. Could you guide me on this? Thank you very much!

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
11 years 9 months ago #52545

I think that it's because the javascript code in hikashopChangeOption at the bottom of that view file needs to be adapted to handle radio selection instead of dropdown selection.
For a dropdown, you can directly do a ".value" on the main element. For radio, you will have to do a loop on each radio element to see which one is selected.

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

  • Posts: 27
  • Thank you received: 0
11 years 9 months ago #52597

Hi Nicolas,

Thank you very much for your reply. I managed to change the js, and now the pricing change but when I add to cart, the new pricing does not reflect on the cart.
Example, if I select "large" for a product, my product is now selling at $10. When I click "Add to cart", it shows "$5" which is the price for the small item.

I am still working on this, do let me know if you have any advice.
Appreciate your support so far, thanks again!

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
11 years 9 months ago #52672

I would have to look at the page in order to give an advice on that problem since it doesn't use anymore the core code of HikaShop.

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

  • Posts: 27
  • Thank you received: 0
11 years 9 months ago #52719

Hi Nicolas,

Have managed to solve the issue. The thing is we have to use back "$this->values" instead of own values, though the array is the same. Unsure why, but it seems that when add to cart the system will check back if that particular array value is selected or not.

Thanks for your help so far! :)

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

Time to create page: 0.062 seconds
Powered by Kunena Forum