本文整理匯總了PHP中Family::GetTree方法的典型用法代碼示例。如果您正苦於以下問題:PHP Family::GetTree方法的具體用法?PHP Family::GetTree怎麽用?PHP Family::GetTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Family
的用法示例。
在下文中一共展示了Family::GetTree方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMenuTree
/**
* 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;
}