Input Quantity with multiple values

  • Posts: 57
  • Thank you received: 4
10 years 3 months ago #188246

Hi,

I need your help.
I have saw that if we define the minimum quantity and the max quantity (in product view) if we try to input quantity less that minimum or more that max the input will report a message and auto update the value.

Well, I need that this function works to in the products (category view) and in the cart (mini-cart and checkout cart).

Why this works only in product value and not in all input quantity?

Other question:

What I need to do that the system only let me to put multiple values in these input quantity?
Example:

If I put:

Minimum quantity = 5
Max quantity = 50

I want that the system only let me put:
5,10,15,20,25,30,35,40,45,50

and if max quantity = 48:
Only let me to put:
5,10,15,20,25,30,35,40,45


I hope that you can help me.
Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #188300

Hi,

For the issue, we will do more tests on our end, but the check should already be present on all quantity fields.

Regarding your request, it is already possible, when setting a min and a max value, then select the quantity layout to "show_select" and that will only display a dropdown with the desired values.
The min quantity will be the first value and the increment and the max one the max value of the dropdown.

The following user(s) said Thank You: rfernandes

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 4
10 years 3 months ago #188341

Thanks for your help but for our case this resolution don't work.
We don't want to let the client see how many products we have in stock.
We only want that if the client try to order more that the stock the quantity value will get the stock value (it's working now) and if we decide that the package it's for example 20 units and we have 150 units we don't let to order for example 30 units.

We want that if the client try to insert 30 the system alert him that he can't order 30 units and show how many he can order, in this case he can order only multiples that 20.
For example if I try to order 30 only can order 20 or 40.
If I try 70 only can order 60 or 80.

And the auto-increment will put not (value+1) but (value+minimum)

Like here in this picture



If start with 20 and press "+" I want that the system increment something like:

20, 40, 60, 80, ...

And if the max is for example 150

20, 40, 60, 80, 100, 120, 140

Thanks for your help

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #188489

Hi,

I think that it will require some coding, by default in HikaShop we can set limits.
So restrict a maximum quantity in cart, but not handle multiples of 20 or any other value.
This feature can be done via plugin, here is our documentation:
www.hikashop.com/support/support/documen...r-documentation.html

For the input field, you can potentially edit the view "product / show_quantity" and add your specific things.
Get the product min order quantity for example and increase the quantity by this value only.

It require php knowledges.

The following user(s) said Thank You: rfernandes

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 4
10 years 3 months ago #188516

Hi,

Thanks for your anwser.

But you can't give me a help with one example for I see better what I need to do?
Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #188524

Hi,

What can be done is use the function "onBeforeCartUpdate()" in the plugin.
www.hikashop.com/support/support/documen...l#onBeforeCartUpdate

In this function, get the min_quantity value for the product to add, and do some php checks on the $quantity variable and $product->product_min_per_order, if the $quantity value is not a multiple of the $product->product_min_per_order one so set $do to false and display a joomla system message thanks to:

$app = JFactory::getApplication();
$app->enqueueMessage('Not a correct quantity, please choose XX or YY.');
And of course, if the quantity is correct, just let $do as true.

For the input field, you will have to edit the view "product / show_quantity" and replace:
return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);

By another function which will increment the value by the product_min_per_order, and check if the entered quantity is not too big regarding the product_max_per_order, so javascript knowledges requried.

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum