📄 category_product_listing.php
字号:
<?php
/**
* @package admin
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: category_product_listing.php 3182 2006-03-14 04:27:33Z ajeh $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (isset($_GET['set_display_categories_dropdown'])) {
$_SESSION['display_categories_dropdown'] = $_GET['set_display_categories_dropdown'];
}
if (!isset($_SESSION['display_categories_dropdown'])) {
$_SESSION['display_categories_dropdown'] = 0;
}
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?> - <?php echo zen_output_generated_category_path($current_category_id); ?></td>
<td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
<td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="smallText" align="right">
<?php
echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
// show reset search
if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a> ';
}
echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
$keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
}
echo '</form>';
?>
</td>
</tr>
<tr>
<td class="smallText" align="right">
<?php
if ($_SESSION['display_categories_dropdown'] == 0) {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'cross.gif', IMAGE_ICON_STATUS_OFF) . '</a> ';
echo zen_draw_form('goto', FILENAME_CATEGORIES, '', 'get');
echo zen_hide_session_id();
echo HEADING_TITLE_GOTO . ' ' . zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
echo '</form>';
} else {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'tick.gif', IMAGE_ICON_STATUS_ON) . '</a> ';
echo HEADING_TITLE_GOTO;
}
?>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<?php if ($action == '') { ?>
<td class="dataTableHeadingContent" width="20" align="right"><?php echo TABLE_HEADING_ID; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>
<td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_MODEL; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE; ?></td>
<td class="dataTableHeadingContent" align="right"> </td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_QUANTITY; ?> </td>
<td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CATEGORIES_SORT_ORDER; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
<?php } // action == '' ?>
</tr>
<?php
switch ($_SESSION['categories_products_sort_order']) {
case (0):
$order_by = " order by c.sort_order, cd.categories_name";
break;
case (1):
$order_by = " order by cd.categories_name";
case (2);
case (3);
case (4);
case (5);
case (6);
}
$categories_count = 0;
$rows = 0;
if (isset($_GET['search'])) {
$search = zen_db_prepare_input($_GET['search']);
$categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
c.parent_id, c.sort_order, c.date_added, c.last_modified,
c.categories_status
from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
where c.categories_id = cd.categories_id
and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and cd.categories_name like '%" . zen_db_input($search) . "%'" .
$order_by);
} else {
$categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
c.parent_id, c.sort_order, c.date_added, c.last_modified,
c.categories_status
from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
where c.parent_id = '" . (int)$current_category_id . "'
and c.categories_id = cd.categories_id
and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
$order_by);
}
while (!$categories->EOF) {
$categories_count++;
$rows++;
// Get parent_id for subcategories if search
if (isset($_GET['search'])) $cPath = $categories->fields['parent_id'];
if ((!isset($_GET['cID']) && !isset($_GET['pID']) || (isset($_GET['cID']) && ($_GET['cID'] == $categories->fields['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
//$category_childs = array('childs_count' => zen_childs_in_category_count($categories->fields['categories_id']));
//$category_products = array('products_count' => zen_products_in_category_count($categories->fields['categories_id']));
//$cInfo_array = array_merge($categories->fields, $category_childs, $category_products);
$cInfo = new objectInfo($categories->fields);
}
if (isset($cInfo) && is_object($cInfo) && ($categories->fields['categories_id'] == $cInfo->categories_id) ) {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '\'">' . "\n";
}
?>
<?php if ($action == '') { ?>
<td class="dataTableContent" width="20" align="right"><?php echo $categories->fields['categories_id']; ?></td>
<td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '">' . zen_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a> <b>' . $categories->fields['categories_name'] . '</b>'; ?></td>
<td class="dataTableContent" align="center"> </td>
<td class="dataTableContent" align="right"> <?php echo zen_get_products_sale_discount('', $categories->fields['categories_id'], true); ?></td>
<td class="dataTableContent" align="center"> </td>
<td class="dataTableContent" align="right" valign="bottom">
<?php
if (SHOW_COUNTS_ADMIN == 'false') {
// don't show counts
} else {
// show counts
$total_products = zen_get_products_to_categories($categories->fields['categories_id'], true);
$total_products_on = zen_get_products_to_categories($categories->fields['categories_id'], false);
echo $total_products_on . TEXT_PRODUCTS_STATUS_ON_OF . $total_products . TEXT_PRODUCTS_STATUS_ACTIVE;
}
?>
</td>
<td class="dataTableContent" width="50" align="left">
<?php
if ($categories->fields['categories_status'] == '1') {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
} else {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
}
if (zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active') == 'true') {
echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED);
}
?>
</td>
<td class="dataTableContent" align="right"><?php echo $categories->fields['sort_order']; ?></td>
<td class="dataTableContent" align="right">
<?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
<?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=delete_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
<?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=move_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . '</a>'; ?>
<?php
// bof: categories meta tags
if (zen_get_category_metatags_keywords($categories->fields['categories_id'], (int)$_SESSION['languages_id']) or zen_get_category_metatags_description($categories->fields['categories_id'], (int)$_SESSION['languages_id'])) {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '</a>';
} else {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '</a>';
}
// eof: categories meta tags
?>
</td>
<?php } // action == '' ?>
</tr>
<?php
$categories->MoveNext();
}
switch ($_SESSION['categories_products_sort_order']) {
case (0):
$order_by = " order by p.products_sort_order, pd.products_name";
break;
case (1):
$order_by = " order by pd.products_name";
break;
case (2);
$order_by = " order by p.products_model";
break;
case (3);
$order_by = " order by p.products_quantity, pd.products_name";
break;
case (4);
$order_by = " order by p.products_quantity DESC, pd.products_name";
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -