=> admin/store/reports/coupon
part report:
Coupon code: 7245875F2
Order # Date Total Coupon value
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
#627 08.12.2010 161.00 83.70
Uses: 7 1127.00 585.90
In table uc_coupons_orders:
+------+-----+-----+--------+-------------+
| cuid | cid | oid | value | code
+------+-----+-----+--------+-------------+ ...
| 2 | 11 | 400 | 13.00 | 20C013B42 |
| 3 | 12 | 414 | 5.86 | 300475C040F |
| 4 | 13 | 419 | 31.61 | 4003B3130 |
| 5 | 12 | 423 | 11.48 | 3366225FF2C |
| 6 | 12 | 430 | 1.79 | 30F1EFEE078 |
| 7 | 12 | 446 | 42.26 | 30CB8176D74 |
| 8 | 12 | 447 | 42.26 | 30CB8176D74 |
| 9 | 12 | 453 | 8.26 | 33DD557C6CB |
| 10 | 16 | 627 | 83.70 | 7245875F2 |
| 11 | 16 | 627 | 83.70 | 7245875F2 |
| 12 | 16 | 627 | 83.70 | 7245875F2 |
| 13 | 16 | 627 | 83.70 | 7245875F2 |
| 14 | 16 | 627 | 83.70 | 7245875F2 |
| 15 | 16 | 627 | 83.70 | 7245875F2 |
| 16 | 16 | 627 | 83.70 | 7245875F2 |
| 17 | 16 | 651 | 4.90 | 7245875F2 |
| 18 | 20 | 697 | 5.40 | 111FE68131 |
| 19 | 20 | 707 | 6.40 | 111FE68131 |
| 20 | 20 | 709 | 46.60 | 111FE68131 |
| 21 | 25 | 744 | 115.46 | 168F476601 |
+------+-----+-----+--------+-------------+
Why double record usage coupons?
Comments
Comment #1
wowik73 commentedI modified code:
function _uc_coupon_apply_to_order($order_id, $coupon) {
...
else {
+ db_query("DELETE FROM {uc_coupons_orders} WHERE cid = %d and oid = %d", $coupon->cid, $order_id);
db_query("INSERT INTO {uc_coupons_orders} (cid, oid, code, value) VALUES (%d, %d, '%s', %f)", $coupon->cid, $order_id, $coupon->code, $coupon->amount);
uc_order_line_item_add($order_id, 'coupon', $coupon->title, -$coupon->amount);
Comment #2
wodenx commentedSorry for the delayed response.
I cannot reproduce this problem.
As far as I can tell, the only way this duplication could happen is if the line-item for the coupon is being deleted from the order by another module - can you see if any other module in your setup is calling uc_order_delete_line_item(), esp. with the second argument passed as TRUE?
Thx.
Comment #3
wodenx commentedPresumed fixed.