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

#   Using Select for Quantity Input problem

##

- **[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")**
- [![ctcpfi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17831-ctcpfi "View ctcpfi's Profile") Topic Author
- [ Offline](/forum/user/17831-ctcpfi)

Less More

- Posts: 7
- Thank you received: 0
-
-

9 years 5 months ago [\#270688](#270688) by [ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")  *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270688 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")* was created by *[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")*

-- HikaShop version -- : 3.1.0
-- Joomla version -- : 3.7.2
-- PHP version -- : 5.6.30
-- Browser(s) name and version -- : Multiple
-- Error-message(debug-mod must be tuned on) -- : no error message

Hi,

I use select for the quantity input and I've noticed an issue with the new update.

Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)

With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.

I've recreated this situation on a hikashop demo store page to confirm.
[ ![hika&#95;example.png](/forum/attachment/38387) ](/forum/attachment/38387 "hika&#95;example.png")

- [ ![hika&#95;example.png](/forum/attachment/38387) ](/forum/attachment/38387 "hika&#95;example.png") [ ](/forum/attachment/38387?download=1 "hika&#95;example.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5MDQ2OC11c2luZy1zZWxlY3QtZm9yLXF1YW50aXR5LWlucHV0LXByb2JsZW0/dG1wbD1tYXJrZG93bg==) 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: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

9 years 5 months ago [\#270692](#270692) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270692 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")*

Hello,

In the view "product / show_quantity" please replace Code:

$html = $this-&gt;params-&gt;get('html');

By Code:

if(isset($this-&gt;row) &amp;&amp; isset($this-&gt;row-&gt;product_quantity) &amp;&amp; (int)$this-&gt;row-&gt;product_quantity &gt; 0 &amp;&amp; (int)$this-&gt;row-&gt;product_quantity &lt; $max_quantity) $max_quantity = (int)$this-&gt;row-&gt;product_quantity; $html = $this-&gt;params-&gt;get('html');

It would use the product stock to limit the internal variable used by the quantity selector.

Please let us know your feedback about that patch so we can integrate it into HikaShop and use the same kind of patch for others quantity selector views.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5MDQ2OC11c2luZy1zZWxlY3QtZm9yLXF1YW50aXR5LWlucHV0LXByb2JsZW0/dG1wbD1tYXJrZG93bg==) 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: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

9 years 5 months ago [\#270779](#270779) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270779 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")*

Feedback.

That patch won't be integrated into HikaShop because it is incompatible with the wishlist system.
Even if there is a stock of "2" ; the customer have the right to add more than 2 items in his wishlist.

Regards,

---

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

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

- **[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")**
- [![ctcpfi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17831-ctcpfi "View ctcpfi's Profile") Topic Author
- [ Offline](/forum/user/17831-ctcpfi)

Less More

- Posts: 7
- Thank you received: 0
-
-

9 years 5 months ago -  9 years 5 months ago [\#270794](#270794) by [ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")  Replied by *[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")* on topic *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270794 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")*

Hi Jerome,

I've tried the modification but nothing seems to change. I set up a test environment with a fresh Joomla install and only installed Hikashop to make sure nothing else was affecting it. Cache disabled. Am I missing something?

Also, I've noticed on the cart page the quantities behave like I want them to.

Below are images of my fresh test store with your modification. The product is an item with a QTY of 10.

Item example:
[ ![item&#95;ex.png](/forum/attachment/38401) ](/forum/attachment/38401 "item&#95;ex.png")

Cart example (note* it functions like this without the modification also):
[ ![cart&#95;ex.png](/forum/attachment/38400) ](/forum/attachment/38400 "cart&#95;ex.png")

- [ ![cart&#95;ex.png](/forum/attachment/38400) ](/forum/attachment/38400 "cart&#95;ex.png") [ ](/forum/attachment/38400?download=1 "cart&#95;ex.png")
- [ ![item&#95;ex.png](/forum/attachment/38401) ](/forum/attachment/38401 "item&#95;ex.png") [ ](/forum/attachment/38401?download=1 "item&#95;ex.png")

Last edit: 9 years 5 months ago by [ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile").

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

- **[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")**
- [![ctcpfi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17831-ctcpfi "View ctcpfi's Profile") Topic Author
- [ Offline](/forum/user/17831-ctcpfi)

Less More

- Posts: 7
- Thank you received: 0
-
-

9 years 5 months ago [\#270827](#270827) by [ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")  Replied by *[ctcpfi](/forum/user/17831-ctcpfi "View ctcpfi's Profile")* on topic *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270827 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")*

After a little testing, i found that modifying the code snip like below works.

Code:

if(isset($this-&gt;row) &amp;&amp; isset($this-&gt;row-&gt;product_quantity) &amp;&amp; (int)$this-&gt;row-&gt;product_quantity &gt; 0) $max_quantity = (int)$this-&gt;row-&gt;product_quantity; $html = $this-&gt;params-&gt;get('html');

I'm not sure what problems removing the last part of the if statement will cause.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5MDQ2OC11c2luZy1zZWxlY3QtZm9yLXF1YW50aXR5LWlucHV0LXByb2JsZW0/dG1wbD1tYXJrZG93bg==) 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: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

9 years 5 months ago [\#270828](#270828) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Using Select for Quantity Input problem](/forum/25-install-update/890468-using-select-for-quantity-input-problem#270828 "-- HikaShop version -- : 3.1.0 -- Joomla version -- : 3.7.2 -- PHP version -- : 5.6.30 -- Browser(s) name and version -- : Multiple -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I use select for the quantity input and I've noticed an issue with the new update.  Previously when you clicked the qty select box the dropdown would allow the user to select as much as we have. (ex. We have 50 in stock, they can select 50 in the dropdown. Likewise, if there's only 2 then 2 is the most you can select.)  With the Hikashop 3 update, by default the user can select 15 no matter what. If there's only 2 in stock, they can select 15. If there's 100 in stock, 15 is still all it shows.  I've recreated this situation on a hikashop demo store page to confirm.")*

Hello,

Like I wrote in my previous message, the reason why there is no restriction on the product page is that you can add the product into the wishlist.
So the current behavior in HikaShop is the right one ; it was the point that I forgot in my first reply.

Afterwards, if you want to patch HikaShop in the view, you can. But you should continue to handle the max quantity Code:

if(isset($this-&gt;row) &amp;&amp; isset($this-&gt;row-&gt;product_quantity) &amp;&amp; (int)$this-&gt;row-&gt;product_quantity &gt; 0 &amp;&amp; ((int)$this-&gt;row-&gt;product_quantity &lt; $max_quantity &#124;&#124; $max_quantity &lt;= 0)) $max_quantity = (int)$this-&gt;row-&gt;product_quantity;

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg5MDQ2OC11c2luZy1zZWxlY3QtZm9yLXF1YW50aXR5LWlucHV0LXByb2JsZW0/dG1wbD1tYXJrZG93bg==) 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.094 seconds

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

[](#top)
