Feature: Do not allow checkout without a coupon

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

Feature: Do not allow checkout without a coupon

Postby admin » Wed Jul 31, 2013 1:35 pm

We've had a recent request not to allow the submission of the order without a use of a coupon. This feature is used especially if you sell gift certificates (outside the shop) and your shop will allow the purchases only when those gift certificates (coupons with awo coupons) are used.

The only modification that needs to be done is within your themes in /components/com_onepage/themes/onepage.unlogged (and logged).tpl.php

Just add this code to the end:
Code: Select all
<script type="text/javascript">
function checkCoupon(wasValid)
{
   
   coupon = getCouponCode();
   if (coupon != null)
      if (coupon == '')
                 {
                 alert('You must use a coupon before submitting the order');
       return false;
                 }
   return wasValid;
}
addOpcTriggerer('callSubmitFunct', 'checkCoupon');
</script>
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Return to One Page Checkout for Virtuemart 2

cron