function smn_get_parent_store_categories(&$store_categories, $store_categories_id)
 {
     $parent_store_categories_query = smn_db_query("select store_parent_id from " . TABLE_STORE_CATEGORIES . " where store_categories_id = '" . (int) $store_categories_id . "'");
     while ($parent_store_categories = smn_db_fetch_array($parent_store_categories_query)) {
         if ($parent_store_categories['store_parent_id'] == 0) {
             return true;
         }
         $store_categories[sizeof($store_categories)] = $parent_store_categories['store_parent_id'];
         if ($parent_store_categories['store_parent_id'] != $store_categories_id) {
             smn_get_parent_store_categories($store_categories, $parent_store_categories['store_parent_id']);
         }
     }
 }
Example #2
0
function smn_get_store_path($store_id)
{
    $sPath = '';
    $category_query = smn_db_query("select s2c.store_categories_id from " . TABLE_STORE_MAIN . " s, " . TABLE_STORE_TO_CATEGORIES . " s2c where s.store_id = '" . (int) $store_id . "' and s.store_status = '1' and s.store_id = s2c.store_id limit 1");
    if (smn_db_num_rows($store_category_query)) {
        $store_category = smn_db_fetch_array($store_category_query);
        $store_categories = array();
        smn_get_parent_store_categories($store_categories, $store_category['store_categories_id']);
        $store_categories = array_reverse($store_categories);
        $sPath = implode('_', $store_categories);
        if (smn_not_null($sPath)) {
            $sPath .= '_';
        }
        $sPath .= $store_category['store_categories_id'];
    }
    return $sPath;
}