GX-Bug #54361 » CouponRestrictedToCategoriesFix.patch
src/includes/modules/order_total/ot_coupon.php (revision ) | ||
---|---|---|
506 | 506 |
{ |
507 | 507 |
// v5.13a Tanaka 2005-4-30: New code, this correctly identifies valid products in subcategories |
508 | 508 |
$cat_ids = explode(',', $get_result['restrict_to_categories']); |
509 |
$my_path = xtc_get_product_path($t_prid); |
|
510 |
$sub_cat_ids = explode('_', $my_path); |
|
509 | ||
510 |
$sub_cat_ids = array(); |
|
511 | ||
512 |
$t_sql = 'SELECT categories_index FROM categories_index WHERE products_id = "' . $t_prid . '"'; |
|
513 |
$t_result = xtc_db_query($t_sql); |
|
514 | ||
515 |
if(xtc_db_num_rows($t_result) == 1) |
|
516 |
{ |
|
517 |
$t_row = xtc_db_fetch_array($t_result); |
|
518 |
preg_match_all('-(\d+)-', $t_row['categories_index'], $t_matches); |
|
519 |
foreach($t_matches[1] AS $t_products_categorie_id) |
|
520 |
{ |
|
521 |
if($t_products_categorie_id != 0) |
|
522 |
{ |
|
523 |
$sub_cat_ids[] = $t_products_categorie_id; |
|
524 |
} |
|
525 |
} |
|
526 |
} |
|
527 | ||
511 | 528 |
for($iii = 0; $iii < count($sub_cat_ids); $iii++) |
512 | 529 |
{ |
513 | 530 |
for($ii = 0; $ii < count($cat_ids); $ii++) |