Announcement

Collapse
No announcement yet.

How can I stop people checking out of my store when they have too few items in the...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I stop people checking out of my store when they have too few items in the...

    How can I stop people checking out of my store when they have too few items in the cart?

    This code will prevent customers from checking out unless they have at least two items in their shopping cart.

    Version 8 and 9

    Go to the 'Design' tab and select 'Checkout Page 1' from the 'Select Page Type' drop-down list.

    Click on the 'Next>' button in the design.

    Replace the code in the 'Checkout Next Button' layout with the following:

    HTML Code:
    <script language="JavaScript">
    <!--
    /************************************************************/
    *
    * getCartItem    -    Gets the Actinic Cart Value & No of Items
    *
    *************************************************************/
    
    //CART_CONTENT = Cookie name
    //1 = TOTAL_VALUE
    //3 = CART_COUNT
    
    function getCartItem(index)
        {
        var act_cart= getCookie("CART_CONTENT")
        temp =(act_cart != null) ? temp=act_cart.split("\t"):0;
        return (temp.length > 0) ? temp[index] : 0;
        }
    // -->
    </script>
    
    <input type=SUBMIT name=ACTION value="<actinic:variable encoding="html" name="NextButton" />" onclick="if (getCartItem(3) >= 2) {return true;} else {alert('Minimum order is 2 items');return false;}">
    Version 10

    For version 10, please use the following code: -

    HTML Code:
    <script language="JavaScript">
    <!--
    /************************************************************/
    *
    * getCartItem - Gets the Actinic Cart Value & No of Items
    *
    *************************************************************/
    
    //CART_CONTENT = Cookie name
    //1 = TOTAL_VALUE
    //3 = CART_COUNT
    
    function getCartItem(index)
    {
    var act_cart= getCookie("CART_CONTENT")
    temp =(act_cart != null) ? temp=act_cart.split("\t"):0;
    return (temp.length > 0) ? temp[index] : 0;
    }
    // -->
    </script>
    
    <input type="submit" name="ACTION" id="idBtnNext" value="<actinic:variable encoding="html" name="NextButton" />" class="highlight-button" 
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%200">
    	onclick="if (getCartItem(3) >= 2) {return true;} else {alert('Minimum order is 2 items');return false;}; return CheckForm(this);"	
    </actinic:block>
    	/>
    Where it says: -

    if (getCartItem(3) >= 2)

    the '2' can be replaced with another minimum quantity.
Working...
X