- Posts: 27
- Thank you received: 0
Product options with pricing in radio button
14 years 3 months ago #52482
by sylph
Product options with pricing in radio button was created by sylph
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!
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.
14 years 3 months ago #52545
by nicolas
Replied by nicolas on topic Re: Product options with pricing in radio button
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.
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.
14 years 3 months ago #52597
by sylph
Replied by sylph on topic Re: Product options with pricing in radio button
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!
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.
14 years 3 months ago #52672
by nicolas
Replied by nicolas on topic Re: Product options with pricing in radio button
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.
14 years 3 months ago #52719
by sylph
Replied by sylph on topic Re: Product options with pricing in radio button
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!
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.166 seconds