Print Page | Close Window

Minimum no. of units

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Using ProductCart
Forum Description: Running your store with ProductCart
URL: https://forum.productcart.com/forum_posts.asp?TID=1802
Printed Date: 07-October-2024 at 5:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Minimum no. of units
Posted By: intour
Subject: Minimum no. of units
Date Posted: 07-July-2008 at 5:27am

I have a client who needs to set a minimum number of units to be ordered for retail customers.

A customer can order any combination of products but they must order a minumum number of 12.
 
Productcart allows a maximum number to be set so I'm hoping I can tweak the formula for this.
 
Is there anyone who has already done this or something similar?
 
Many thanks
 
Nigel
 
 
 



Replies:
Posted By: Hamish
Date Posted: 07-July-2008 at 7:56am
Hi Nigel,
      You can set a minimum number for particular products and a maximum number overall, but the code that checks the overall quantity has been exceeded is executed when products are added to the "cart".   To throw messages at that  point would probably become irritating to customers as, even when they know about the limit of 12  they would get the message until they reached the minimum of 12.

I think you will need to add code to the checkout process to check this to make this work OK.  It's an unusual requirement to have a minimum overall number of products I would have thought. Usually these things are achieved by having a minimum order value instead. Have you suggested this to your client as an alternative approach?




-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: intour
Date Posted: 07-July-2008 at 8:12am
Hi Hamish,
 
Thanks for your reply.
 
It's certainly not something I've been asked for before but I can wholly understand my clients request.
 
They are selling wine - you can buy a mixture of bottles - but the minimum amount is a case of 12 bottles.
 
Nigel
 


Posted By: Hamish
Date Posted: 07-July-2008 at 9:06am
Ah, yes - I can see that's a perfect example of when it would be required :-). I suspect they would want to sell in multiples of either 6 or 12 with a minimum of twelve.

I'd be happy to help them test it :-) 
FYI - The code used for the maximum quantity appears in pc/instPrd.asp (& a couple of others) and is coded as follows :-
if countCartRows(pcCartArray, ppcCartIndex)=scQtyLimit then

Where scQtyLimit is the Maximum quantity value set via the  "Store Settings > Order & Customer  Related".

I think you should place your code where the related "Minimum Order Amount" rules are enforced. Note, there are separate limits for Wholesale and Retail cutomers.

For Wholsale customers there are more locations with associated code, but There are 5 files in the "pc" folder that contain the "scminpurchase" but the key one, I suspect, is checkout.asp, although I would check all of them if I were you. NOTE - The Wholesale minimum is referred to in a couple of other files as well.

In checkout.asp there is code at line 197 in the version I'm looking at (V3.11) :-

        if calculateCartTotal(pcCartArray, ppcCartIndex)<scMinPurchase then
        'Retail minimum not met, so customer cannot checkout -> show message
            response.redirect "msg.asp?message=206"
        end if

I would put the new code very near there.


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: Hamish
Date Posted: 07-July-2008 at 9:18am
Hi Nigel,
   Another possible issue - This is fine as long as each product is a bottle. It get's a lot messier, if not unworkable if they sell other products as well, or whole / half cases  as products. They may end up with an order for 10 bottles and two corkscrews, or 2 cases and 10 bottles. Unless they sell ONLY wine by the bottle and plan to continue doing so this will probably cause more problems than it will solve.

One way round this is to use BTO and set the "product" up as a case / half case.
That way the customer buys a case and then "configures" it by selecting all the individual bottles that make it up. Even this would need some custom work as you would want them to be able to select any mixture but have the total number of bottles in the case set as 6 or 12.
Alternatively make a custom version of the code that counts the products so that it only counts wine bottles.

The "best" answer depends hugely on how the store is configured as regards products / categories etc.  

-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: intour
Date Posted: 07-July-2008 at 9:34am
Hi Hamish,
 
Many thanks again for your replies.
 
They only sell bottles of wine and I think all the bottles are the same size so that, at least, is a good thing.
 
This may require a fair bit of custom coding to achieve and I don't think it's in their budget.
 
I'll put it to the client and see what response I get.


Posted By: Hamish
Date Posted: 07-July-2008 at 10:00am
Hi,
  I don't think it would be much work - as long as they are happy that they will then be limited to just selling bottles, otherwise they would hit the issues I have described. For example - they may wish to sell single bottles of very expensive wine, or some of the larger bottle sizes.  Actually, it would be possible to have a minimum number of bottles (items) OR order value - but they then "risk" selling  a small number of high value items in a quantity less than 12.  It's up to them.


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: mattprice
Date Posted: 07-July-2008 at 11:36am

Hi all,

When I purchased Productcart + BTO in July last year I paid Early Impact to add a minimum order quantity modification for me that made it independent of multiple order quantity.  At the moment when you set a min order qty and multiple order qty the two figures must be the same. They don't normally undertake mod work but like always they are incredibly helpful bunch.
 
This does not handle your mixed product (bottle) issue but it may be a step closer.  It used Javascript to force the minimum order quantity before checkout so you may be able to adapt the code.  You are welcome to my modified code, if interested drop me your contact details and I'll email you the files.  Problem is this was last July (around version 3.04 ish I think) and some of the common files have upgraded since.
 
I asked EI recently if they could implement the mod they made for me into the standard code but I think it is low priority because nobody has asked before.  We had quite specific reasons for adding this code but I imagine this could be useful to other users because minimum order quantity and multiple order quantity are two very different things and I dont think should be interlinked as they are now in PC.  A minimum order quantity often establishes the qty with which a store can sell a product at an acceptable margin but the multiple order quantity thereafter may be set for more practical reasons (eg the ease at which a product can be packed )
 
I dont have a site to show you I am afraid.  This site is still not live and after upgrading recently have not reimplemented the mod.
 
Matt


Posted By: intour
Date Posted: 07-July-2008 at 12:02pm
Hi Matt & Hamish,
 
Matt - Ive sent you a private message with my email address.
 
Hamish - I tried modifying the checkout.asp page. ProductCart has a bit of code there that redirects to a messsage from the language file if the cart is empty. It basically says that if the number of items in the cart = 0 then show the 'your cart is empty' message.
 
So I thought if I changed it to: < 12 and then changed the message to 'you need to order a minimum of 12' it might be  simple solution but it didnt work. It just kept throwing up the message no matter what I put in the cart. Theres bound to be another 'include' file in there somwhere that has a bearing on it - there always is !
 
ah well - back to the drawingboard for now.
 
Nigel
 


Posted By: mattprice
Date Posted: 07-July-2008 at 1:11pm

Hi Nigel,

I have just emailed the files across to you now.  Good Luck.  Forgot to mention that EI made the mod compatible with BTO add on as well but these files can be comfortably split I think if you are not using this.
 
I had a look at updating the common files to latest rev but there are quite a few line additions on a few of the files and my head was getting dizzy even using a file comparison program.  This is why I was hoping EI would incorporate the mod into the mainstream release.
 
If you or Hamish (or any other developer reading) fancy taking on some paid for time in bringing this EI mod up to latest revision I would be interested.  It might even spur me on to get this project live after 12 months rather than letting it stagnate on the corner of my desk.
 
Cheers
Matt


Posted By: Hamish
Date Posted: 07-July-2008 at 4:00pm
Hi Nigel,
   It should have worked OK.

Take a look at these lines  (177 in V3.11 of checkout.asp) :

    if countCartRows(pcCartArray, ppcCartIndex)=0 then
        response.redirect "msg.asp?message=9"
    end if

Amending this to :-

    if countCartRows(pcCartArray, ppcCartIndex)<12 then
        response.redirect "msg.asp?message=9"
    end if

It worked OK when I tested it - although of course the message was incorrect :-) .

HOWEVER - I found another related issue - This counts the number of DIFFERENT products, so if someone selects a combination including a multiple of any bottle that would NOT be counted - So it will need to take that into account as well.
In addition I suspect your client wants to sell in MULTIPLES of 12 - so you would need to use MOD 12 <> 0  instead of just <12.
 


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: intour
Date Posted: 07-July-2008 at 4:14pm
Hi Hamish,
 
That was driving me nuts - I couldn't understand why it didn't work but if it only counts the number of products not the number of bottles ordered then it makes sense.
 
Thanks for that - I'm not going crazy!
 
The client doesn't need to sell 12 of any particular wine type - just 12 in total to make up a case. Does the code you suggested do that?
 
Nigel
 
 


Posted By: intour
Date Posted: 07-July-2008 at 4:27pm
One other thing.
 
The same code appear at lines 100 and 209 too.
 
I best check it more thoroughly.
 
Nigel


Posted By: intour
Date Posted: 07-July-2008 at 4:44pm

I'm losing the plot here Confused

Its not at those lines in checkout.asp - only the one instance - why did I think there was 3 ?
 
 


Posted By: intour
Date Posted: 07-July-2008 at 5:10pm
Hi Hamish,
 
I discovered what happened to the missing code - it was in orderverify.asp not checkout.asp
 
Nigel
 
 
 
 
Nigel
 


Posted By: Hamish
Date Posted: 07-July-2008 at 5:14pm
"Does the code you suggested do that?" Nope, it doesn't - To make this work as you need will take a bit of investigation to find which value in an array holds the the number of the product has been ordered. As EI already did this for Matt and both you and he want the same functionality it seems to make sense to bring that code up to date to match the latest version. I'll PM Matt.






-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: intour
Date Posted: 07-July-2008 at 5:31pm

I should clarify this one.

The minimum anyone can buy is 12 bottles but this does not mean mutiples of 12.
 
They can purchase any amount over 12 - strange I know !
 
Nigel
 


Posted By: intour
Date Posted: 15-July-2008 at 4:26pm
Hi Hamish and Matt,
 
Just wanted to update you on this one.
 
I now have it working thanks to a little help from someone on another forum I've been vsisiting on and off since 2002.
 
If you need the code please email me. A few short lines did the trick.
 
Nigel
 
 


Posted By: Hamish
Date Posted: 16-July-2008 at 4:40am
Hi Nigel,
        Yes, I'd be interested.  Matt - I've not forgotten. Just V busy.


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: mattprice
Date Posted: 30-December-2008 at 7:08am
Hi Hamish,
 
Well 6 months down the line (it is not usually my response time on a thread reply) and I see you are on the EI payroll.  Thats great news !!
 
I wondered whether you are able to take a look at the EI mod that was done for me (and mentioned earlier on in this thread) when I purchased my licence of Productcart + BTO some 18 months ago ?  I paid EI to get the multiple order quantity that is currently featured to work independently of the minimum order quantity.  The solution that EI did for me was a few hours work and worked perfectly.  The problem was that by the time I was ready to implement my store version 3 enhancements came on leaps and bounds and my technical incompetence meant I could not bring this feature mod up to the latest revision.
 
I would gladly pay to have the feature V3.5 compatible. Can you help ? 
 
 
Regards
Matt
 


Posted By: intour
Date Posted: 30-December-2008 at 7:23am
Hi Matt,
 
Was the solution I ended up with what you are after? If so you are welcome to see the code.
 
Quite simple to implement too.
 
Nigel


Posted By: mattprice
Date Posted: 30-December-2008 at 8:36am
Hi Nigel,
 
I think we had different requirements.  As far as I understand you had quite an unusal requirement in that the total order quantity of any mix of products had to be at least X qty.   Hence you were able to apply a generic rule.
 
My requirement is product specific and I need to be able to specify both a minimum purchase qty and a multiple purchase quantity for every single product.  The minimum and multiple quantities may also be different for each product.
 
I guess the ideal solution, if I can pay EI to bring the mod they did for me up to latest revision is to ask whether they can also include the code in a future productcart revision.  The modification enabled the admin to change a products mutliple order quantity so it could be of benefit to other Productcart users ?
 
 


Posted By: intour
Date Posted: 30-December-2008 at 9:11am
Hi Matt,
 
I understand now and it is quite different tyo what I needed. I can see why you would want that. It's quite a common requirement these days when ordering online.
 
 


Posted By: Greg Dinger
Date Posted: 30-December-2008 at 9:20am
As a follow-up to this thread, possibly useful for others in the future, we recently implemented a "minimum order quantity" feature for a standard store.
 
The requirement that this client was that on a category-by-category basis (but not all products), there was a minimum which could mix within like products.  As the shopper proceeds to checkout.asp, we determine if qualifying products appeared on the order.  Then we examine the quantity ordered for each qualifying group, and display an error instructing the shopper accordingly if their selections did not meet the requirements.
 
A fairly simple mod, possibly useful to others.


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: Hamish
Date Posted: 30-December-2008 at 7:47pm
Hi Matt,
    PC has something V close to what you require (I think) built in :
Minimum Quantity to Buy: [        ]   Force purchase of multiples of minimum: []
I'll drop you a PM.
 



-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: mattprice
Date Posted: 31-December-2008 at 4:38am
Hi Hamish,
 
The inbuilt functionality in PC is very close but unfortunately (and I think rather strangely) is that the multiples must be the same quantity as the minimum quantity.  So it is fine to force a minimum of 10 and then 20, 30, 40, 50 etc but I cannot force a minimum of 20 and then every 10.
 
Thanks for the PM.  I will dig out the files that Cedric sent me for the paid mod and drop them on an email.  I am happy to pay to bring the files up to latest rev because I have never actually made use of my Productcart licence for 18 months and would love to switch my store.


Posted By: MattECR
Date Posted: 02-January-2009 at 12:03pm
Hamish,
Could you also share with me how to accomplish this solution?  I have a need that is similar to this.  My actual need is to allow a quantity of any number between 1-99, then increments of 50 after that  Mind if I ask why you PM'd the solution?  I was just thinking, I wouldn't have to bother you if you had just posted the solution here...
 
Also, another thought... Would it be possible to replace the minimum quantity validator with a regular expression validator?  That way we could control the quantity of a product in what ever wacky way we wanted.


Posted By: Greg Dinger
Date Posted: 02-January-2009 at 12:14pm
I could be incorrect, but I believe Hamish took a couple days off for the holiday and may not be able to answer until early next week.

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: MattECR
Date Posted: 02-January-2009 at 12:20pm

Would you have any suggestions as to how to accomplish what I am tring to do Greg?



Posted By: Greg Dinger
Date Posted: 02-January-2009 at 1:06pm
I do happen to know that Hamish claims wondrous skills with regular expressions, and it would probably be best to await his response. 

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: intour
Date Posted: 02-January-2009 at 4:24pm
Hamish is a Scotman - they have to take a few days off for New Year due the vast amounts of alchohol they consume at Hogmany !!! Big%20smile
 
Happy New Year everyone !
 
Nigel


Posted By: Greg Dinger
Date Posted: 02-January-2009 at 4:43pm
And a good man he is!  This place wouldn't be the same without him.

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: mattprice
Date Posted: 03-January-2009 at 7:40am

Happy New Everyone,

Hamish did say it was taking some time off for New Year (and well deserved time it will be too).  I think he PM'd me so I could forward on the modified files that Early Impact did for me when I originally purchased Productcart.  These are early version 3 files and Hamish was going to see if he can bring these up to latest rev in the next week or so.
 
There were quite a few files affected because of the different areas of productcart where a product can be added to a cart (including BTO files) so I dont think it will be easy to publish a solution on these forums.
When updated I am happy to share the files with anyone who wants them.  I am also happy for EI to incorporate the mod into the next version of PC if they would consider it.  It would certainly help me with future upgrades.
 
Matt



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net