/** * Sitemap */ public function actionMap() { $tdata = Category::GetTree(true); $arrCustomPages = CustomPage::model()->activetabs()->findAll(); $arrProducts = array(); $this->render('map', array('tdata' => $tdata, 'arrProducts' => $arrProducts, 'arrCustomPages' => $arrCustomPages)); }
/** * Build array combining product categories, families and Custom Pages. * * @return array */ public function getMenuTree() { $categoryTree = Category::GetTree(); $extraTopLevelItems = CustomPage::GetTree(); // Whether the families (aka. manufacturers) are displayed the product menu. // ENABLE_FAMILIES: // 0 => No families in the product menu. // 1 => Separate menu item at bottom of product menu. // 2 => Separate menu item at top of product menu. // 3 => Blended into the top level of the menu. // if (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) > 0) { $familyTree = Family::GetTree(); if (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) === 3) { $extraTopLevelItems += $familyTree; } } // The behaviour varies here because OnSite customers are able to // configure the menu_position of their categories. A more thorough // solution might modify the menu code to return the menu_position for // each menu item for sorting, however Categories should already be // sorted by menu_position. if (CPropertyValue::ensureInteger(Yii::app()->params['LIGHTSPEED_CLOUD']) !== 0) { // Retail: Sort the entire menu alphabetically. $objTree = $categoryTree + $extraTopLevelItems; ksort($objTree); } else { // OnSite: Only sort the extras alphabetically (categories are // already sorted by menu_position). ksort($extraTopLevelItems); $objTree = $categoryTree + $extraTopLevelItems; } if (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) === 1 || CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) === 2) { $familyMenu['families_brands_menu'] = array('text' => CHtml::link(Yii::t('category', Yii::app()->params['ENABLE_FAMILIES_MENU_LABEL']), $this->createUrl("search/browse", array('brand' => '*'))), 'label' => Yii::t('category', Yii::app()->params['ENABLE_FAMILIES_MENU_LABEL']), 'link' => $this->createUrl("search/browse", array('brand' => '*')), 'url' => $this->createUrl("search/browse", array('brand' => '*')), 'id' => 0, 'child_count' => count($familyTree), 'hasChildren' => 1, 'children' => $familyTree, 'items' => $familyTree); if (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) === 1) { // The manufacturers menu is at the bottom. $objTree = $objTree + $familyMenu; } elseif (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_FAMILIES']) === 2) { // The manufacturers menu is at the top. $objTree = $familyMenu + $objTree; } } $this->_objFullTree = $objTree; return $this->_objFullTree; }
jQuery("#category-tree1").treeview({'animated':'fast','collapsed':false}); }); /*]]>*/ </script> <?php echo CHtml::endForm(); ?> <div style="display:none"> <?php $category = Category::GetTree(); ?> <?php $category[0]['expanded'] = 'open'; ?> <?php $this->widget('CTreeView', array('id' => 'sitemap-category-tree', 'data' => Category::GetTree(), 'animated' => 'fast', 'collapsed' => true, 'htmlOptions' => array('class' => 'filetree'))); ?> </div> <script> function goBack(){ window.history.back() } </script> <style type="text/css"> a.no-decoration{ text-decoration:none !important;color:#000;cursor:default;} .treeview ul{background:none !important;} .checkbox-tree{border:1px solid red;margin:0px 5px 0px 0px !important;} #category-tree1 ul li a{} .treeview .hitarea{ position: absolute;