yggdrasil Posted May 26, 2016 Share Posted May 26, 2016 <p> This not actual a technical problem but rather a technical how-to on how to accomplish something with WHMCS. I have a product which requires quantities, so I created the Configurable Options with the quantities. The problem is that I require a minimum ordering, let’s say 10. Because the amount is otherwise very low for processing payments.</p> <p> The problem is that the user needs to use them in sizes of single units, and not minimums once enabled. I manually adjust this on the user side. So if I create the product with a minimum of 10. Everything is nice on the ordering side. But then when I need to extract the usage on the customer account I can’t. The reason is that since the minimum ordering is 10, WHMCS will not let you update this on the user account to for example 9. It will force 10 or nothing. Maybe this is expected but in such cases it’s a problem.</p> <p> The idea is very simple. Customer buys 10. Uses 1, he has 9 left in his account. He can then order more from his account. I manually adjust the usage value on this account. So the only solution I have found is to set minimums to 1 and put a setup fee. This is ok, except setups are one-time fee only. I still don’t want someone buying just one because the ordering amount is just very low. Users are able to order more from their active account in the configuration options. I want a minimum order, yes.</p> <p> You could argue, why don’t just use the quantity setting in products. The reason is I don’t want to create a full product each time because it’s not an actual product. This is something users will use very offend, similar to credits, so if they use 100 in a year, that is just insane. It would mean the user now has 100 products on his account. A nightmare for the user and administration as well having thousands and thousands of products, most inactive once used. So the idea is to have 1 single product Active, and then use the configuration options to increase or decrease the product with a slider. The customer can order the amounts he needs. The only problem with this approach is I cannot manually adjust the setting on the admin side then. I cannot set the unit below the minimum.</p> <p> Has anyone solved this in a different way?</p> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 26, 2016 Share Posted May 26, 2016 as you will already know when using sliders, you define the minimum and maximum values and WHMCS generates a slider between those for that range. however, with the new Standard_Cart template, one of the things that you can now do with sliders, is to specify artificial limits (for all or just some configurable options) during the ordering process... if we have two sliders, both with quantity ranges of 0->64, we can set one (or both) of them to effectively have a minimum order requirement, e.g 10, beyond which the customer CANNOT move the slider further left - so they HAVE to order at least 10. if you take a look at the quick video below, you'll see what I mean - the top slider (London Game Slots) works as normal, but the lower one (NY Game Slots) has a minimum amount set of 10 - customers can order more than ten, but not less. http://www.screencast.com/t/Ou1zrG9vwwA now this next step is untested, but logically it should work. WHMCS won't know that you've artificially manipulated the range of this configurable option, so as far as it is aware, the range is still 0->64 and not the 10->64 that was used in the cart... it will think the minimum is 0, so I can't see any reason why you couldn't adjust it to 9 or less at a later point. with regards to how to do this, you'd need to modify the standard_cart/configureproduct.tpl template and change... <script> jQuery("#inputConfigOption{$configoption.id}").ionRangeSlider({ min: {$configoption.qtyminimum}, max: {$configoption.qtymaximum}, grid: true, onFinish: function() { recalctotals(); } }); </script> to... <script> jQuery("#inputConfigOption{$configoption.id}").ionRangeSlider({ min: {$configoption.qtyminimum}, max: {$configoption.qtymaximum}, grid: true, {if $configoption.id eq 11} from_min: 10, {/if} onFinish: function() { recalctotals(); } }); </script> all that you should then need to do is to identify the configurable option ID for the slider you want to manipulate and replace '11' with it in the above code... either using {debug} in the template or viewing the URL when modifying the configurable option should give you the correct ID number. I think that should take care of the initial ordering issue - for those clients upgrading, you'll probably need to add an {if} statement in the upgrade template to ensure the quantity ordered is greater than 10 (if they need to order 10+ when upgrading) before allowing the upgrade to continue. 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted May 26, 2016 Author Share Posted May 26, 2016 Hi Brian. Many thanks for the detailed information. Actually I'm using the standard cart. What you posted may work. I will test this later. So basically what you are saying is set an artificial limit. So the customer cannot order below 10, but it would be just a visual trick, as far as WHMCS concerns, it would think its 0 so it will then let me adjust the amounts from the customer side. This may work. I don't think it would work on upgrades from the customer side but if its working for new orders that is fine with me as long as it allows me to adjust it manually on each customer product. Please note that I do not need to adjust this in the order form but on the customer side. The order form actually needs to know the correct number, otherwise how will it calculate the correct pricing. As when you move the slider units, it will change pricing. Its on the admin side, where I manually adjust the units that it doesn't let me go below the minimum set. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 26, 2016 Share Posted May 26, 2016 Hi Brian. Many thanks for the detailed information. Actually I'm using the standard cart. What you posted may work. I will test this later. So basically what you are saying is set an artificial limit. So the customer cannot order below 10, but it would be just a visual trick, as far as WHMCS concerns, it would think its 0 so it will then let me adjust the amounts from the customer side. that's my thinking - I can't see why WHMCS would use any figure other than the minimum amount in the configuration option setup... This may work. I don't think it would work on upgrades from the customer side but if its working for new orders that is fine with me as long as it allows me to adjust it manually on each customer product. if memory serves, upgrades on the customer side is just a text box and not a slider - so then it's just a case of ensuring the upgrade order is for more than 10 (if that's what you want to do). Please note that I do not need to adjust this in the order form but on the customer side. The order form actually needs to know the correct number, otherwise how will it calculate the correct pricing. As when you move the slider units, it will change pricing. Its on the admin side, where I manually adjust the units that it doesn't let me go below the minimum set. well the order form will know the correct number... on the above demo example, the NY Slots are priced at £1 and it correctly automatically adds £10 to the order summary - so the sliders will work fine from that point of view. the admin side still won't let you go below the minimum set... it's just that with the above in place, you can set the minimum to 0 or 1 etc. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.