Report - History of Uses not working


  • Default avatar
    john59    
     14 years ago
    0

    This is more of a bug report for you Seyi,

    The History of uses report is not working correctly. I have used 3 coupon 4 times

    Coupon Code ID Username Last Name 2 First Name Discount Order Number Order Total Order Date
    1 JBC003-C02 62 johnb Basevi John 10.00 00000023 90.00 2010-07-20
    2 JBC004-C01 69 jaybee bas John 25.00 00000025 175.00 2010-07-20
    3 JB004-C02 69 jaybee bas John 0.38 00000026 2.12 2010-07-20

    Coupon JBC003-C02 has been used twice as below

    Num Coupon Code ID Username Last Name First Name Discount Order Number
    Display #
    1 JB004-C02 69 jaybee bas John 0.38 000000268
    2 JBC003-C02 62 johnb Basevi John 10.00 000000238
    3 JBC003-C02 69 jaybee bas John 0.65 000000248
    4 JBC004-C01 69 jaybee bas John 25.00 000000258

    Believe the WHERE clause is missing in the query in reports.php. Also in the second list above seem to have the number 8 appended to each order number
  • Your avatar
    seyi    
     14 years ago
    0

    Thanks John.

    For the report, its not the where clause, its grouping by an id it shouldnt be. The fix:
    In www/administrator/components/com_awocoupon/models/reports.php line 344
    <?php
     ov
    .order_id,ov.order_total,ov.cdate
    ?>

    change to
    <?php
     ov
    .order_id,ov.order_total,ov.cdate,uu.id as num_uses_id
    ?>

    and line 363
    <?php
    $this
    ->_data->rows[$row['id']] = $row;
    ?>

    change to
    <?php
    $this
    ->_data->rows[$row['num_uses_id']] = $row;
    ?>



    For the 8 in order id, just missing the s in sprint. The fix:
    in www/administrator/components/com_awocoupon/views/usershistory/tmpl/default.php line 64
    <?php
    <td align="center"><?php echo !empty($row->order_id) ? printf("%08d"$row->order_id) : ' '
    ?>

    ?>
    change to
    <?php
    <td align="center"><?php echo !empty($row->order_id) ? sprintf("%08d"$row->order_id) : ' '
    ?>

    ?>

    As of version 1.0.2, this will be fixed.
  • Default avatar
    martin    
     13 years ago
    0

    In history of uses I can see list of gift certs but not their usage. I can use it in orders. but why I can use gift cert multiple times? even if whole amount was used a can use it next time. So when I use it, it doesn't reflect in history. so something is probably wrong or am I doing something wrong? I have the newest version. thanks for help
  • Your avatar
    seyi    
     13 years ago
    0

    Yes, it sounds like something is wrong somewhere. Can you look in your database? The user_uses table should look like this:
    mysql> desc jos_awocoupon_user_uses;
    +-------------------+---------------+
    | Field             | Type          |
    +-------------------+---------------+
    | id                | int(11)       |
    | coupon_id         | varchar(32)   |
    | user_id           | int(11)       |
    | coupon_discount   | decimal(12,5) |
    | timestamp         | timestamp     |
    | shipping_discount | decimal(12,5) |
    | order_number      | varchar(32)   |
    | productids        | text          |
    +-------------------+---------------+
    8 rows in set (0.03 sec)


    Do you see the same thing?
  • Default avatar
    martin    
     13 years ago
    0

    Yes the table looks like yours. All install injections are ok. Do you have any idea how to make it work? I need it for my client working. thank you Seyi.
    Field Type Null Default Comments
    id int(11) No
    coupon_id varchar(32) No
    user_id int(11) No
    coupon_discount decimal(12,5) No 0.00000
    shipping_discount decimal(12,5) No 0.00000
    order_number varchar(32) Yes NULL
    productids text Yes NULL
    timestamp timestamp No CURRENT_TIMESTAMP
  • Your avatar
    seyi    
     13 years ago
    0

    I do not know what what cause the history not to work then. Can you pm me with credentials to view the site?

    === EDIT ===
    After looking at the site, the coupon cleanup code had been commented out. Uncommenting the piece of code reproduced the history of uses.