function olc_get_subcategories(&$subcategories_array, $parent_id = 0) { $subcategories_query = olc_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . $parent_id . APOS); while ($subcategories = olc_db_fetch_array($subcategories_query)) { $subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id']; if ($subcategories['categories_id'] != $parent_id) { olc_get_subcategories($subcategories_array, $subcategories['categories_id']); } } }
if (!isset($_SESSION['customer_country_id'])) { $_SESSION['customer_country_id'] = STORE_COUNTRY; $_SESSION['customer_zone_id'] = STORE_ZONE; } */ $from_str .= "\n\t\t\tleft join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id\n\t\t\tleft join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id=gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id='0' or gz.zone_country_id='" . CUSTOMER_COUNTRY_ID . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . CUSTOMER_ZONE_ID . "')"; } if (DO_GROUP_CHECK) { $group_check = " and p." . SQL_GROUP_CONDITION; } $where_str = "\n\twhere\n\tp.products_status = 1 " . $fsk_lock . " and\n\tp.products_id = pd.products_id\n\tand pd.language_id = " . SESSION_LANGUAGE_ID . "\n\tand p.products_id = p2c.products_id\n\t" . $group_check . "\n\tand p2c.categories_id = c.categories_id "; if (isset($categories_id)) { $where_str .= "\n\t\tand p2c.products_id = p.products_id\n\t\tand p2c.products_id = pd.products_id\n\t\tand pd.language_id = " . SESSION_LANGUAGE_ID . "\n\t\tand p2c.categories_id "; if ($inc_subcat == '1') { $subcategories_array = array(); olc_get_subcategories($subcategories_array, $categories_id); $where_str .= "in " . LPAREN . $categories_id; for ($i = 0, $n = sizeof($subcategories_array); $i < $n; $i++) { $where_str .= COMMA . $subcategories_array[$i]; } $where_str .= RPAREN; } else { $where_str .= EQUAL . $categories_id; } } if (isset($_GET['manufacturers_id'])) { $where_str .= " and m.manufacturers_id = '" . $_GET['manufacturers_id'] . APOS; } if (isset($keywords)) { if (olc_parse_search_string(stripslashes($keywords), $search_keywords)) { $where_str .= " and (";