discount based on role always 0 dollar
tutube - January 19, 2009 - 08:26
| Project: | UC Discounts |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I created one product and a new role to test, a 10% discount created for the only product type in the system.
on the checkout page it seems discount applied, but the amount is always 0 dollar, anyone knows why?

#1
just found the reason, it seems $action is used on searching conditions table, so condition_list always empty:
---------------
function uc_discounts_product_class_apply($op, $action, $total_price, &$cart) {
//print_r($cart);
// get conditions to make sure products can't be used more than once for
// a discount
$sql = "SELECT * FROM {uc_discounts_conditions} WHERE discount_id=%d ";
$sql .= "AND property='product_class' AND item_id='%s' ";
$sql .= "ORDER BY condition_group, weight";
$result = db_query($sql, $action->discount_id, $action->item_id);
$condition_list = array();
while ($row = db_fetch_object($result)) {
$condition_list[$row->id] = $row;
}
---------------
after following changes, everything works fine:
$sql = "SELECT * FROM {uc_discounts_conditions} WHERE discount_id=%d ";
//$sql .= "AND property='product_class' AND item_id='%s' ";
$sql .= "ORDER BY condition_group, weight";
$result = db_query($sql, $action->discount_id);