[Skip to main content](#vessel-content)

#   Displaying product options as radio buttons and creating custom product creator

##

- **[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")**
- [![jgardounis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar36377.jpg)](/forum/user/36377-jgardounis "View jgardounis's Profile") Topic Author
- [ Offline](/forum/user/36377-jgardounis)

Less More

- Posts: 8
- Thank you received: 4
-
-

8 years 3 weeks ago -  8 years 3 weeks ago [\#299853](#299853) by [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")  *[Displaying product options as radio buttons and creating custom product creator](/forum/2-general-talk-about-hikashop/896107-displaying-product-options-as-radio-buttons-and-creating-custom-product-creator#299853 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.13  Hello everyone,  I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy. I have the following characteristics:  - Size - Padded - Fabric 1  I read the tutorial (that I found very helpful) and managed to create a rudimentary system of what I want.  What I did is basically: a. Create a Custom Product and a second product I named Custom Product Characteristic as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.  b. I went to the Custom Product and in the Options field I added the three Custom Product Characteristics as options, thus allowing me to be able to made the selections on the product page.  I have the following questions:  1. I want Fabric 1 to be a radio button selection instead of dropdown selection. Is there a way to do this? I went to Hikashop &gt; Configuration &gt; Product Options and changed Characteristics selection method to Radio Button and the Product selection method to On a per product basis , but when  2. When I select a Fabric 1 option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).  Thank you in advance.  Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.")* was created by *[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")*

-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.13

Hello everyone,

I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy.
I have the following characteristics:

- Size
- Padded
- Fabric 1

I read the tutorial [ here](https://www.hikashop.com/support/documentation/integrated-documentation/19-hikashop-product-form.html#specifications) (that I found very helpful) and managed to create a rudimentary system of what I want.

What I did is basically:
a. Create a **Custom Product** and a second product I named **Custom Product Characteristic** as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.

b. I went to the **Custom Product** and in the Options field I added the three **Custom Product Characteristics** as options, thus allowing me to be able to made the selections on the product page.

I have the following questions:

1. I want **Fabric 1** to be a radio button selection instead of dropdown selection. Is there a way to do this?
I went to **Hikashop &gt; Configuration &gt; Product Options** and changed **Characteristics selection method** to **Radio Button** and the **Product selection method** to **On a per product basis** , but when

2. When I select a **Fabric 1** option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).

Thank you in advance.

Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.

Last edit: 8 years 3 weeks ago by [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5NjEwNy1kaXNwbGF5aW5nLXByb2R1Y3Qtb3B0aW9ucy1hcy1yYWRpby1idXR0b25zLWFuZC1jcmVhdGluZy1jdXN0b20tcHJvZHVjdC1jcmVhdG9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")**
- [![jgardounis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar36377.jpg)](/forum/user/36377-jgardounis "View jgardounis's Profile") Topic Author
- [ Offline](/forum/user/36377-jgardounis)

Less More

- Posts: 8
- Thank you received: 4
-
-

8 years 3 weeks ago -  8 years 3 weeks ago [\#299863](#299863) by [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")  Replied by *[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")* on topic *[Displaying product options as redio buttons](/forum/2-general-talk-about-hikashop/896107-displaying-product-options-as-radio-buttons-and-creating-custom-product-creator#299863 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.13  Hello everyone,  I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy. I have the following characteristics:  - Size - Padded - Fabric 1  I read the tutorial (that I found very helpful) and managed to create a rudimentary system of what I want.  What I did is basically: a. Create a Custom Product and a second product I named Custom Product Characteristic as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.  b. I went to the Custom Product and in the Options field I added the three Custom Product Characteristics as options, thus allowing me to be able to made the selections on the product page.  I have the following questions:  1. I want Fabric 1 to be a radio button selection instead of dropdown selection. Is there a way to do this? I went to Hikashop &gt; Configuration &gt; Product Options and changed Characteristics selection method to Radio Button and the Product selection method to On a per product basis , but when  2. When I select a Fabric 1 option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).  Thank you in advance.  Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.")*

I did a better research on the forums here and I got to [ THIS](https://www.hikashop.com/forum/4-how-to/52482-product-options-with-pricing-in-radio-button.html) thread where the OP suggests editing the **product/option.php** in the line where it says:
Code:

$html = JHTML::_('select.genericlist', $this-&gt;values, $map, 'class="inputbox" size="1" onchange="hikashopChangeOption();"', 'value', 'text', (int)$value,$id );

to
Code:

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

essentially changing the **select.genericlist** to **select.radiolist**.

This worked, but it changed all the option selections into radio buttons (though that does not look shabby at all imho), whereas I want the type of input set for each characteristic (when we created them) to set it to the appropriate type. I can only assume I need to add the value of the Characteristics selection method (from the Characteristic edit page in administration), changing the code further into:

**$html = JHTML::\_('select.\[add-method-selection-value-here\]list',**

which will result in appropriately choosing between:
Code:

$html = JHTML::_('select.genericlist',

and Code:

$html = JHTML::_('select.radiolist',

Now I need to find this value. Any ideas?

**EDIT#1:**
An idea for implementing the above would be to add an IF statement where:
Code:

IF [method-selection-value] = radio button --&gt; $html = JHTML::_('select.radiolist',... ELSE $html = JHTML::_('select.genericlist',...

**EDIT#2:** Here is a link to my progress so far: [ menestho.com/online-shop/swimwear/create-your-swimsuit](https://menestho.com/online-shop/swimwear/create-your-swimsuit)

Also I noticed that changing options does not update the price with options value, but it does show the correct sum in the cart. [strike]Weird...Any ideas why this could be happening?[/strike]

**EDIT#3:**
I re-read the directions given in that other post and it mentioned s javascript function:
Code:

function hikashopChangeOption(){ var j = 0; total_option_price = 0; while(true){ var option = document.getElementById('hikashop_product_option_'+j); if(!option){ break; } j++; var option_price = hikashop_options[option.value]; if(option_price){ total_option_price+=option_price; } } var arr = new Array(); arr = document.getElementsByName('hikashop_price_product'); for(var i = 0; i &lt; arr.length; i++){ var obj = document.getElementsByName('hikashop_price_product').item(i); var id_price = 'hikashop_price_product_' + obj.value; var id_price_with_options = 'hikashop_price_product_with_options_' + obj.value; var price = document.getElementById(id_price); var price_with_options = document.getElementById(id_price_with_options); if(price &amp;&amp; price_with_options){ price_with_options.value = parseFloat(price.value) + total_option_price; } } hikashopRefreshOptionPrice(); if(window.Oby &amp;&amp; window.Oby.fireAjax) window.Oby.fireAjax('hkContentChanged'); } function hikashopRefreshOptionPrice(){ var price_div = document.getElementById('hikashop_product_id_main'); var inputs = price_div.getElementsByTagName('input'); if(inputs[0]){ var id_price_with_options = 'hikashop_price_product_with_options_' + inputs[0].value; var price_with_options = document.getElementById(id_price_with_options); if(price_with_options){ var target = document.getElementById('hikashop_product_price_with_options_main'); if(target) window.Oby.xRequest('".$baseUrl."price='+price_with_options.value+'".$url_itemid."', { mode: 'GET', update: target }); } } } window.hikashop.ready( function() { hikashopChangeOption(); }); ";

Apparently dropdown value can be easily picked, while in a radio it requires a loop on each radio element to see which one is selected. To be frank I am rather confused as to why the loop is required and how should I change the code.

Last edit: 8 years 3 weeks ago by [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5NjEwNy1kaXNwbGF5aW5nLXByb2R1Y3Qtb3B0aW9ucy1hcy1yYWRpby1idXR0b25zLWFuZC1jcmVhdGluZy1jdXN0b20tcHJvZHVjdC1jcmVhdG9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86576
- Thank you received: 14318
-
-

8 years 2 weeks ago [\#299860](#299860) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Displaying product options as redio buttons](/forum/2-general-talk-about-hikashop/896107-displaying-product-options-as-radio-buttons-and-creating-custom-product-creator#299860 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.13  Hello everyone,  I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy. I have the following characteristics:  - Size - Padded - Fabric 1  I read the tutorial (that I found very helpful) and managed to create a rudimentary system of what I want.  What I did is basically: a. Create a Custom Product and a second product I named Custom Product Characteristic as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.  b. I went to the Custom Product and in the Options field I added the three Custom Product Characteristics as options, thus allowing me to be able to made the selections on the product page.  I have the following questions:  1. I want Fabric 1 to be a radio button selection instead of dropdown selection. Is there a way to do this? I went to Hikashop &gt; Configuration &gt; Product Options and changed Characteristics selection method to Radio Button and the Product selection method to On a per product basis , but when  2. When I select a Fabric 1 option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).  Thank you in advance.  Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.")*

Hi,

You should delete the fabric 1 product and instead add the fabric characteristic directly to the main product.
That way you'll be able to get the color selector with the image color of the main product changing dynamically.
You can read more about doing that here:
[ www.hikashop.com/support/documentation/2...isplay-by-color.html](https://www.hikashop.com/support/documentation/272-hikashop-display-by-color.html)
You can still keep the other selectors as option products.
That way, you'll only have one variant per color and since you have only a dozen colors for the fabric it's won't be a problem with the speed of the page.
It would only start to be a problem if you moved all the selectors as characteristics.

The following user(s) said Thank You: [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5NjEwNy1kaXNwbGF5aW5nLXByb2R1Y3Qtb3B0aW9ucy1hcy1yYWRpby1idXR0b25zLWFuZC1jcmVhdGluZy1jdXN0b20tcHJvZHVjdC1jcmVhdG9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")**
- [![jgardounis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar36377.jpg)](/forum/user/36377-jgardounis "View jgardounis's Profile") Topic Author
- [ Offline](/forum/user/36377-jgardounis)

Less More

- Posts: 8
- Thank you received: 4
-
-

8 years 2 weeks ago [\#299910](#299910) by [jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")  Replied by *[jgardounis](/forum/user/36377-jgardounis "View jgardounis's Profile")* on topic *[Displaying product options as redio buttons](/forum/2-general-talk-about-hikashop/896107-displaying-product-options-as-radio-buttons-and-creating-custom-product-creator#299910 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.13  Hello everyone,  I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy. I have the following characteristics:  - Size - Padded - Fabric 1  I read the tutorial (that I found very helpful) and managed to create a rudimentary system of what I want.  What I did is basically: a. Create a Custom Product and a second product I named Custom Product Characteristic as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.  b. I went to the Custom Product and in the Options field I added the three Custom Product Characteristics as options, thus allowing me to be able to made the selections on the product page.  I have the following questions:  1. I want Fabric 1 to be a radio button selection instead of dropdown selection. Is there a way to do this? I went to Hikashop &gt; Configuration &gt; Product Options and changed Characteristics selection method to Radio Button and the Product selection method to On a per product basis , but when  2. When I select a Fabric 1 option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).  Thank you in advance.  Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.")*

You know, I was wondering how I would manage to have the images change based on color selection and thought I would have to do a lot of php editing on the product/show_block_img.php . Fortunately your suggestion minimizes that.

That does make sense. Indeed there are currently only 12 colors. The idea is, though (and I apologize for not putting it on the table earlier, I just wanted to start simple), that the product is comprised by 2 pieces (top, bottom) which can have different colors not only externally, but internally as well, which translates to:

- top exterior: 12 colors
- top interior: 12 colors
- bottom exterior: 12 colors
- bottom interior: 12 colors

For the external colors I want it to change the product images, so your suggestion will be fitting. For the internal colors, though, and in the best interest of not running wild with variations (124=20.736) I will keep them as options, lowering that number to 122=144 which is quite manageable ![:)](/media/kunena/emoticons/3.png ":)") .

What the final implementation of the custom product creator will be is to have the user choose:

- **Design for the top** (6 designs): main product **characteristic**
- **Exterior color for the top** (12 colors): main product **characteristic**
- **Interior color for the top** (12 colors): main product **option**
- **Size for the top** (5 sizes): main product **option**
- **Padding for the top** (2 options): main product **option**
- **Design for the bottom** (6 designs): main product **characteristic**
- **Exterior color for the bottom** (12 colors): main product **characteristic**
- **Interior color for the bottom** (12 colors): main product **option**
- **Size for the bottom** (5 sizes): main product **option**
- **Padding for the bottom** (2 options): main product **option**

That eventually takes the amount of main product variants to 123=1.728, which (although a bit steep) is possibly viable, dunno I will have to do some tests on this.

By choosing the Design for the top and for the bottom, it would change to the appropriate design on the product image. Then choosing the user will be able to select the exterior colors, again updating the product image and have the interior colors remain as options.

My main concern with the use of characteristics in the main product is if the colors and designs increase with time (which is something to be expected with e-shops tbh). Is there no way to have the option-product variant images show up in the main-product page?

PS: Also Nicolas any idea about my EDIT#3 in my previous comment on this thread?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5NjEwNy1kaXNwbGF5aW5nLXByb2R1Y3Qtb3B0aW9ucy1hcy1yYWRpby1idXR0b25zLWFuZC1jcmVhdGluZy1jdXN0b20tcHJvZHVjdC1jcmVhdG9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86576
- Thank you received: 14318
-
-

8 years 2 weeks ago [\#299912](#299912) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Displaying product options as redio buttons](/forum/2-general-talk-about-hikashop/896107-displaying-product-options-as-radio-buttons-and-creating-custom-product-creator#299912 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.13  Hello everyone,  I want to create a Custom Product page, where the user selects various characteristics to create his own personalized product to buy. I have the following characteristics:  - Size - Padded - Fabric 1  I read the tutorial (that I found very helpful) and managed to create a rudimentary system of what I want.  What I did is basically: a. Create a Custom Product and a second product I named Custom Product Characteristic as a product with only the specific characteristic (for example one product for each of Size, Padded, Fabric 1) and its variants.  b. I went to the Custom Product and in the Options field I added the three Custom Product Characteristics as options, thus allowing me to be able to made the selections on the product page.  I have the following questions:  1. I want Fabric 1 to be a radio button selection instead of dropdown selection. Is there a way to do this? I went to Hikashop &gt; Configuration &gt; Product Options and changed Characteristics selection method to Radio Button and the Product selection method to On a per product basis , but when  2. When I select a Fabric 1 option, I want it to update the product image with the appropriate fabric. I understand that it might be the case where I have ti create and overlay where the fabric will show up, but I was wondering if there is a better idea, or perhaps someone can give me a guidance as to which view I need to change (and possibly a point or two on how).  Thank you in advance.  Note: I didnt choose to create a single product with variants because the amount of options in Fabric 1 are too many and bog down the page when someone tries to access it.")*

Hi,

1700 variants is too much I would say.
For now, the characteristic selection mechanism isn't ajax (we want to do that in the near future, but it's a big rework as we'll basically need to redo a big piece of the product page to support that.
With an ajax characteristic selection, thousands of variants wouldn't be a problem for the frontend. However, you would still have a problem managing the variants.

In that case, I would rather recommend to create custom fields of the table "item" for the color selection and then write some custom javascript to change the image when the custom field selection is changed.
[ stackoverflow.com/questions/8838648/onch...o-doesnt-work-as-one](https://stackoverflow.com/questions/8838648/onchange-event-handler-for-radio-button-input-type-radio-doesnt-work-as-one)
That way, you won't have any problem to expend the color selectors
You could potentially do it with options instead of custom item fields and directly add your code to the javascript code of the option view file. It's basically the same but options are a bit more resource hungry than custom item fields.

Regarding point 3, the javascript code there dynamically calculate the total amount of the product base price + the price of each option selected, hence the loop.
We could indeed store the current total and add/substract the difference of price when the option is being changed, but it's a bit more complex and prone to errors. Also, it's still necessary to initialize the total amount when the page is first loaded so since we need to have the code anyways, it's either to always use it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5NjEwNy1kaXNwbGF5aW5nLXByb2R1Y3Qtb3B0aW9ucy1hcy1yYWRpby1idXR0b25zLWFuZC1jcmVhdGluZy1jdXN0b20tcHJvZHVjdC1jcmVhdG9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.061 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
