View Single Post
  #12  
Old 11-02-2004, 02:48 PM
 
delphi delphi is offline
 

Senior Member
  
Join Date: Jul 2004
Posts: 185
 

Default

Jon,
I am trying to apply hidden category to my XCart 4.0 but I could not find any code from include/categories.php. This is the code of categories.php

Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2004 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2004 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: categories.php,v 1.64 2004/07/12 06:50:34 max Exp $ # if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); } # # Functions definition # # # This function builds the categories list within specified category ($cat) # function func_get_categories_list($cat=0, $short_list=true, $flag=NULL) { global $current_area, $sql_tbl, $shop_language; $cat = intval($cat); $all_categories = array(); $categories = array(); $subcategories = array(); $search_condition = "1"; if ($flag == "root") $search_condition .= " AND parentid='0'"; elseif ($flag == "level") $search_condition .= " AND parentid='$cat'"; if ($current_area == "C") { global $user_account; $customer_search_condition = " AND avail='Y' AND (membership='".addslashes($user_account["membership"])."' OR membership='')"; $search_condition .= $customer_search_condition; if ($flag == "all" || $flag == NULL) $sort_condition = " ORDER BY category"; else $sort_condition = " ORDER BY order_by, category"; } if ($short_list) $to_search = "categoryid,parentid,categoryid_path,category,product_count,avail,order_by"; else $to_search = "*"; if (defined('NEED_PRODUCT_CATEGORIES')) { global $productid; $to_search = explode(",", $to_search); foreach ($to_search as $k=>$v) $to_search[$k] = $sql_tbl["categories"].".".$v; $to_search = implode(",", $to_search); $_categories = func_query("SELECT $to_search, $sql_tbl[products_categories].productid, $sql_tbl[products_categories].main FROM $sql_tbl[categories] LEFT JOIN $sql_tbl[products_categories] ON $sql_tbl[categories].categoryid=$sql_tbl[products_categories].categoryid AND $sql_tbl[products_categories].productid='$productid' GROUP BY $sql_tbl[categories].categoryid"); } else $_categories = func_query("SELECT $to_search FROM $sql_tbl[categories] WHERE ".$search_condition.$sort_condition); if (is_array($_categories)) { $_category_names = array(); if ($flag == "all" || $flag == NULL) { foreach ($_categories as $k=>$v) { $_category_names[$v["categoryid"]] = $v["category"]; } } foreach ($_categories as $k=>$category) { if ($flag == "all" || $flag == NULL) { # # Get the full path for category name # $path = explode("/", $category["categoryid_path"]); $category_path = array(); $continue = false; foreach ($path as $i=>$catid) { if (empty($_category_names[$catid])) { $continue = true; break; } $category_path[] = $_category_names[$catid]; } if ($continue) continue; $category["category_path"] = implode("/",$category_path); } if ($current_area == "C") { # # Get the international category name # $int_res = func_query_first("SELECT category FROM $sql_tbl[categories_lng] WHERE code='$shop_language' AND categoryid='$category[categoryid]'"); if (!empty($int_res["category"])) $category["category"] = $int_res["category"]; } # # Count the subcategories for "root" and "level" flag values # if ($flag == "level" || $flag == "root" || $flag == NULL) $category["subcategory_count"] = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[categories] WHERE 1 $customer_search_condition AND categoryid!='$category[categoryid]' AND categoryid_path LIKE '$category[categoryid_path]/%'")); $all_categories[] = $category; if (($flag == "root" || $flag == NULL) && $category["parentid"] == 0) $categories[] = $category; if (($flag == "level" || $flag == NULL) && $category["parentid"] == $cat) $subcategories[] = $category; } if (($flag == "all" || $flag == NULL) and !empty($all_categories)) { function func_categories_sort($a, $b) { return strcmp($a["category_path"], $b["category_path"]); } usort($all_categories, "func_categories_sort"); } } $return["all_categories"] = $all_categories; $return["categories"] = $categories; $return["subcategories"] = $subcategories; return $return; } # # This function gathering the current category data # function func_get_category_data($cat) { global $current_area, $sql_tbl, $shop_language; global $xcart_dir, $current_location, $config; $cat = intval($cat); if ($current_area == "C") $search_condition = "AND avail='Y' AND (membership='".addslashes($user_account["membership"])."' OR membership='')"; $category = func_query_first("SELECT * FROM $sql_tbl[categories] WHERE categoryid='$cat' $search_condition"); if (!empty($category)) { # # Get the array of all parent categories # $_cat_sequense = explode("/", $category["categoryid_path"]); # # Generate category sequence, i.e. # Books, Books/Poetry, Books/Poetry/Philosophy ... # foreach ($_cat_sequense as $k=>$v) { $_cat_name = array_pop(func_query_first("SELECT category FROM $sql_tbl[categories] WHERE categoryid='$v'")); if ($current_area == "C") { # # Get the international category name for category location # $int_res = array_pop(func_query_first("SELECT category FROM $sql_tbl[categories_lng] WHERE code='$shop_language' AND categoryid='$v'")); if (!empty($int_res["category"])) $_cat_name = $int_res["category"]; } $category["category_location"][] = array($_cat_name, "home.php?cat=$v"); } if ($current_area == "C") { # # Check if all parent categories are enabled # if (func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[categories] WHERE categoryid IN (".implode(",", $_cat_sequense).") AND avail='N'") > 0) { return false; } # # Get the international category name and description # $int_res = func_query_first("SELECT * FROM $sql_tbl[categories_lng] WHERE code='$shop_language' AND categoryid='$cat'"); if (!empty($int_res["category"])) { $category["category_name_orig"] = $category["category"]; $category["category"] = $int_res["category"]; } if (!empty($int_res["description"])) $category["description"] = $int_res["description"]; } if ($config["Images"]["icons_location"] == "FS") $image_field = "image_path"; else $image_field = "image"; $_cat_sequense = array_reverse($_cat_sequense); foreach ($_cat_sequense as $k=>$v) { $category_icon = func_query_first("SELECT $sql_tbl[icons].$image_field, $sql_tbl[categories].image_x, $sql_tbl[categories].image_y FROM $sql_tbl[icons], $sql_tbl[categories] WHERE $sql_tbl[icons].categoryid='$v'"); if (!empty($category_icon[$image_field])) { $category["image_x"] = $category_icon["image_x"]; $category["image_y"] = $category_icon["image_y"]; break; } } if ($config["Images"]["icons_location"] == "FS") { # # Correct the icon URL or path if icon is located in File system # $category["image_path"] = $category_icon[$image_field]; if (eregi("^(http|ftp)://", $category["image_path"])) { # image_path is an URL $category["icon_url"] = $category["image_path"]; } elseif (!strncmp($xcart_dir, $category["image_path"], strlen($xcart_dir))) { # image_path is an locally placed image $category["icon_url"] = $current_location.substr($category["image_path"], strlen($xcart_dir)); } } # # Count the subcategories # $category["subcategory_count"] = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[categories] WHERE categoryid!='$cat' AND categoryid_path LIKE '$category[categoryid_path]/%' $search_condition")); return $category; } return false; } # # Main code # $cat = intval($cat); if ($cat > 0) { # # Get the current category data # if ($current_category = func_get_category_data($cat)) $smarty->assign("current_category", $current_category); else { if ($current_area == "A") { $top_message["content"] = func_get_langvar_by_name("msg_category_not_exist"); $top_message["type"] = "E"; func_header_location("categories.php"); } else func_header_location("home.php"); } } # # Gather the array of categories and extract into separated arrays: # $all_categories, $categories and $subcategories # if ($current_area == "C" or defined('MANAGE_CATEGORIES')) $_categories = func_get_categories_list($cat); else $_categories = func_get_categories_list($cat, true, "all"); extract($_categories); # # Prepare data for FancyCategories module # if ($current_area == "C" and !empty($active_modules["Fancy_Categories"])) @include $xcart_dir."/modules/Fancy_Categories/fancy_categories.php"; $smarty->assign("allcategories", $all_categories); $smarty->assign("categories", $categories); if ($cat == 0) $subcategories = $categories; if (!empty($subcategories)) $smarty->assign("subcategories", $subcategories); $smarty->assign("cat", $cat); ?>

Could you show me where to replace the code?
__________________
X-Cart Gold version 4.4.4
X-Cart directory /home/web/u/ugchweb/cart
PHP 5
MySQL server 5
Reply With Quote