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

#   Default value for variants

##

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

9 years 1 month ago [\#280140](#280140) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280140 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

Its not about name of the attribute. You can name it as you need. Data-stock, data-quantity....

Its about having some quantity attribute for every variant. This would allow if condition....and its just 1 line of code in ../types/characteristic.php file.

We have modifies for our own needs but as this is core file we dont want to change it after every update...

Would this add some negative to hikashop? For sure NO.
Would this improve hikashop variant selection and allow people to have more modications? Fore sure YES. ( If you are not willing to redo variants in near future ).

So can hikashop add this?

I have seen many sites who use quantity attribute and could add links here if need it.

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTIwNDEtZGVmYXVsdC12YWx1ZS1mb3ItdmFyaWFudHM/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) 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: 86586
- Thank you received: 14325
-
-

9 years 1 month ago [\#280158](#280158) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280158 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

With data-stock it's a good idea yes. It's just that "stock" is not a valid HTML attribute so we can't add "stock".
So what line do you suggest we add in there exactly ?

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

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

9 years 1 month ago [\#280204](#280204) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280204 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

Its your choice Nicolas how you want to call it. You have better knowledge in everyway. If you think "data-stock" is fine then please add it.

Will this be added to next hikashop release or just as new build which we could download asap?

As for us this little improvement will allow to add some js and resolve our issue with waitlist notifications...
Thanks for looking into this.

Have a great day

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

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

9 years 1 month ago [\#280205](#280205) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280205 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

For characteristics selection method &gt; table just need to add on line 155 inside input:
Code:

data-stock=\"".$variant-&gt;product_quantity."\"

However for radio button this doesnt work on line 278

It looks like this is in another public function display and you need to call it again in foreach loop i guess. I am not sure how this should be correctly handled so i will wait for replay.

Kind Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTIwNDEtZGVmYXVsdC12YWx1ZS1mb3ItdmFyaWFudHM/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) 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: 86586
- Thank you received: 14325
-
-

9 years 1 month ago [\#280253](#280253) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280253 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

We'll add that to the next version.

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

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

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

9 years 1 month ago [\#280256](#280256) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280256 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

Great to hear it. Thank for looking into this.

Have a great day

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

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

9 years 1 month ago [\#280863](#280863) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280863 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hi,

With hikashop 3.2.1 I see you have added data-stock attribute but it is missing for radio buttons?

Kind Regards

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 1 month ago [\#280864](#280864) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Default value for variants](/forum/26-product-category-display/892041-default-value-for-variants?start=20#280864 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1 -- Browser(s) name and version -- : all  I now have my &quot;product variants&quot; set up using custom fields as in he attachment, but since I will probably outsource my fulfillment I need a more structural way of setting this up, using 'real' variants. See the attachment for my current display.  Doing so seems to work fine, except for one thing. I want to force people to make a decision about a size or color. Now with custom fields I manage doing so with a parameter with an empty value.  How can I achieve this with characteristics and variants?  I have tried to set a default variant with an empty stock, but this makes the order button disappear with an out of stock display (initially).")*

Hello,

HikaShop is using the Joomla core to display the dropdown or the radio list.
The API do not allow us to add extra data for the radio items ; there is a variable $attribs but it's global for all elements and the "option.attr" that you can find for "option()" is not processed in radiolist.
CF : [ github.com/joomla/joomla-cms/blob/stagin...html/select.php#L765](https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/html/select.php#L765)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTIwNDEtZGVmYXVsdC12YWx1ZS1mb3ItdmFyaWFudHM/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) 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.092 seconds

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