本文整理汇总了PHP中tep_get_parent_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_parent_categories函数的具体用法?PHP tep_get_parent_categories怎么用?PHP tep_get_parent_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_parent_categories函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tep_get_parent_categories
function tep_get_parent_categories(&$categories, $categories_id)
{
$parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int) $categories_id . "'");
while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
if ($parent_categories['parent_id'] == 0) {
return true;
}
$categories[sizeof($categories)] = $parent_categories['parent_id'];
if ($parent_categories['parent_id'] != $categories_id) {
tep_get_parent_categories($categories, $parent_categories['parent_id']);
}
}
}
示例2: osC_CategoryTree
function osC_CategoryTree($load_from_database = true)
{
global $languages_id;
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' order by c.parent_id, c.sort_order, cd.categories_name");
$this->data = array();
while ($categories = tep_db_fetch_array($categories_query)) {
// Ultimate SEO URLs compatibility - Chemo
# initialize array container
$c = array();
# Get the category path, $c is passed by reference
tep_get_parent_categories($c, $categories['categories_id']);
# For some reason it seems to return in reverse order so reverse the array
$c = array_reverse($c);
# Implode the array to get the full category path
$id = implode('_', $c) ? implode('_', $c) . '_' . $categories['categories_id'] : $categories['categories_id'];
$this->data[$categories['parent_id']][$id] = array('name' => $categories['categories_name'], 'count' => 0);
}
}
示例3: tep_get_product_path
function tep_get_product_path($products_id)
{
$cPath = '';
$category_query = tep_db_query("select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id limit 1");
if (tep_db_num_rows($category_query)) {
$category = tep_db_fetch_array($category_query);
$categories = array();
tep_get_parent_categories($categories, $category['categories_id']);
$categories = array_reverse($categories);
$cPath = implode('_', $categories);
if (tep_not_null($cPath)) {
$cPath .= '_';
}
$cPath .= $category['categories_id'];
}
return $cPath;
}
示例4: get_category_path
private function get_category_path($category_id)
{
if (tep_not_null($category_id)) {
$cPath_new = '';
$categories = array();
// Initialize the array so the function doesn't complain
tep_get_parent_categories($categories, $category_id);
$categories = array_reverse($categories);
$cPath_new .= implode('_', $categories);
if (tep_not_null($cPath_new)) {
$cPath_new .= '_';
}
$cPath_new .= $category_id;
return 'cPath=' . $cPath_new;
}
return false;
}
示例5: tep_get_product_path
function tep_get_product_path($products_id)
{
$OSCOM_Db = Registry::get('Db');
$cPath = '';
$Qcategory = $OSCOM_Db->prepare('select p2c.categories_id from :table_products p, :table_products_to_categories p2c where p.products_id = :products_id and p.products_status = 1 and p.products_id = p2c.products_id limit 1');
$Qcategory->bindInt(':products_id', $products_id);
$Qcategory->execute();
if ($Qcategory->fetch() !== false) {
$categories = array();
tep_get_parent_categories($categories, $Qcategory->valueInt('categories_id'));
$categories = array_reverse($categories);
$cPath = implode('_', $categories);
if (tep_not_null($cPath)) {
$cPath .= '_';
}
$cPath .= $Qcategory->valueInt('categories_id');
}
return $cPath;
}
示例6: tep_get_product_path
function tep_get_product_path($products_id)
{
global $osC_Database;
$cPath = '';
$Qcategory = $osC_Database->query('select p2c.categories_id from :table_products p, :table_products_to_categories p2c where p.products_id = :products_id and p.products_status = :products_status and p.products_id = p2c.products_id limit 1');
$Qcategory->bindTable(':table_products', TABLE_PRODUCTS);
$Qcategory->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qcategory->bindInt(':products_id', $products_id);
$Qcategory->bindInt(':products_status', 1);
$Qcategory->execute();
if ($Qcategory->numberOfRows()) {
$categories = array();
tep_get_parent_categories($categories, $Qcategory->valueInt('categories_id'));
$categories = array_reverse($categories);
$cPath = implode('_', $categories);
if (tep_not_null($cPath)) {
$cPath .= '_';
}
$cPath .= $Qcategory->valueInt('categories_id');
}
return $cPath;
}