function olc_get_parent_categories(&$categories, $categories_id) { $parent_id_text = 'parent_id'; $parent_categories_query = olc_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $categories_id . APOS); while ($parent_categories = olc_db_fetch_array($parent_categories_query)) { if ($parent_categories[$parent_id_text] == 0) { return true; } else { $categories[sizeof($categories)] = $parent_categories[$parent_id_text]; if ($parent_categories[$parent_id_text] != $categories_id) { olc_get_parent_categories($categories, $parent_categories[$parent_id_text]); } } } }
function olc_get_product_path($products_id) { $cPath = EMPTY_STRING; $category_query = olc_db_query("\n\tselect\n\tp2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\twhere\n\tp.products_id = '" . (int) $products_id . "' and\n\tp.products_status = '1' and\n\tp.products_id = p2c.products_id\n\tlimit 1"); if (olc_db_num_rows($category_query)) { $category = olc_db_fetch_array($category_query); $categories_id = $category['categories_id']; $categories = array(); olc_get_parent_categories($categories, $categories_id); $categories = array_reverse($categories); $cPath = implode(UNDERSCORE, $categories); if ($cPath) { $cPath .= UNDERSCORE; } $cPath .= $categories_id; } return $cPath; }
function GetPath($products_id, $languages_id, &$cat_link) { $cat_id_sql = olc_db_query("select pc.categories_id, cd.categories_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " pc, " . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\t\twhere\n pc.products_id = '" . $products_id . "' and\n cd.categories_id = pc.categories_id and\n\t\t\tcd.language_id = '" . $languages_id . "' LIMIT 1"); if (olc_db_num_rows($cat_id_sql) > 0) { $cPath = EMPTY_STRING; $cat_link = EMPTY_STRING; $cat_id_data = olc_db_fetch_array($cat_id_sql); $categories = array(); olc_get_parent_categories($categories, $cat_id_data['categories_id']); $parent_id_sql0 = SELECT . "categories_name,categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '#' and language_id = '" . $languages_id . APOS; $size = sizeof($categories) - 1; for ($i = $size; $i >= 0; $i--) { $parent_id_sql = olc_db_query(str_replace(HASH, $categories[$i], $parent_id_sql0)); $parent_id_data = olc_db_fetch_array($parent_id_sql); if ($cPath != EMPTY_STRING) { $cPath .= ' > '; $cat_link .= "_"; } $cPath .= $parent_id_data['categories_name']; $cat_link .= $categories[$i]; } if ($cPath != EMPTY_STRING) { $cPath .= ' > '; $cat_link .= "_"; } $cPath .= $cat_id_data['categories_name']; $cat_link .= $cat_id_data['categories_id']; } return $cPath; }
} else { $have_multi_pic = true; $multi_pictures[] = $multi_picfile_name; } } if (!$have_multi_pic) { unset($multi_pictures); } } } // set values $product_id = $products_values[$product_id_text]; $auction_type = $products_values[$auction_type_text]; $cat_path = EMPTY_STRING; $categories_path = array(); olc_get_parent_categories($categories_path, $category_id); $categories_path[] = $category_id; for ($i = 0, $n = sizeof($categories_path); $i < $n; $i++) { if ($cat_path) { $cat_path .= DASH; } $cat = $seo_categories[$categories_path[$i]]; $cat = strtoupper(substr($cat, 0, 1)) . substr($cat, 1); $cat_path .= $cat; } $product_title = $cat_path . COLON . BLANK . $products_values[$title_text]; $product_title = str_replace(HTML_BR, BLANK, $product_title); $product_title = strip_tags($product_title); $product_subtitle = $products_values[$subtitle_text]; $product_subtitle = str_replace(HTML_BR, BLANK, $product_subtitle); $product_subtitle = strip_tags($product_subtitle);