- Posts: 6
- Thank you received: 1
Limit order quantity to multiple of minimum order
-- Joomla version -- : 3.2.1
-- PHP Version 5.3.27
I have a food product priced at $20 per 100g, and the minimum order quantity is 300g. Also I need to limit the order quantity to multiples of the minimum order. i.e. customer's orders can only be 300g, 600g, 900g and up.
Setting "Price" = 20; "Minimum quantity per order" = 3 can only limit the order quantity starting at 300g. I would like to modify the "+" and "-" buttons so that each press of the buttons will increase/decrease the order quantity by the value of the "minimum quantity per order", here is 3 in this example.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
If you want all your product to be sold per quantity of 3, the solution will probably be to edit the file "administrator/components/com_hikashop/helpers/cart.php" and change these lines :
Please Log in or Create an account to join the conversation.
Some products priced by boxes. Some products priced by bottles. They are fine with the default setting of increment=1. However, for products priced by weight, they are all sold by unit of 100g for comparison sake. Amongst them, some food products are weighted over 100g per piece and must be sold as a multiple of its average weight.
Will there be way to change the increment for a few products only, not the whole site.
Please Log in or Create an account to join the conversation.
It's getting very picky, Hikashop doesn't propose this feature so far.
If you have knowledge in php and html, you can adapt the code mohamed give you to be applied only on specific product.
Or you can ask on our commercial job forum if someone is willing to do it.
Please Log in or Create an account to join the conversation.
How can I adapt Mohamed's code to apply on a specific product. In what way can a specific product be referred to? Should all the work be done in the file administrator/components/com_hikashop/helpers/cart.php?
Please Log in or Create an account to join the conversation.
You will have to change the behaviour of the funciton according to the product id so it doesn't affect every product.
You can hardcode the list of product or even had something in the Hikashop backend to select your product.
Anyway it definitely require some good php skills.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
we had modified your suggested to make the increase and decrease button always add a multiple of the min order quantity.
We have just run an update to v3.0.1 on our test server and this hack is no longer working. We are using the non-legacy add to cart. Is there a new function?
Thanks, James
Please Log in or Create an account to join the conversation.
This function is only used if you have the "add to cart legacy" setting activated (and thus using the old system).
With the new add to cart system another function is used.
Note however that since these messages, we now have the capability in HikaShop to restrict quantities to specific values without modifying any code.
For example, if you set the "quantity input" setting of the product to "show select", it will transform the quantity field into a dropdown with values automatically generated based on the minimum quantity per order configured in the product. So if you set 3 there, you'll have automatically 3, 6, 9, 12, etc and the user won't be able to select the quantities in between.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The characteristics system isn't compatible with the show select system.
I've added some patches to properly support that.
If you download again the install package on our website and install it on yours, it should now work better.
Please Log in or Create an account to join the conversation.
we have updated to version 3.1.1. It still doesn't work with characteristics. We have some template overrides of the product view. Probably we need to update these too. Which files are to update?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
1) drop down lists to achieve multiples of the minimum quantity is not a use friendly as being able to click the plus or minus button
2) being limited to a maximum 15 with the drop down lists is annoying because if the product can be bought singly you often might want more than 15 such as 100. One to a hundred in a drop down list is not very nice. Even with multiples of the minimum order 15 might not be enough. For example you have minimum order 24 pieces and you want 1152 pieces that is 48 items in the drop down list. Again not user friendly.
Just my thoughts.
Thanks, James
Please Log in or Create an account to join the conversation.
I indeed agree with you that an input is better than a dropdown if your products can be purchased with a lot of quantity.
In fact, the default display of the quantity fields are input fields, not dropdowns for that reason.
Being able to switch between dropdown and input with the "quantity input method" setting is great so that you can really display the quantity field the way you need it.
Please Log in or Create an account to join the conversation.
while I agree entirely with you answer I was speaking specifically about cases where shop owners want to see multiples of the min quantity per order, i.e. 6, 12, 18, 24, 30 etc
With the legacy cart system (prior to hikashop 3+) it was possible to use the input field along with the modification proposed by Mohamed Thelji near the start of this thread. However with the new cart system in hikahops 3+ the only way to be able to sell multiple values of the minimum quantity is to use the dropdown input method with the inconveniences as outlined in my previous post.
So is there a way with the new cart system to sell multiples of the minimum order quantity the input field box?
James
Please Log in or Create an account to join the conversation.
Ah no, it's the same as before but the modification is now even easier. The change that Mohamed gave had to be done in the core file of HikaShop, and thus, you had to do it after each update.
Now, you can activate the "Display view files" setting of the HikaShop configuration to see which view file is displaying the - and + buttons of the quantity input (it's probably "show_quantity").
Then, in it, you can change the code:
data-hk-qty-mod="-1"
to:
data-hk-qty-mod="-6"
and the code:
data-hk-qty-mod="1"
to:
data-hk-qty-mod="6"
and it will increment by steps of 6 with the input field. And since it will be done with a view override, you won't loose your changes when you update.
Please Log in or Create an account to join the conversation.
As you can imagine not all products will have same master boxes. It could be any number. You example examples works fine if they all have master box of 6.
How do you handle the situation in which for example, even the same category, a products has master box 6 and another product has master box 12?
Please Log in or Create an account to join the conversation.
The product increment already have an algorithm in the view to determine its value. It's generally based on the "min quantity per order" and "max quantity per order" of the product.
Afterwards, you can use product custom fields or category custom fields to store such kind of value.
But afterwards, regarding the view override, it would require some PHP code in order to extract the data from the field (which can be more tricky when it's related to category since a product can have a lot of categories).
That kind of code is outside the limit of our support and is related to custom development ; if you cannot perform that task, I would recommend you to contact a developer/integrator.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.