Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: Max quantity / quantity limit for shippable items

  1. #1
    PghKid is offline Junior Member
    Join Date
    May 2007
    Posts
    23

    Default Max quantity / quantity limit for shippable items

    Is there a way to set a limit, say "100 units". if a customer attempts to add more than that quantity, they should get a "call to order" type message...

    I have looked through the code and can't find this; I see MultiShipMaxItemsAllowed but that is not applicable to this scenario I believe.

    We just want to set a limit beyond which customers are told to call in to order...

    thanks in advance!!

  2. #2
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, the easiest to get around it is to set Restricted Quantities for those Shippable Products...

  3. #3
    PghKid is offline Junior Member
    Join Date
    May 2007
    Posts
    23

    Default

    RESTRICTED QUANTITIES under the variants would force me to enter 1,2,3,4,5.... to 100 units and limit it that way, but they could still add this same SKU into their cart and order a second hundred, right?


    I want them to be able to add any amount into their cart, but if it exceeds, say, "100 units" it is supposed to trigger a message to call for pricing and not let them complete the order.

    99 units = order goes through

    100= call to order
    Last edited by PghKid; 12-08-2009 at 04:50 AM.

  4. #4
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default Limiting the Quantity

    Well, you could try this modification:

    First add two AppConfig parameters:
    Name Type Value
    LimitQuantityOnProduct Boolean true/false
    QuantityLimit Int number (e.g. 100)

    Then under the AspDotNetStorefrontCore.ShoppingCart.GetAddToCartF orm method, add the highlighted parts:
    Code:
                if (!CustomerEntersPrice && (AppLogic.AppConfigBool("ShowQuantityOnProductPage") && !forKit) || (!AppLogic.AppConfigBool("HideKitQuantity") && forKit))
                {
                    tmpS.Append("	if ((theForm.Quantity.value*1) < 1)\n"); // convert form val to integer
                    tmpS.Append("	{\n");
                    tmpS.Append("		alert(\"" + AppLogic.GetString("common.cs.84", SkinID, LocaleSetting) + "\");\n");
                    tmpS.Append("		theForm.Quantity.focus();\n");
                    tmpS.Append("		submitenabled(theForm);\n");
                    tmpS.Append("		return (false);\n");
                    tmpS.Append("    }\n");
    
                    if (AppLogic.AppConfigBool("LimitQuantityOnProduct"))
                    {
                        tmpS.Append("	if ((theForm.Quantity.value*1) >="+ AppLogic.AppConfigUSInt("QuantityLimit")+" )\n"); // convert form val to integer
                        tmpS.Append("	{\n");
                        tmpS.Append("		alert(\" The limit quantity exceeds and it must called to order\");\n");
                        tmpS.Append("		theForm.Quantity.focus();\n");
                        tmpS.Append("		submitenabled(theForm);\n");
                        tmpS.Append("		return (false);\n");
                        tmpS.Append("    }\n");
                    }
                    
                    if (RestrictedQuantities.Length == 0 && MinimumQuantity != 0)
                    {
                        tmpS.Append("	if ((theForm.Quantity.value*1) < VariantMinimumQty_" + ProductID.ToString() + "_" + VariantID.ToString() + ")\n"); // convert form val to integer
                        tmpS.Append("	{\n");
                        tmpS.Append("		alert(\"" + String.Format(AppLogic.GetString("common.cs.85", SkinID, LocaleSetting), "\"+VariantMinimumQty_" + ProductID.ToString() + "_" + VariantID.ToString() + " + \"") + "\");\n");
                        tmpS.Append("		theForm.Quantity.focus();\n");
                        tmpS.Append("		submitenabled(theForm);\n");
                        tmpS.Append("		return (false);\n");
                        tmpS.Append("    }\n");
                    }
                }
    and that's it...

  5. #5
    kluckett is offline Junior Member
    Join Date
    Dec 2011
    Posts
    1

    Default Version 8.0

    I would like to know if this can be done in version 8.0. There is no AspDotNetStorefrontCore, but the code is in a AspDotNetStorefrontCommon file.