|
|
|
|
|
|
|
|
|
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 ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
fields['categories_id']; ?> |
fields['categories_id'])) . '">' . zen_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . ' ' . $categories->fields['categories_name'] . ''; ?> |
|
fields['categories_id'], true); ?> |
|
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;
}
?>
|
fields['categories_status'] == '1') {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '';
} else {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '';
}
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);
}
?>
|
fields['sort_order']; ?> |
fields['categories_id'] . '&action=edit_category' . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?>
fields['categories_id'] . '&action=delete_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?>
fields['categories_id'] . '&action=move_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . ''; ?>
fields['categories_id'], (int)$_SESSION['languages_id']) or zen_get_category_metatags_description($categories->fields['categories_id'], (int)$_SESSION['languages_id'])) {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '';
} else {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '';
}
// eof: categories meta tags
?>
|
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;
case (5);
$order_by = " order by p.products_price_sorter, pd.products_name";
break;
case (6);
$order_by = " order by p.products_price_sorter DESC, pd.products_name";
break;
}
$products_count = 0;
if (isset($_GET['search']) && !empty($_GET['search']) && $action != 'edit_category') {
// fix duplicates and force search to use master_categories_id
/*
$products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
p.products_image, p.products_price, p.products_date_added,
p.products_last_modified, p.products_date_available,
p.products_status, p2c.categories_id,
p.products_model,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
p.products_quantity_order_max, p.products_sort_order
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and (
pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
$order_by);
*/
$products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
p.products_image, p.products_price, p.products_date_added,
p.products_last_modified, p.products_date_available,
p.products_status, p2c.categories_id,
p.products_model,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
p.products_quantity_order_max, p.products_sort_order,
p.master_categories_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and (p.products_id = p2c.products_id
and p.master_categories_id = p2c.categories_id)
and (
pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
or p.products_id = '" . zen_db_input($_GET['search']) . "'
or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
$order_by);
} else {
$products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
p.products_image, p.products_price, p.products_date_added,
p.products_last_modified, p.products_date_available,
p.products_status, p.products_model,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
p.products_quantity_order_max, p.products_sort_order
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and p2c.categories_id = '" . (int)$current_category_id . "'" .
$order_by);
}
// Split Page
// reset page when page is unknown
if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['pID'] != '') {
$old_page = $_GET['page'];
$check_page = $db->Execute($products_query_raw);
if ($check_page->RecordCount() > MAX_DISPLAY_RESULTS_CATEGORIES) {
$check_count=1;
while (!$check_page->EOF) {
if ($check_page->fields['products_id'] == $_GET['pID']) {
break;
}
$check_count++;
$check_page->MoveNext();
}
$_GET['page'] = round((($check_count/MAX_DISPLAY_RESULTS_CATEGORIES)+(fmod_round($check_count,MAX_DISPLAY_RESULTS_CATEGORIES) !=0 ? .5 : 0)),0);
$page = $_GET['page'];
if ($old_page != $_GET['page']) {
// zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
}
} else {
$_GET['page'] = 1;
}
}
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_RESULTS_CATEGORIES, $products_query_raw, $products_query_numrows);
$products = $db->Execute($products_query_raw);
// Split Page
while (!$products->EOF) {
$products_count++;
$rows++;
// Get categories_id for product if search
if (isset($_GET['search'])) $cPath = $products->fields['categories_id'];
if ( (!isset($_GET['pID']) && !isset($_GET['cID']) || (isset($_GET['pID']) && ($_GET['pID'] == $products->fields['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
// find out the rating average from customer reviews
$reviews = $db->Execute("select (avg(reviews_rating) / 5 * 100) as average_rating
from " . TABLE_REVIEWS . "
where products_id = '" . (int)$products->fields['products_id'] . "'");
$pInfo_array = array_merge($products->fields, $reviews->fields);
$pInfo = new objectInfo($pInfo_array);
}
// Split Page
$type_handler = $zc_products->get_admin_handler($products->fields['products_type']);
if (isset($pInfo) && is_object($pInfo) && ($products->fields['products_id'] == $pInfo->products_id) ) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
// Split Page
?>
fields['products_id']; ?> |
fields['products_id'] . '&action=new_product_preview&read=only' . '&product_type=' . $products->fields['products_type'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . ' ' . $products->fields['products_name']; ?> |
fields['products_model']; ?> |
fields['products_id']); ?> |
fields['products_quantity']; ?> |
fields['products_status'] == '1') {
echo zen_draw_form('setflag_products', FILENAME_CATEGORIES, 'action=setflag&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : ''));?>
fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : ''));?>
fields['products_id']) == 'true') {
echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . ' ';
}
?>
|
fields['products_sort_order']; ?> |
fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?>
fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=delete_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?>
fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=move_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . ''; ?>
fields['products_type'] . '&pID=' . $products->fields['products_id'] .'&action=copy_to' ) . '">' . zen_image(DIR_WS_IMAGES . 'icon_copy_to.gif', ICON_COPY_TO) . ''; ?>
fields['products_id'] . '¤t_category_id=' . $current_category_id) . '">' . zen_image(DIR_WS_IMAGES . 'icon_image_handler.gif', ICON_IMAGE_HANDLER) . ''; ?>
fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false')) {
?>
fields['products_id'], 'false')) {
echo '' . ((!empty($products->fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false')) ? zen_image(DIR_WS_IMAGES . 'icon_attributes_on.gif', ICON_ATTRIBUTES) : zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES)) . '';
} else {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES) . '';
}
?>
get_allow_add_to_cart($products->fields['products_id']) == "Y") {
echo '' . zen_image(DIR_WS_IMAGES . 'icon_products_price_manager.gif', ICON_PRODUCTS_PRICE_MANAGER) . '';
}
// meta tags
if (zen_get_metatags_keywords($products->fields['products_id'], (int)$_SESSION['languages_id']) or zen_get_metatags_description($products->fields['products_id'], (int)$_SESSION['languages_id'])) {
echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '';
} else {
echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '';
}
?>
|
MoveNext();
}
$cPath_back = '';
if (sizeof($cPath_array) > 0) {
for ($i=0, $n=sizeof($cPath_array)-1; $i<$n; $i++) {
if (empty($cPath_back)) {
$cPath_back .= $cPath_array[$i];
} else {
$cPath_back .= '_' . $cPath_array[$i];
}
}
}
$cPath_back = (zen_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
?>
|
|
|