Take Our Survey

Request a Callback
  • +91 22 2864 6464
  • Currency
  • USD
  • Home
  • Login | Register
  • MY Cart: (0) item
  • LiveZilla Live Chat Software
', $parent_group_end_string = ' ', $child_start_string = '
  • ', $child_end_string = '
  • ', $spacer_string = '', $spacer_multiplier = 1; function osC_CategoryTree($load_from_database = true) { global $languages_id; $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.parent_id, c.sort_order, cd.categories_name"); $this->data = array(); while ($categories = tep_db_fetch_array($categories_query)) { $this->data[$categories['parent_id']][$categories['categories_id']] = array('name' => $categories['categories_name'], 'count' => 0);} } //end class osC_CategoryTree function buildBranch($parent_id, $level = 0) { $result = $this->parent_group_start_string; //starts the
      tag if (isset($this->data[$parent_id])) { foreach ($this->data[$parent_id] as $category_id => $category) { $category_link = $category_id; $result .= $this->child_start_string; // prints
    • if (isset($this->data[$category_id])) {$result .= $this->parent_start_string;} //prints nothing if ($level == 0) {$result .= $this->root_start_string;} //prints nothing $cPath_new_vatwork = $category_link; $link = $this->vatworklink1($cPath_new_vatwork,"category"); $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level) . ''; $result .= $category['name']; $result .= ''; if ($level == 0) {$result .= $this->root_end_string;} //prints nothing if (isset($this->data[$category_id])) {$result .= $this->parent_end_string;} //prints
    if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) { $result .= $this->buildBranch($category_id, $level+1);} $result .= $this->child_end_string; //prints }// end foreach } // end if (isset $result .= $this->parent_group_end_string; // return $result; } //end function function vatworklink1($id="0",$poc="product") { if($poc == "product") { $product_id=$id; $products_query=tep_db_query("select pd.products_name,p.seo_keyword from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd where p.products_id=pd.products_id and p.products_id=".$product_id); if (tep_db_num_rows($products_query)) { $fetch_product=tep_db_fetch_array($products_query); if($fetch_product["seo_keyword"]!=""){ return str_replace(" ",'-',$fetch_product["seo_keyword"]); } else { return str_replace(" ","-",$fetch_product["products_name"]); } } } elseif($poc == "category") { //loop to find top level categories $categories_array['chiled_id'][0] = $id; $i = 0; //$categories_array['chiled_id'][$i] = ; while(true) { $sql = " SELECT categories_name AS c, parent_id AS d FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND c.categories_id = ".$categories_array['chiled_id'][$i]." AND cd.categories_id = ".$categories_array['chiled_id'][$i]." "; /*$rs = mysql_query($sql); $row = mysql_fetch_assoc($rs);*/ $rs = tep_db_query($sql); $row = tep_db_fetch_array($rs); $categories_array['categories_name'][$i] = $row['c']; $categories_array['parent_id'][$i] = $row['d']; if(0<$categories_array['parent_id'][$i])$categories_array['categories_id'][$i] = $row['d']; $i++; $categories_array['chiled_id'][$i] = $row['d']; if(0==$categories_array['chiled_id'][$i])break; if($i > 6) exit; } for($j=$i-1;0<=$j;--$j){ $link['categories_name'][] = strtr($categories_array['categories_name'][$j],"/","-"); $link['categories_id'][] = $categories_array['chiled_id'][$j]; } //$link['categories_name'] = strtr(implode("/",$link['categories_name'])," ","-"); $link['categories_name'] = str_replace(" ","", implode("/",$link['categories_name'])); $link['categories_id'] = implode("_",$link['categories_id']); $temp = $link['categories_name']; return strtolower($temp); } } function buildTree() { return $this->buildBranch($this->root_category_id);}} ?>