Announcement

Collapse
No announcement yet.

setting a minimum qty before being able to checkout

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

    setting a minimum qty before being able to checkout

    We are creating a new site but need to sell sweets in multiples of 6 for packing reasons.

    Can actinic be set to only allow orders that are divisible by 6 to go to the checkout stage.

    I did find this post http://community.actinic.com/showthread.php?t=6425

    but this was v7 and concered a minimum qty before being able to checkout which is not really what we need

    thanks

    david
    David Mawson
    Phoenix Trading

    http://www.sweetswholesale.co.uk - Wholesale confectionery suppliers

    #2
    Here's how to do this in V8 / V9. And for modulo 6. (With a note in the next post as to how to tweak this to set a minimum cart count instead.)

    You'll get a warning message on the cart display if there isn't a multiple of 6 in there. You'll also get a popup warning if you try to move through the checkout and the Next button won't work.

    Edit layout Checkout Shopping Cart Grid. Look for the line:
    Code:
    <!-- The condition below isn't really required here as the scripts are removing
    Immediately above that add:
    Code:
    <script type="text/javascript">
    	var errmsg = 'You must have multiples of 6 items in the cart to checkout';
    	function makethetest(){
    		return ( (getCartItem(3) % 6) == 0 );	// modulo 6 test
    	}
    	
    	function checkouttest(){
    		if ( makethetest() ) return true;
    		alert(errmsg);
    		return false;
    	}
    	
    	if ( ! makethetest() )
    		{
    		document.write('<h2 style="color:red">' + errmsg + '</h2>');
    		}
    </script>
    Edit layout Checkout Next Button. Replace the line:
    Code:
    <input type="submit" name="ACTION" value="<actinic:variable encoding="html" name="NextButton" />" />
    With:
    Code:
    <input type="submit" name="ACTION" value="<actinic:variable encoding="html" name="NextButton" />" onclick="return checkouttest();"/>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      I just amended the above so it's bit easier to tweak for different requirements. E.g. if you want to set a minimum number to be 12 then change the line:
      Code:
      		return ( (getCartItem(3) % 6) == 0 );	// modulo 6 test
      To be
      Code:
      		return ( getCartItem(3) >= 12 );	// at least 12
      And, of course, change the error message.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        As usual norman you have come up trumps again. Will test later but am sure it will all work fine
        David Mawson
        Phoenix Trading

        http://www.sweetswholesale.co.uk - Wholesale confectionery suppliers

        Comment

        Working...
        X