Community Add-Ons
Enable & Disable Categories
for osCommerce Online Merchant v2.2
This contribution will give you the ability to Enable and disable product categories. It will allow you to set the status of each category from the osCommerce admin section. It now has the green/red buttons same as products do for status, and can also be changed when editing that specific category.
sql queries were not working in manufacturers pages
Full Package + update guide
- fixed the query in products_new.php
- minor fix to the all products sql query (see update guide)
the previous archive had v 1.6.3 zipped inside it also.
no code change
Full Package
- added Main categories in front page contrib compatibility doc
- removed the spaces from file and folder names for compatibility
- updated All_Products_v3.0_MS_2.2_with_Images install doc
fixed an incorrect sql statement
This is a roll up of patches/mods/fixes to date
Fixes:
- Minor spelling changes to install doc(no code change).
- moved growing history to history.txt
- added step by step install instructions
- moved sql to it's own file
- added OSC2.2RC2a compatability
- add fixes/patches to this date
- included docs to integrate with other contribs
Full Package + update guides
This contibution contains includes/modules/browse_categories.php .
Thanks
Grund:
Beim LinkMangerII
in admin/includes/functions/links.php und
Enable/Disable Categories
in admin/includes/functions/general.php
wird jeweils die Funktion tep_set_categories_status($cat_id, $status) aufgerufen.
Habe beim LINKMANAGERII in admin/includes/functions/links.php ca zeile 363 die function in "function tep_set_link_categories_status($cat_id, $status) {"
umbenannt
PROBLEM: the new products module displays products that belong to categories that are disbled.
SOLUTION: Added a few joins and a where clause in catalog/includes/modules/new_products.php so only new products are shown.
File and instructions attached.
By the way, I also optimized the query in the last package to make it completely MYSQL 5 compatible.
changed the query for the featured_products.php so only products in active categories will show. Better than previous mod.
See here:
http://www.oscommerce.com/community/contributions,651
with the url would be better:
http://forums.oscommerce.com/index.php?showtopic=265608
Just modified the query to Disable adding products that were part of disabled categories.
From a clean installation of Osc Ms2 newer snapshop just replace the file or look at the commented query for upgrade on pre-modded sites.Enjoy ;)
Ps.
File is located under catalog/specials.php just rename the one inside the archive and you are ready to go!
fix catalogincludesfunctionsgeneral.php about count_products wrong:
// Return the number of products in a category
// TABLES: products, products_to_categories, categories
function tep_count_products_in_category($category_id, $include_inactive = false) {
$products_count = 0;
if ($include_inactive == true) {
$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$category_id . "'");
} else {
//$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'");
// #################### Added Enable / Disable Categories ##############
// $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'");
$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where p.products_id = p2c.products_id and c.categories_status = '1' and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'");
// #################### End Added Enable / Disable Categories ##############
}
$products = tep_db_fetch_array($products_query);
$products_count += $products['total'];
$child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'");
if (tep_db_num_rows($child_categories_query)) {
while ($child_categories = tep_db_fetch_array($child_categories_query)) {
$products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive);
}
}
return $products_count;
}
Updated products_new.php whith DISTINCT in the SQL-query. Otherwise you can get duplicates of products thats in 2 or more categories.
Die Deutsche Anleitung. Somit muß man die Datein nicht überschreiben.
This is a minor update to this contribution.
Fixes:
- Changed pd.products_model to p.products_model in /catalog/includes/application_top.php file. (Thanks to Alwin Stehli in osCommerce Forum).
This is a minor update to this contribution.
Fixes:
- Does not display category name or product model of a disabled category in breadcrumb (Thanks to clongato in osCommerce Fourm).
- products_info.php fix (Thanks to clongato in osCommerce Fourm).
Added:
- best_sellers.php file to contribution (Thanks to David Adams).
Please post all comments, bugs, etc here: http://forums.oscommerce.com/index.php?showtopic=126904
The best_sellers.php file does not restrict best sellers to products within enabled categories only. It shows items from disabled categories when the user is on the home page (i.e. top category).
This upload contains best_sellers.php only.
Just a few fixes and updates for this contribution.
Fixes:
- Categories Pull down box in advanced_search.php does not display disabled categories anymore.
- Manufactures box in the side column does not display manufactures who do not have any products active,
or whos products are in a disabled category.
- Does not allow viewing of products that are in disabled categories.
Changes:
- When a new category is added, it is by default not viewable. This can be changed be changing the
default of the categories_status field in the database.
Updated and fix bug
Files added for
cross xsell
default special
Updated for MS2
setflag geändert durch setflag_cat
Addition to Mikel Williams' contribution. This variation package will make the next two things happen:
- Nested categories will be eneabled or disabled according to parent category.
- The categories' "Last Modified" date will be updated when the category status is changed.
If you do not want these two things to happen, do not install this hack and stick with v.1.3
- Also, there is a Japanese language file just for the heck of it.
****This is a repost. Webmaster, please remove this line and old post.****
Addition to Mikel Williams' contribution. This variation package will make the next two things happen:
- Nested categories will be eneabled or disabled according to parent category.
- The categories' "Last Modified" date will be updated when the category status is changed.
If you do not want these two things to happen, do not install this hack and stick with v.1.3
- Also, there is a Japanese language file just for the heck of it.
Fixed - catalog/includes/boxes/best_sellers - Correction to sql query to check categories table
Fixed - admin/categories - completed closing html tag </td>
Both fixes thanks to crshNbrn (info@quickgrow.com)
Updated for MS1
This contribution will give you the ability to Enable and disable product
categories. It will allow you to set the status of each category from the
osCommerce admin section. It now has the green/red buttons same as products
do for status, and can also be changed when editing that specific category.
Bug Fixes from original contribution:
/catalog/default.php
part of the sql statement referred to the incorrect field name
in the categories table "c.enabled", it has now been corrected to "c.categories_status"
/catalog/includes/boxes/categories.php
part of the sql statement referred to the incorrect field name
in the categories table "c.enabled", it has now been corrected to "c.categories_status"
Additions:
The following files now work where they will no longer show products that are in the
disabled categories.
/catalog/includes/boxes/whats_new.php
/catalog/includes/boxes/best_sellers.php
/catalog/includes/modules/new_products.php
/catalog/products_new.php
This contribution will give you the ability to Enable and disable product
categories. It will allow you to set the status of each category from the
osCommerce admin section. It now has the green/red buttons same as products
do for status, and can also be changed when editing that specific category.
This is my 1st contribution, so any comments are welcome.
