Limit order quantity to multiple of minimum order

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
6 years 6 months ago #292465

Hi Jerome, we were studying how to implement you comment. However it is not clear for what you meant by

Jerome wrote: Afterwards, you can use product custom fields or category custom fields to store such kind of value.


Could you elaborate?

Thanks, James

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 6 months ago #292467

Hi,

It's simple. Create a custom field of the table "product" and for each product, enter the value you want for the "mod" in that field.
Then, in the view file, instead of replacing the 1 by 6 as I explained in my previous message, you can use instead $this->row->XXX where XXX is the column name of the custom field.
And that way, you'll have different increments for different products.

The following user(s) said Thank You: jameswadsworth

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
6 years 6 months ago #292498

That is perfectly clear now. Thanks.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
6 years 3 months ago #296491

I'm replying to explain what we did in case it is useful to others. In our case fortunately the minimum order quantity is always the multiple by which we want to increase the quantity. Is if the minimum quantity is 1, then 1,2,3,4,5,6,7 etc. If 6 then 6,12,18,24,30,36 etc.

We copied the file view /product/show_quantity.php to frontend template override. We grabbed the variable $min_quantity and we replace every occurrence of data-dac-qty-mod="1" with data-dac-qty-mod="<?php echo $min_quantity; ?>" and data-dac-qty-mod="-1" with data-dac-qty-mod="-<?php echo $min_quantity; ?>"

Now when we use the plus and minus button the quantities increase by the required quantities.

The following user(s) said Thank You: nicolas

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business
5 years 7 months ago #305888

Hi, we have this problem too and so far opted for the "Show select" option in the configuration/product options.
Reason is that, although the buttons work perfectly in this mod, the customer can input any number, which is no multiple of the minimum quantity, manually without the using the buttons.
Or change the number in the cart afterwards.
In a competing Joomla webshop, they have this setup too but check all input with javascript onchange and round it to multiples.
Maybe an idea?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 7 months ago #305898

Hi,

There is no "step" system. The "show select" system allows for it by not allowing something else to be selected. But actually, should you temper with the HTML of the dropdown, you could add other values than the increments. And its the same with the javascript check.
A proper solution would be to add an extra option in the products to enter the increment and check the quantity both during the add to cart, the loading of the cart, and also add javascript for inputs to check on that.
Now the show select solution and other tricks discussed here seem to be good enough for most situations, so I'm not usre it would warant all that complex development. And adding a small custom check in javascript on the quantity input field would be easy for any developer should you need it.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum