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

#   Multiple quantities not working

##

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

Less More

- Posts: 5
- Thank you received: 1
-
-

6 years 5 months ago [\#319750](#319750) by [pbleiman](/forum/user/37789-pbleiman "View pbleiman's Profile")  *[Multiple quantities not working](/forum/26-product-category-display/899987-multiple-quantities-not-working#319750 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2.1 -- Browser(s) name and version -- : multiple -- Error-message(debug-mod must be tuned on) -- : none  On our Wine shop, we want to have different options for the quantity input.  For most products, we want the quantity to default to 6 bottles, but customers can buy in smaller increments. Some products are sold per piece. Others are sold per x pieces.  For the products sold per x, we use the min&#95;quantity field combined with the show&#95;select view For the first case, we wrote a small customisation below in show&#95;quantity.php using a custom field dflt&#95;qty  This worked fine until recently, but since the latest updates: - the system no longer seems to read our dflt&#95;qty field (it defaults all products to 6 pieces even if dflt&#95;qty &gt; 0). - when setting min&#95;quantity the initial quantity is set, but the increment remains 1. For instance: if min&#95;quantity is set to 4 and I hit the &quot;+&quot; button, the quantity will jump to 5 instead of 8.  When adding the field &quot;dflt&#95;qty&quot; to the front end the value in the database displays correctly so nothing wrong there.  Any idea what is wrong?  Customisation in show&#95;quantity.php: $min&#95;quantity =$this-&gt;params-&gt;get('min&#95;quantity'); $max&#95;quantity =$this-&gt;params-&gt;get('max&#95;quantity'); $html =$this-&gt;params-&gt;get('html'); $salesqty =''; if ($min&#95;quantity &gt; 1){ $salesqty = $min&#95;quantity; }else{ if ($this-&gt;element-&gt;dflt&#95;qty &gt; 0){ $salesqty = $this-&gt;element-&gt;dflt&#95;qty; }else{ $salesqty = 6;} }")* was created by *[pbleiman](/forum/user/37789-pbleiman "View pbleiman's Profile")*

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.14
-- PHP version -- : 7.2.1
-- Browser(s) name and version -- : multiple
-- Error-message(debug-mod must be tuned on) -- : none

On our Wine shop, we want to have different options for the quantity input.

For most products, we want the quantity to default to 6 bottles, but customers can buy in smaller increments.
Some products are sold per piece. Others are sold per x pieces.

For the products sold per x, we use the min_quantity field combined with the show_select view
For the first case, we wrote a small customisation below in show_quantity.php using a custom field dflt_qty

This worked fine until recently, but since the latest updates:
- the system no longer seems to read our dflt_qty field (it defaults all products to 6 pieces even if dflt_qty &gt; 0).
- when setting min_quantity the initial quantity is set, but the increment remains 1. For instance: if min_quantity is set to 4 and I hit the "+" button, the quantity will jump to 5 instead of 8.

When adding the field "dflt_qty" to the front end the value in the database displays correctly so nothing wrong there.

Any idea what is wrong?

Customisation in show\_quantity.php:
$min_quantity =$this-&gt;params-&gt;get('min_quantity');
$max_quantity =$this-&gt;params-&gt;get('max_quantity');
$html =$this-&gt;params-&gt;get('html');
$salesqty ='';
if ($min_quantity &gt; 1){
$salesqty = $min_quantity;
}else{
if ($this-&gt;element-&gt;dflt_qty &gt; 0){
$salesqty = $this-&gt;element-&gt;dflt_qty;
}else{
$salesqty = 6;}
}

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTk5ODctbXVsdGlwbGUtcXVhbnRpdGllcy1ub3Qtd29ya2luZz90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

6 years 5 months ago [\#319788](#319788) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Multiple quantities not working](/forum/26-product-category-display/899987-multiple-quantities-not-working#319788 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2.1 -- Browser(s) name and version -- : multiple -- Error-message(debug-mod must be tuned on) -- : none  On our Wine shop, we want to have different options for the quantity input.  For most products, we want the quantity to default to 6 bottles, but customers can buy in smaller increments. Some products are sold per piece. Others are sold per x pieces.  For the products sold per x, we use the min&#95;quantity field combined with the show&#95;select view For the first case, we wrote a small customisation below in show&#95;quantity.php using a custom field dflt&#95;qty  This worked fine until recently, but since the latest updates: - the system no longer seems to read our dflt&#95;qty field (it defaults all products to 6 pieces even if dflt&#95;qty &gt; 0). - when setting min&#95;quantity the initial quantity is set, but the increment remains 1. For instance: if min&#95;quantity is set to 4 and I hit the &quot;+&quot; button, the quantity will jump to 5 instead of 8.  When adding the field &quot;dflt&#95;qty&quot; to the front end the value in the database displays correctly so nothing wrong there.  Any idea what is wrong?  Customisation in show&#95;quantity.php: $min&#95;quantity =$this-&gt;params-&gt;get('min&#95;quantity'); $max&#95;quantity =$this-&gt;params-&gt;get('max&#95;quantity'); $html =$this-&gt;params-&gt;get('html'); $salesqty =''; if ($min&#95;quantity &gt; 1){ $salesqty = $min&#95;quantity; }else{ if ($this-&gt;element-&gt;dflt&#95;qty &gt; 0){ $salesqty = $this-&gt;element-&gt;dflt&#95;qty; }else{ $salesqty = 6;} }")*

Hi,

This indicates that your custom code has a problem.
Either the system is using another view file or your code is missing some bits.
I would recommend to check the HTML of the quantity input field:
[ monosnap.com/file/PkHAF4NTuZR7bJghwLzvimB05IegQ7](https://monosnap.com/file/PkHAF4NTuZR7bJghwLzvimB05IegQ7)
There, you'll see extra "data" attributes where we have the minimum, the maximum and the increment (mod). The javascript then relies on these for the behavior of the quantity input field.
What you describe indicates that these data attributes don't have the values they should have if your customization was working.
So then check your code so that these data attributes are properly set.
And use the "Display view files" setting to make sure you're editing the correct view file.

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

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

Less More

- Posts: 5
- Thank you received: 1
-
-

6 years 5 months ago [\#319817](#319817) by [pbleiman](/forum/user/37789-pbleiman "View pbleiman's Profile")  Replied by *[pbleiman](/forum/user/37789-pbleiman "View pbleiman's Profile")* on topic *[Multiple quantities not working](/forum/26-product-category-display/899987-multiple-quantities-not-working#319817 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2.1 -- Browser(s) name and version -- : multiple -- Error-message(debug-mod must be tuned on) -- : none  On our Wine shop, we want to have different options for the quantity input.  For most products, we want the quantity to default to 6 bottles, but customers can buy in smaller increments. Some products are sold per piece. Others are sold per x pieces.  For the products sold per x, we use the min&#95;quantity field combined with the show&#95;select view For the first case, we wrote a small customisation below in show&#95;quantity.php using a custom field dflt&#95;qty  This worked fine until recently, but since the latest updates: - the system no longer seems to read our dflt&#95;qty field (it defaults all products to 6 pieces even if dflt&#95;qty &gt; 0). - when setting min&#95;quantity the initial quantity is set, but the increment remains 1. For instance: if min&#95;quantity is set to 4 and I hit the &quot;+&quot; button, the quantity will jump to 5 instead of 8.  When adding the field &quot;dflt&#95;qty&quot; to the front end the value in the database displays correctly so nothing wrong there.  Any idea what is wrong?  Customisation in show&#95;quantity.php: $min&#95;quantity =$this-&gt;params-&gt;get('min&#95;quantity'); $max&#95;quantity =$this-&gt;params-&gt;get('max&#95;quantity'); $html =$this-&gt;params-&gt;get('html'); $salesqty =''; if ($min&#95;quantity &gt; 1){ $salesqty = $min&#95;quantity; }else{ if ($this-&gt;element-&gt;dflt&#95;qty &gt; 0){ $salesqty = $this-&gt;element-&gt;dflt&#95;qty; }else{ $salesqty = 6;} }")*

Hi Nicolas

I'd checked all that before logging the ticket, obviously. As such, the code works fine but for some reason a number of values no longer seems to be passing and I can't find out why. I checked this by echoing the given field values, which return blanks.

$this-&gt;element-&gt;dflt_qty ==&gt; no longer retrieves the custom field value stored in "dflt_qty" (returns a blank if you try to echo it)

In the original code (version 4.3.0, view show\_quantity), your code to choose the quantity layout per product is:
*if(!isset($this-&gt;quantityLayout)) {
$quantityLayout = $this-&gt;config-&gt;get('product\_quantity\_display', 'show\_default\_div');
if(!isset($this-&gt;row))
$quantityLayout = **$this-&gt;getProductQuantityLayout($this-&gt;row)**;
} else
$quantityLayout = $this-&gt;quantityLayout;*

If I set the quantity layout at product level, however, this value (bold) does not pass either. The system always seems to pick up the quantity layout from the configuration file, not from the product settings.

Any idea why these values are not passing?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTk5ODctbXVsdGlwbGUtcXVhbnRpdGllcy1ub3Qtd29ya2luZz90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

6 years 5 months ago [\#319841](#319841) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Multiple quantities not working](/forum/26-product-category-display/899987-multiple-quantities-not-working#319841 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2.1 -- Browser(s) name and version -- : multiple -- Error-message(debug-mod must be tuned on) -- : none  On our Wine shop, we want to have different options for the quantity input.  For most products, we want the quantity to default to 6 bottles, but customers can buy in smaller increments. Some products are sold per piece. Others are sold per x pieces.  For the products sold per x, we use the min&#95;quantity field combined with the show&#95;select view For the first case, we wrote a small customisation below in show&#95;quantity.php using a custom field dflt&#95;qty  This worked fine until recently, but since the latest updates: - the system no longer seems to read our dflt&#95;qty field (it defaults all products to 6 pieces even if dflt&#95;qty &gt; 0). - when setting min&#95;quantity the initial quantity is set, but the increment remains 1. For instance: if min&#95;quantity is set to 4 and I hit the &quot;+&quot; button, the quantity will jump to 5 instead of 8.  When adding the field &quot;dflt&#95;qty&quot; to the front end the value in the database displays correctly so nothing wrong there.  Any idea what is wrong?  Customisation in show&#95;quantity.php: $min&#95;quantity =$this-&gt;params-&gt;get('min&#95;quantity'); $max&#95;quantity =$this-&gt;params-&gt;get('max&#95;quantity'); $html =$this-&gt;params-&gt;get('html'); $salesqty =''; if ($min&#95;quantity &gt; 1){ $salesqty = $min&#95;quantity; }else{ if ($this-&gt;element-&gt;dflt&#95;qty &gt; 0){ $salesqty = $this-&gt;element-&gt;dflt&#95;qty; }else{ $salesqty = 6;} }")*

Hi,

I'm not able to reproduce any problem with the selection of the product page layout on my end.
But let's not drift and focus on your issue.
Does your product has variants ? If yes, then $this-&gt;element-&gt;dflt_qty is the value of the custom field in the default variant.
And the value you want (from the main product) is in $this-&gt;element-&gt;main-&gt;dflt_qty
Maybe that's why it doesn't work like you want ?
Besides that, I don't see the reason why the custom field value wouldn't in there.

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

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