Hello,
Here are the edits I originally gave out, may need an adjustment or 2. One other note, this is specifically for Virtuemart.
www/components/com_awocoupon/models/coupons.php, around line 35 is this:
<?php
$current_date = date('Y-m-d H:i:s');
$sql = 'SELECT u.coupon_id,c.num_of_uses_type,c.num_of_uses
FROM #__awocoupon_user u
JOIN #__awocoupon c ON c.id=u.coupon_id
WHERE c.estore="'.MYESTORE.'" AND u.user_id='.$user->id.' AND c.published=1
AND ( ((c.startdate IS NULL OR c.startdate="") AND (c.expiration IS NULL OR c.expiration="")) OR
((c.expiration IS NULL OR c.expiration="") AND c.startdate<="'.$current_date.'") OR
((c.startdate IS NULL OR c.startdate="") AND c.expiration>="'.$current_date.'") OR
(c.startdate<="'.$current_date.'" AND c.expiration>="'.$current_date.'")
)';
?>
Change it to this
<?php
$sql = 'SELECT virtuemart_shoppergroup_id FROM #__virtuemart_vmuser_shoppergroups WHERE virtuemart_user_id='.$user->id;
$this->_db->setQuery($sql);
$shopper_group_id = $this->_db->loadResult();
if(empty($shopper_group_id)) {
$this->_db->setQuery('SELECT virtuemart_shoppergroup_id FROM #__virtuemart_shoppergroups WHERE published=1 AND `default`=1');
$shopper_group_id = $this->_db->loadResult();
}
$current_date = date('Y-m-d H:i:s');
$sql = 'SELECT u.coupon_id,c.num_of_uses_total,c.num_of_uses_customer
FROM #__awocoupon_user u
JOIN #__awocoupon c ON c.id=u.coupon_id
WHERE c.estore="'.AWOCOUPON_ESTORE.'" AND u.user_id='.$user->id.' AND c.published=1
AND ( ((c.startdate IS NULL OR c.startdate="") AND (c.expiration IS NULL OR c.expiration="")) OR
((c.expiration IS NULL OR c.expiration="") AND c.startdate<="'.$current_date.'") OR
((c.startdate IS NULL OR c.startdate="") AND c.expiration>="'.$current_date.'") OR
(c.startdate<="'.$current_date.'" AND c.expiration>="'.$current_date.'")
)
UNION
SELECT u.coupon_id,c.num_of_uses_total,c.num_of_uses_customer
FROM #__awocoupon_usergroup u
JOIN #__awocoupon c ON c.id=u.coupon_id
WHERE c.estore="'.AWOCOUPON_ESTORE.'" AND u.shopper_group_id='.$shopper_group_id.' AND c.published=1
AND ( ((c.startdate IS NULL OR c.startdate="") AND (c.expiration IS NULL OR c.expiration="")) OR
((c.expiration IS NULL OR c.expiration="") AND c.startdate<="'.$current_date.'") OR
((c.startdate IS NULL OR c.startdate="") AND c.expiration>="'.$current_date.'") OR
(c.startdate<="'.$current_date.'" AND c.expiration>="'.$current_date.'")
)'
;
?>