Virtuemart 2.0.26 Coupon Usage is not being Recorded


  • Your avatar
    seyi    
     2 years ago
    0

    If you are using Virtuemart 2.0.26, there have been changes to the way the coupon functionality works that is affecting AwoCoupon in a bad way. The changes originated from this discussion:
    http://forum.virtuemart.net/index.php?topic=120972

    I have requested that certain code be added to Virtuemart but until that happens, at this point the history of uses is not recorded. This affects
    - number of uses
    - gift certificates
    - if using AwoAffiliate, calculationg commision
    - if using AwoRewards/AwoReferral, calculatin rewards for referrals

    First make sure you are using the latest version of AwoCoupon Pro and then add the code below:

    in www/components/com_virtuemart/helpers/coupon.php, around line 149 is this
    <?php
        
    static public function setInUseCoupon($code$in_use=true){
    ?>


    Right after that, add this
    <?php
            JPluginHelper
    ::importPlugin('vmcoupon');
            
    $dispatcher JDispatcher::getInstance();
            
    $returnValues $dispatcher->trigger('plgVmCouponInUse', array($code));
            if(!empty(
    $returnValues)){
                foreach (
    $returnValues as $returnValue) {
                    if (
    $returnValue !== null  ) {
                        return 
    $returnValue;
                    }
                }
            }
    ?>


  • Default avatar
    sknops    
     2 years ago
    0

    Hi,
    I tested your demo on http://demo.awocoupon.com/.
    Are these changes above done there?
    I could use a coupon for more then one time.
    Regards
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    The demo site currently uses an older version of Virtuemart, so not affected.
  • Default avatar
    sknops    
     2 years ago
    0

    Sorry, I saw this, but after writing my comment
  • Default avatar
    richard52    
     2 years ago
    0

    I'm confused by how exactly to edit the file at www/components/com_virtuemart/helpers/coupon.php. There is no
    <?php
     
    ... 
    ?>
    in that part of the file. When you say add the new code after setInUseCoupon, is this correct?


    static public function setInUseCoupon($code, $in_use=true){
    JPluginHelper::importPlugin('vmcoupon');
    $dispatcher = JDispatcher::getInstance();
    $returnValues = $dispatcher->trigger('plgVmCouponInUse', array($code));
    if(!empty($returnValues)){
    foreach ($returnValues as $returnValue) {
    if ($returnValue !== null ) {
    return $returnValue;
    }
    }
    }

    $session = JFactory::getSession();
    $coupon_used = $session->getId();
    $db = JFactory::getDBO();
    if (!$in_use) {
    $db = JFactory::getDBO();
    $q = 'SELECT `coupon_used` '
    . 'FROM `#__virtuemart_coupons` '
    . 'WHERE `coupon_code` = "' . $db->getEscaped($code) . '"';
    $db->setQuery($q);
    $coupon_session_id=$db->loadResult();
    if ($coupon_used !=$coupon_session_id) {
    return;
    }
    $coupon_used=0;
    }
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Yes, it is correct, you can ignore the That is just there to beautify the code within the forum.
  • Default avatar
    david735    
     2 years ago
    0

    I have added the code above and now orders using coupons appear in the 'History of uses' tab of AWO Coupon Pro component.

    But i tried this with a coupon with 3 total uses and the number of total uses was not reduced by 1.

    Therefore I expect if i used a coupon with 1 total use it would not be unpublished.

    I'm using Joomla 2.5.18 / Virtuemart 2.0.26d / AWO COUPON PRO 2.2.5

    Which is the most up to date version of each.
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    The number of uses does not get reduced, it just calculates from the history. Test it out.
  • Default avatar
    pcmilhoudr    
     2 years ago
    0

    I'm using free version of AWO coupon affected by number of uses problem.
    If I buy the Pro version and made the change in the code above, I'm sure that number of uses will be respected?

    Regards

    Paolo
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    I have updated the free version, please get latest. You still need to add the code for it to work in 2.0.26. The number of uses in the free version will be recorded on Order Creation.
  • Default avatar
    allen1    
     2 years ago
    0

    Do I understand correctly that this code will not enable AWO to limit coupon usage to the number of uses specified? What about to the user or asset specified?

    AWO - Is this going to be fixed? This renders AWO as an unacceptable coupon solution for us.
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Do I understand correctly that this code will not enable AWO to limit coupon usage to the number of uses specified?
    ==> This code will allow limiting of coupon usage

    What about to the user or asset specified?
    ==> as far as I know, there is no problems with asset/users, if you find a bug, please start a new thread

    AWO - Is this going to be fixed? This renders AWO as an unacceptable coupon solution for us.
    ==> AwoCoupon is already fixed, this is the solution for Virtuemart
  • Default avatar
    iRescue.gr    
     2 years ago
    0

    This comment has been moved here.

This thread is locked.