$m_return ='';
$L = Core_Language::getInstance();
$DB = Core_Database::getInstance();
$P = new Common_Page();
$lang = $L->getCurrentLanguage();
$uri = parse_url($_SERVER['REQUEST_URI']);
$folder = array_values(Tools_Arrays::removeEmptyArrVal(explode('/',$uri['path'])));
$ff = isset($folder[1]) ? $folder[1] : 'shop';
//print_r($ff);
//print_r($ff);
//echo $ff;
$menu = $P->getPageList(8,0,true);
$pgeid = $P->getPageId();
$folderid = Tools_Http::Get('folder',true);
$product_catid = defined('catid') ? catid : 0;
$menu_items = array();
if (!empty($menu) && $ff == 'service') {
$m_return .= '
';
}
if($ff == 'shop') {
$cat= new Products_Categories();
$list = $cat->getList(-1, 'active',$lang);
//$list = array();
$cats = array();
foreach($list as $row) {
$all_cats[$row['id']] = array('id'=>$row['id'], 'name'=>$row['id'].'_'.Tools_Text::cleanString($row['cat_name']),'parentid'=>$row['parentid']);
}
$path = '';
function get_path_names_array($id,$cats) {
$path= array();
while ($id!=0) {
//echo $cat.'
';
if(!isset($cats[$id]))
return array();;
$sub_cat = $cats[$id]['parentid'];
$name = $cats[$id]['name'];
$path[]=$name;
if($id==$sub_cat)
return array();
$id=$sub_cat;
$cat=$id;
}
$path=array_reverse($path);
return $path;
}
foreach($list as $cats) {
$l = get_path_names_array($cats['id'],$all_cats);
if(!empty($l)) {
$l = implode('/',$l);
$link = '/'.$lang.'/shop/'.$l.'/';
} else $link ='';
$cats['link']=$link;
$cats['title'] = $cats['cat_name'];
$cats ['type'] = $cats ['id']==$product_catid ? 'finalcat' : 'notfinal';
if($cats['image'])
$cats['image'] = '/images/category/'.$cats['image'];
else
$cats['image'] = '/images/common/watermark2.png';
$cats_array[$cats['parentid']][] = $cats;
if($cats['parentid2'])
$cats_array[$cats['parentid2']][] = $cats;
if($cats['parentid3'])
$cats_array[$cats['parentid2']][] = $cats;
}
ob_start(); ?>
foreach($cats_array[0] as $key => $arr) {
?>
- ">
=$arr['title']?>
if( !empty($cats_array[$arr['id']])) { ?>
} ?>
} ?>
$data = ob_get_clean();
// $l = $cat -> getPathId($product_catid, 'sef',$lang);
$m_return = $data;
}