awocoupon free version 2.0.17 with VM3


  • Default avatar
    ptrouw    
     9 years ago
    0

    Looking at the table structure of
    CREATE TABLE IF NOT EXISTS `jos_awocoupon_vm_history` (
    `coupon_id` varchar(32) NOT NULL DEFAULT '',
    `user_id` int(11) NOT NULL,
    `num` int(11) NOT NULL DEFAULT '0'
    )

    I would have expected that the "num" field would do some kind of counting.
    What is the use of this field?
    Should this be an auto increment value?
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    The num field increments on coupon usage, for each unique user_id, coupon_id.
  • Default avatar
    ptrouw    
     9 years ago
    0

    Hi Seyi,

    This doesn't work it stays on 1!
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Just tested this in vm3. It works if the user is logged in. For anonymous users it tries to add a new line.

    So to get it to increment all anonymous users for each specific coupon, in
    www/administrator/components/com_awocoupon/helpers/vm_coupon.php around line 525 is this
    <?php
            $db
    ->setQuery('SELECT user_id FROM #__'.AWOCOUPON.'_history WHERE coupon_id='.$coupon_row->id.' AND user_id='.$user->id);
    ?>


    Change it to this
    <?php
            $db
    ->setQuery('SELECT coupon_id FROM #__'.AWOCOUPON.'_history WHERE coupon_id='.$coupon_row->id.' AND user_id='.$user->id);
    ?>