@@ -517,6 +517,9 @@ if ($arg1->coupon['code'] != '') { $coupon_result = uc_coupon_validate($arg1->coupon['code'], $arg1); if ($coupon_result->valid) { + $items = uc_coupon_line_item(); + $coupon_result->weight = $items[0]['weight']; + // If we received a result from the database then it means there is a coupon in the table with that code // we then must validate the coupon with our validation function. It will return data about the coupon to insert into the order table db_query("UPDATE {uc_coupons_orders} SET cid = %d, oid = %d, code = '%s', value = %f WHERE oid = %d", $coupon_result->cid, $arg1->order_id, $coupon_result->code, $coupon_result->amount, $arg1->order_id); @@ -525,7 +528,7 @@ } db_query("UPDATE {uc_order_line_items} SET title = 'Coupon Discount: \'%s\'', amount = -%f, weight = 0 WHERE order_id = %d AND type ='coupon'", $coupon_result->code, $coupon_result->amount, $arg1->order_id); if (db_affected_rows() == 0) { - db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight) VALUES (%d, 'coupon', 'Coupon Discount: \'%s\'', -%f, 0)", $arg1->order_id, $coupon_result->code, $coupon_result->amount); + db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight) VALUES (%d, 'coupon', 'Coupon Discount: \'%s\'', -%f, %d)", $arg1->order_id, $coupon_result->code, $coupon_result->amount, $coupon_result->weight); } } else {