本文整理汇总了PHP中zen_get_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_categories函数的具体用法?PHP zen_get_categories怎么用?PHP zen_get_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_categories函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zen_get_categories
function zen_get_categories($parent_id = '0', $indent = ' ', $status_setting = '1')
{
global $db;
$categories_array = array();
// show based on status
if ($status_setting != '') {
$zc_status = " c.categories_status='" . (int) $status_setting . "' and ";
} else {
$zc_status = '';
}
$categories_query = "select c.categories_id, cd.categories_name, c.categories_status\n from categories c, categories_description cd\n where " . $zc_status . "\n parent_id = '" . (int) $parent_id . "'\n and c.categories_id = cd.categories_id\n and cd.language_id = '3'\n order by sort_order, cd.categories_name";
$categories = $db->getAll($categories_query);
if ($categories) {
foreach ($categories as $row) {
$categories_array[$row['categories_id']] = array('id' => $row['categories_id'], 'text' => $indent . $row['categories_name']);
if ($row['categories_id'] != $parent_id) {
$categories_array[$row['categories_id']]['children'] = zen_get_categories($row['categories_id'], $indent . ' ', $status_setting);
}
}
}
return $categories_array;
}
示例2: zen_get_categories
function zen_get_categories($categories_array = '', $parent_id = '0', $indent = '', $status_setting = '')
{
global $db;
if (!is_array($categories_array)) {
$categories_array = array();
}
// show based on status
if ($status_setting != '') {
$zc_status = " c.categories_status='" . $status_setting . "' and ";
} else {
$zc_status = '';
}
$categories_query = "select c.categories_id, cd.categories_name, c.categories_status\r\n from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd\r\n where " . $zc_status . "\r\n parent_id = '" . (int) $parent_id . "'\r\n and c.categories_id = cd.categories_id\r\n and cd.language_id = '" . (int) $_SESSION['languages_id'] . "'\r\n order by sort_order, cd.categories_name";
$categories = $db->Execute($categories_query);
while (!$categories->EOF) {
$categories_array[] = array('id' => $categories->fields['categories_id'], 'text' => $indent . $categories->fields['categories_name']);
if ($categories->fields['categories_id'] != $parent_id) {
$categories_array = zen_get_categories($categories_array, $categories->fields['categories_id'], $indent . ' ', '1');
}
$categories->MoveNext();
}
return $categories_array;
}
示例3: die
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$title = '';
$current_sub_categories = array();
if ($number_of_categories == 0) {
unset($sub_categories);
zen_get_parent_categories($sub_categories, $current_category_id);
//$current_sub_categories = $sub_categories;
//echo '<pre>';print_r($current_sub_categories);exit;
if (!empty($sub_categories)) {
$pc_id = $sub_categories[0];
$subcategories_array = zen_get_categories('', $pc_id);
$arr = array();
foreach ($subcategories_array as $key => $val) {
$arr[] = $val['id'];
}
if (count($arr)) {
$id_str = implode(",", $arr);
$categories_query = "select c.categories_id,c.categories_image,cd.categories_name\n\t\t\t from categories c\n\t\t\t inner join categories_description cd on c.categories_id=cd.categories_id\n\t\t\t where c.categories_id in (" . $id_str . ") and c.categories_status=1";
$categories = $db->Execute($categories_query);
$number_of_categories = $categories->RecordCount();
}
} else {
zen_get_subcategories($subcategories_array, $current_category_id);
//echo '<pre>';print_r($subcategories_array);exit;
// $pc_id = $sub_categories[0];
// $subcategories_array = zen_get_categories('',$pc_id);
示例4: zen_get_categories
function zen_get_categories($categories_array = '', $parent_id = '0', $indent = '')
{
global $db;
if (!is_array($categories_array)) {
$categories_array = array();
}
$categories_query = "select c.categories_id, cd.categories_name\n from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd\n where parent_id = '" . (int) $parent_id . "'\n and c.categories_id = cd.categories_id\n and cd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n order by sort_order, cd.categories_name";
$categories = $db->Execute($categories_query);
while (!$categories->EOF) {
$categories_array[] = array('id' => $categories->fields['categories_id'], 'text' => $indent . $categories->fields['categories_name']);
if ($categories->fields['categories_id'] != $parent_id) {
$categories_array = zen_get_categories($categories_array, $categories->fields['categories_id'], $indent . ' ');
}
$categories->MoveNext();
}
return $categories_array;
}
示例5: zen_draw_checkbox_field
?>
<?php
echo zen_draw_checkbox_field('search_in_description', '1', $form_vars['search_in_description'], 'id="search-in-description"');
?>
<label class="checkboxLabel" for="search-in-description"><?php
echo MODULE_SEARCH_MORE_TEXT_SEARCH_IN_DESCRIPTION;
?>
</label></td>
</tr>
<tr>
<th scope="row"><?php
echo MODULE_SEARCH_MORE_ENTRY_CATEGORIES;
?>
</th>
<td><?php
echo zen_draw_pull_down_menu('categories_id', zen_get_categories(array(array('id' => '', 'text' => MODULE_SEARCH_MORE_TEXT_ALL_CATEGORIES)), 0, '', '1'), $form_vars['categories_id']);
echo zen_draw_checkbox_field('inc_subcat', '1', $form_vars['inc_subcat'], 'id="inc-subcat"');
?>
<label class="checkboxLabel" for="inc-subcat"><?php
echo MODULE_SEARCH_MORE_ENTRY_INCLUDE_SUBCATEGORIES;
?>
</label></td>
</tr>
<tr>
<th scope="row"><?php
echo MODULE_SEARCH_MORE_ENTRY_MANUFACTURERS;
?>
</th>
<td><?php
echo zen_draw_pull_down_menu('manufacturers_id', zen_get_manufacturers(array(array('id' => '', 'text' => MODULE_SEARCH_MORE_TEXT_ALL_MANUFACTURERS))));
?>
示例6: zen_draw_checkbox_field
echo zen_draw_checkbox_field('search_in_description', '1', $sData['search_in_description'], 'id="search-in-description"');
?>
<label class="checkboxLabel" for="search-in-description"><?php
echo TEXT_SEARCH_IN_DESCRIPTION;
?>
</label></div>
<br class="clear" />
</fieldset>
<fieldset class="floatingBox fl">
<legend><?php
echo ENTRY_CATEGORIES;
?>
</legend>
<div class="floatLeft"><?php
echo zen_draw_pull_down_menu('categories_id', zen_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)), '0', '', '1'), $sData['categories_id']);
?>
</div>
<?php
echo zen_draw_checkbox_field('inc_subcat', '1', $sData['inc_subcat'], 'id="inc-subcat"');
?>
<label class="checkboxLabel" for="inc-subcat"><?php
echo ENTRY_INCLUDE_SUBCATEGORIES;
?>
</label>
<br class="clear" />
</fieldset>
<fieldset class="floatingBox fr">
<legend><?php
echo ENTRY_MANUFACTURERS;
示例7: zen_get_categories
<?php
include 'includes/init.php';
include 'includes/add_product_base.php';
include 'includes/product_attr_model.php';
$act = $_REQUEST['act'] ? $_REQUEST['act'] : '';
$all_categories = zen_get_categories();
//getAttrValues
if ($act == 'getAttrValues') {
$attr_id = $_REQUEST['attr_id'] ? $_REQUEST['attr_id'] : '0';
$attr_model = new ProductAttrModel();
$attr_values = $attr_model->getAttributeValues($attr_id);
$result = array('status' => 'success', 'content' => $attr_values);
die(json_encode($result));
}
if ($act == 'save_detail') {
$is_added_by_hand = true;
include 'add_product_init.php';
$is_set_attr = $_POST['is_set_attr'] ? $_POST['is_set_attr'] : 0;
/**/
//产品主图----begin
//产品图片前面不能有images/
$products_image = trim($_REQUEST['products_image']);
$products_image = preg_replace('/\\?.*/i', '', $products_image);
//如果输入的产品图片是外站的url
if (preg_match("#^http(s?)://#", $products_image)) {
$new_products_image = date('Ymd') . '/' . date('YmdHis') . strrchr($products_image, '.');
if (!is_dir(dirname(IMAGE_PATH . $new_products_image))) {
@mkdir(dirname(IMAGE_PATH . $new_products_image), 0777, true);
}
if (!is_file(IMAGE_PATH . $new_products_image)) {
示例8: zen_get_categories
<?php
if ($i == 0) {
echo '/">';
} else {
echo '/category' . $catid . '_1.htm?cPath=' . $catid . '">';
}
echo $breadcrumb->_trail[$i]['title'];
?>
</a> >
<?php
}
?>
</h2>
<?php
$subcategories = zen_get_categories('', $current_category_id);
?>
<ul data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
<?php
for ($i = 0; $i < sizeof($subcategories); $i++) {
?>
<li class="ui-li ui-li-static ui-body-c"><a href="category<?php
echo $subcategories[$i]['id'];
?>
_1.htm?cPath=<?php
echo $current_category_id;
?>
_<?php
echo $subcategories[$i]['id'];
?>