本文整理汇总了PHP中common_node::getTaxonomyForNode方法的典型用法代码示例。如果您正苦于以下问题:PHP common_node::getTaxonomyForNode方法的具体用法?PHP common_node::getTaxonomyForNode怎么用?PHP common_node::getTaxonomyForNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_node
的用法示例。
在下文中一共展示了common_node::getTaxonomyForNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainAction
/**
* main action
*/
public function mainAction()
{
/**
* initialise
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
/**
* input data
*/
$node_id = $this->GET['id'];
if (is_numeric($this->GET['blog_node_id'])) {
$blog_node_id = $this->GET['blog_node_id'];
} else {
$blog_node_id = $Node->conf['id_map-blog'];
}
/**
* get node detail
*/
$node_data = $Node->nodeDetail($node_id);
/**
* filtering
* TODO: support for multiple taxonomy
*
*/
if (is_numeric($this->GET['taxonomy_tree_id'])) {
$taxonomy_tree_id = $this->GET['taxonomy_tree_id'];
} else {
if ($taxonomy = $Node->getTaxonomyForNode($node_data['id'])) {
$taxonomy_tree_id = $taxonomy[0];
} else {
$taxonomy_tree_id = '';
}
}
if (is_numeric($this->GET['limit_from']) && is_numeric($this->GET['limit_per_page'])) {
$limit_from = $this->GET['limit_from'];
$limit_per_page = $this->GET['limit_per_page'];
} else {
if (is_numeric($node_data['component']['limit'])) {
$limit_from = 0;
$limit_per_page = $node_data['component']['limit'];
} else {
$limit_from = '';
$limit_per_page = '';
}
}
/**
* template
*/
switch ($node_data['component']['template']) {
case 'full':
$template = 'news_list';
break;
case 'teaser':
$template = 'news_list_teaser';
break;
case 'grid':
$template = 'news_list_grid';
break;
case 'stack':
$template = 'news_list_stack';
break;
case 'latest':
default:
$template = 'news_list_latest';
break;
}
/**
* pagination
*/
if ($node_data['component']['pagination'] == 1) {
$display_pagination = 1;
} else {
$display_pagination = 0;
}
/**
* image size
*/
$image_o = $this->getImageSizeOptions($node_data);
/**
* call controller
*/
$_Onxshop = new Onxshop_Request("component/{$template}~blog_node_id={$blog_node_id}:id={$node_id}:limit_from={$limit_from}:limit_per_page={$limit_per_page}:display_pagination={$display_pagination}:publish=1:taxonomy_tree_id={$taxonomy_tree_id}:image_width={$image_o['width']}:image_height={$image_o['height']}:image_fill={$image_o['fill']}~");
$this->tpl->assign('NEWS_LIST', $_Onxshop->getContent());
$this->tpl->assign('NODE', $node_data);
/**
* display title
*/
$this->displayTitle($node_data);
return true;
}
示例2: mainAction
/**
* main action
*/
public function mainAction()
{
/**
* initialize node
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
$node_data = $Node->nodeDetail($this->GET['id']);
$taxonomy_ids = $Node->getTaxonomyForNode($node_data['id']);
if (is_array($node_data['component']['related']) || count($taxonomy_ids) > 0) {
/**
* prepare HTTP query for product_list component
*/
$product_id_list = array();
if (count($node_data['component']['related']) > 0) {
foreach ($node_data['component']['related'] as $item) {
if (is_numeric($item)) {
$product_id_list[] = $item;
}
}
}
/**
* Get product id list by category if catogory specified
*/
$this->extentProductIdListByTaxonomy($taxonomy_ids, $product_id_list);
/**
* build query
*/
$query_raw = array();
// sorting
if ($node_data['component']['display_sorting'] == 1) {
$query_raw['display_sorting'] = 1;
}
// force sorting as listed
$query_raw['product_id_list_force_sorting_as_listed'] = 1;
// image role
if ($node_data['component']['image_role']) {
$query_raw['image_role'] = $node_data['component']['image_role'];
}
// image width
if ($node_data['component']['image_width'] > 0) {
$query_raw['image_width'] = $node_data['component']['image_width'];
}
/**
* product_id_list
*/
$query_raw['product_id_list'] = $product_id_list;
//dont continue if list is empty
if (count($query_raw['product_id_list']) == 0) {
return true;
}
$query = http_build_query($query_raw, '', ':');
/**
* detect controller for product list
*/
switch ($node_data['component']['template']) {
case 'stack':
$controller = 'product_list_stack';
break;
case 'scroll':
$controller = 'product_list_scroll';
break;
case '6col':
$controller = 'product_list_6columns';
break;
case '5col':
$controller = 'product_list_5columns';
break;
case '4col':
$controller = 'product_list_4columns';
break;
case '3col':
$controller = 'product_list_3columns';
break;
case '2col':
$controller = 'product_list_2columns';
break;
case '1col':
default:
$controller = 'product_list_shelf';
break;
}
/**
* call controller
*/
$_Onxshop_Request = new Onxshop_Request("component/ecommerce/{$controller}~{$query}~");
$this->tpl->assign('PRODUCT_LIST', $_Onxshop_Request->getContent());
}
$this->tpl->assign('NODE', $node_data);
if ($node_data['display_title']) {
$this->tpl->parse('content.title');
}
return true;
}
示例3: getProductVarietyList
/**
* get product variety list
*
* check requested list
* can be product_id_list or node_id
* if node_id not provided, use first parent page
*/
function getProductVarietyList()
{
$filter = array();
//this filter option will ensure listing only enabled products and varieties
$filter['publish'] = 1;
//image role filter
if (in_array($this->GET['image_role'], array('default', 'teaser', 'feature', 'background', 'RTE'))) {
$filter['image_role'] = $this->GET['image_role'];
} else {
$filter['image_role'] = 'main';
}
$this->tpl->assign('IMAGE_ROLE', $filter['image_role']);
if (is_array($this->GET['product_id_list'])) {
/*
passed from this controllers:
./component/ecommerce/best_buys.php
./component/ecommerce/recently_viewed_products.php
./component/ecommerce/product_related_basket.php
./component/ecommerce/product_related_to_customer.php
./component/ecommerce/product_related.php
*/
$filter['product_id_list'] = $this->GET['product_id_list'];
$product_variety_list = $this->Product->getFilteredProductList($filter, GLOBAL_LOCALE_CURRENCY);
/**
* modify priority according sort of product_id_list
*/
if ($this->GET['product_id_list_force_sorting_as_listed']) {
foreach ($product_variety_list as $key => $item) {
$product_variety_list[$key]['priority'] = 1000 - array_search($item['product_id'], $this->GET['product_id_list']);
}
}
} else {
/**
* initialize node
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
/**
* Find node_id
* 1. can be provided
* 2. detected from place where the component sits
*/
if (is_numeric($this->GET['id'])) {
$node_id = $this->GET['id'];
//TODO find first parent page from given "id"
//$node_id = $Node->getFirstParentPage($_SESSION['active_pages']);
} else {
$node_id = $Node->getFirstParentPage($_SESSION['active_pages']);
//don't continue if node_id is not numeric (i.e. empty SESSION.active_pages)
if (!is_numeric($node_id)) {
return false;
}
}
/**
* filter, find if taxonomy is set for node
*/
if ($this->GET['taxonomy_tree_id']) {
$taxonomy = explode(",", $this->GET['taxonomy_tree_id']);
if (count($taxonomy) > 0 && is_numeric($taxonomy[0])) {
$filter['taxonomy_json'] = json_encode($taxonomy);
}
} else {
if ($taxonomy = $Node->getTaxonomyForNode($node_id)) {
//add extra taxonomy filter
$taxonomy = $this->addTaxonomyFilter($taxonomy);
$filter['taxonomy_json'] = json_encode($taxonomy);
} else {
//add taxonomy filter from session or POST
$taxonomy = $this->addTaxonomyFilter();
if (count($taxonomy) > 0) {
$filter['taxonomy_json'] = json_encode($taxonomy);
}
}
}
/**
* add keyword filter
*/
$filter['keyword'] = $this->addKeywordFilter();
/**
* fallback to listing products which homepage is under the node_id
*/
if (empty($filter['taxonomy_json']) && empty($filter['keyword'])) {
$filter['node_id'] = $node_id;
}
/**
* get product list
*
*/
$product_variety_list = $this->Product->getFilteredProductList($filter, GLOBAL_LOCALE_CURRENCY);
}
//print_r($product_variety_list);
return $product_variety_list;
}