Page 1 of 1

Add to cart as a link - enhanced

PostPosted: Tue Nov 27, 2012 8:50 am
by liviu.popa@.....ro
As long as AWCOUPON can be used with VirtueMart, may be you will allow something like:
/index.php?option=com_virtuemart&page=shop.cart&add_id[]=270&qadd_270=10&cid=1
where cid=1 is the awocoupon id (or code as you like)

Re: Add to cart as a link - enhanced

PostPosted: Fri Nov 30, 2012 10:57 am
by admin
Hello, i am afraid that automatic coupopn assignment would not be used by many customers. If you want a coupon to be automatically added, you can add it in any enabled system plugin in:
Code: Select all
function onAfterRoute() {
....

// you can filter it to VM pages only:
if (JRequest::getCmd('option') == 'com_virtuemart')
{
// will get autocoupon=1 from the url
$x = JRequest::getVar('autocoupon', 0);
if ($x)
{
  // if you want a particular coupon, you'd have to query it by
  // $dbj=JFactory::getDBO(); $q = 'select coupon_code from #__something where id = '.(int)$someid..... $db->setQuery($q); $cc = $db->loadResult();
   if (empty($_SESSION['coupon_code']))
    $_SESSION['coupon_code'] = 'your awo coupon code';
}
}

// thus it will automatically be used in the cart
}


The code is no way complete and may contain errors.

You can download my currency plugin, which redirects the old checkout.index page to OPC's shop.cart page and add it there.

Best Regards,
Stan