本文整理汇总了PHP中Model_Category::getNode方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Category::getNode方法的具体用法?PHP Model_Category::getNode怎么用?PHP Model_Category::getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Category
的用法示例。
在下文中一共展示了Model_Category::getNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCart
public function getCart($userId)
{
$result = DB::select()->from($this->tableName)->where('user', '=', $userId)->group_by('mid')->execute()->as_array();
$material = new Model_Material('groups');
$category = new Model_Category('tree');
$base = new Model_Base();
$arr = array();
foreach ($result as $item) {
//var_dump($item);
//название модели
$materialData = $material->getMaterial($item['mid']);
$arr[$item['mid']]['name'] = $materialData['name'];
$arr[$item['mid']]['mid'] = $item['mid'];
//url модели
$categoryName = $category->getNode($material->getTreeIdByMid($item['mid']));
$categoryName = $base->str2url($categoryName['name']);
$arr[$item['mid']]['url'] = $categoryName . '/' . $materialData['url'] . '.html';
//Изображение
$fields = $material->getFields($item['mid'], true);
$arr[$item['mid']]['img'] = $fields['Photos'][0];
//количество
$arr[$item['mid']]['count'] = $this->getCartCount($userId, $item['mid']);
//сумма
$arr[$item['mid']]['sum'] = $this->getCartPrice($userId, $item['mid']);
//размер
$arr[$item['mid']]['size'] = $item['size'];
//цвет
$arr[$item['mid']]['color'] = $item['color'];
}
return $arr;
}
示例2: getParentNode
public function getParentNode($mid)
{
$nodes = array();
//получаем id группы
$treeId = $this->getTreeIdByMid($mid);
$category = new Model_Category('tree');
$tree = $category->getNode($treeId);
$nodes[] = $tree['url'];
return implode('/', $nodes);
}
示例3: action_graph
public function action_graph($options = array("parent_id" => 4))
{
$this->setopt(array("name" => "parent_id", "description" => "Ид каталога", "default" => $options["parent_id"]));
$parent_id = $this->getopt("parent_id");
$model = array("items" => array());
$model_tree = new Model_Widgets_Menu('tree');
$category = new Model_Category('tree');
$parent_node = $category->getNode($parent_id);
$level = $parent_node["level"];
//Получаем список меню
$items = $model_tree->menuItems($parent_id, $level + 1);
foreach ($items as $key => $item) {
$this_category = $category->getCategory($category->getCategoryIdByUrl($item['url']));
$category_id = $this_category['id'];
$cat_photo = '/img/user/menu/' . $category_id . '_' . $item['url'];
$cat_photo_path_jpg = $cat_photo . ".jpg";
$cat_photo_path_png = $cat_photo . ".png";
$cat_photo_path = "/img/noimg.png";
if (file_exists(DOCROOT . $cat_photo_path_jpg)) {
$cat_photo_path = $cat_photo_path_jpg;
} elseif (file_exists(DOCROOT . $cat_photo_path_png)) {
$cat_photo_path = $cat_photo_path_png;
}
$model["items"][] = array("href" => "/" . $item["parent"] . "/" . $item["url"], "photo" => Route::url('miniimg3', array('filename' => $cat_photo_path)), "name" => $item["name"]);
}
$this->set_template("widgets/menu/graph.php", "twig")->render($model)->body();
}