Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Enable/Disable categories contribution


tlelliott77

Recommended Posts

  • 2 weeks later...
  • Replies 150
  • Created
  • Last Reply

Top Posters In This Topic

posted wrong forum first... oops forgive me

 

After installation, I get the error shown below if I click on either of the status lights.  Changing status via Edit works fine.

 

Fatal error: Call to undefined function: tep_set_categories_status() in /home/magn99to/public_html/catalog/admin/categories.php on line 40

 

I cannot seem to track this down...  obviously I missed something.

 

Help!

 

Thanx!

Link to comment
Share on other sites

Hi!

I just installed this great feature, and noticed a small bug. When listing products by choosing manufacturer from the start page in the drop down Manufacturers box, the products that are "linked" between sub categories are shown multiple times.

 

I think this is the same problem that was corrected earlier by inserting "distinct" etc in the SQL query in /catalog/products_new.php. I think something similar would solve this, as I recall, it should be done in the /catalog/boxes/manufacture_info.php file (but I am not 100% sure). Maybe someone with better MySQL query knowledge could help here?

 

Maybe this query (row 14 - 16) can be modified so that one product only show up once?

 

    $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
   if (tep_db_num_rows($manufacturer_query)) {
     $manufacturer = tep_db_fetch_array($manufacturer_query);

 

 

Besides this minor bug, I am really impressed by the feature, working with disabled categories really helps to be able to prepare new products in advance. Thanks everyone who has contributed with the code!!!

 

/Inkan in Sweden

Link to comment
Share on other sites

I have found the file now, the changes should be done in /catalog/includes/modules/upcoming_products.php

 

row 12:

  $expected_query = tep_db_query("select p.products_id, pd.products_name, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . " limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);

 

This query should be corrected so that products don?t show up multiple times.

 

This is the listing on the first page (this months new products), so it is a little annoying.

 

Thanks in advance for any suggestions!

 

/Inkan in Sweden

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
Still having problems with this, it seems that the field to check whether or not the category is enabled or not will not show up in admin, any advice?

 

Has anyone been able to figure this out?

 

I seem to have the same problem. I am unable to:

 

1) view the status "lights" graphics (yes, graphics are uploaded to admin/images directory),

 

2) disable/enable any category in admin/categories.php (main page),

 

3) see any option to disable/enable when editing or creating a new category.

 

TIA!

 

Chris B.

Link to comment
Share on other sites

I had installed this contrib and it works great! But I also have the jcssmenu contrib installed as well and does not work with this menu. The jcssmenu shows all categories regardless of enabled or disabled. Anyone else using jcssmenu with this contrib? Anyone have any ideas where I should look to get this to work with jcssmenu? :huh:

 

Thanks in advance & for this contrib!

Link to comment
Share on other sites

  • 2 weeks later...

Hi Guys

I had installed too this mod on my Creload and I adapted it...

It works almost great but products in disabled categories are still reachable using URL... :(

Can't find where is the problem...

HEEEEEEEEEEEP ........ :blush: :lol:

 

dandelion, here comes the modified request of my main_categories.php ...

 

// #################### Added Enable / Disable Categories ##############
//  $query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION ." cd where c.categories_id = cd.categories_id";
$query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION ." cd where c.categories_id = cd.categories_id and c.categories_status = '1' ";
// #################### End Added Enable / Disable Categories ##############

 

Enjoy ;)

Link to comment
Share on other sites

  • 3 weeks later...

Same problems as others I think...

 

The contrib. removes the category from the ?list box?, but ?Main Categories? box still lists the category I want to deactivate.

 

Any ideas?

 

 

Neil

 

 

I've just installed this contribution and it works very well except that it's not working with the main categories in front page contribution found here

 

Can anyone help me figure this one out?

 

THANKS

 

 

Did you ever solve this?

Link to comment
Share on other sites

Same problems as others I think...

 

The contrib. removes the category from the ?list box?, but ?Main Categories? box still lists the category I want to deactivate.

 

Any ideas?

Neil

Did you ever solve this?

Actually it is solved but I have no idea how. monika in germany was working on fixing a code problem that I couldn't resolve and she fixed it for me a the same time. You could pm her and ask what she did.

Link to comment
Share on other sites

  • 2 weeks later...

Okay here's the mess I'm in now. I'm starting a new store for a new client. I didn't want to add all the contributions again so I've uploaded the Aromatherapy for You.com files and database to the new store space and I'm editing it. The problem is the enable disable categories isn't allowing me to enable any categories.

 

I get this Fatal error >_< (do they have to call it fatal error - sounds like it can't be fixed and I'm dead)

 

Fatal error: Call to undefined function: tep_set_categories_status() in /var/www/html/catalog/admin/categories.php on line 48

 

I've checked this file and it's the same as the file has all the correct changes. Here is that section of code

 

 

// // ####################### Added Categories Enable / Disable ###############
  case 'setflag_cat':
	if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
	  if (isset($HTTP_GET_VARS['cID'])) {
   tep_set_categories_status($HTTP_GET_VARS['cID'], $HTTP_GET_VARS['flag']);
}

	  if (USE_CACHE == 'true') {
		tep_reset_cache_block('categories');
		tep_reset_cache_block('also_purchased');
	  }
	}

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&cID=' . $HTTP_GET_VARS['cID']));
break;
// ####################### End Categories Enable / Disable ###############

 

Help PLEASE!

 

Here is the site

Edited by dandelion
Link to comment
Share on other sites

Okay here's the mess I'm in now. I'm starting a new store for a new client. I didn't want to add all the contributions again so I've uploaded the Aromatherapy for You.com files and database to the new store space and I'm editing it. The problem is the enable disable categories isn't allowing me to enable any categories.

 

I get this Fatal error >_< (do they have to call it fatal error - sounds like it can't be fixed and I'm dead)

 

Fatal error: Call to undefined function: tep_set_categories_status() in /var/www/html/catalog/admin/categories.php on line 48

 

I've checked this file and it's the same as the file has all the correct changes. Here is that section of code

// // ####################### Added Categories Enable / Disable ###############
  case 'setflag_cat':
	if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
	  if (isset($HTTP_GET_VARS['cID'])) {
   tep_set_categories_status($HTTP_GET_VARS['cID'], $HTTP_GET_VARS['flag']);
}

	  if (USE_CACHE == 'true') {
		tep_reset_cache_block('categories');
		tep_reset_cache_block('also_purchased');
	  }
	}

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&cID=' . $HTTP_GET_VARS['cID']));
break;
// ####################### End Categories Enable / Disable ###############

 

Help PLEASE!

 

Here is the site

 

Hi Ruth,

 

this is an easy one ... for some reason, the files you uploaded to the new site were not current. the function is missing in admin/includes/general.php

 

so what I would do backup what you have right now according to design changes, redownload the working site from Aromatherapy and upload tothe new spot. There may be more surrpises if you do not proceed this way. Quick fix would be to just redownload the general file and upload to new spot.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Monika thank you so much - All fixed up now!

 

Okay guys here's another one - the disable doesn't remove the categories from the sitemap.

 

same issue as with the new products ... it's just not in the query.

 

Post your query sql form that page!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

  • 1 month later...

Here is a problem with this contribution - it automatically changed the status in the admin to inactive so if my client went in to edit a category it would default to inactive and he would unintentionally lose his category! My oscommerce pal Monika in Germany fixed it up for me - here's what she did.

 

In categories.php

 

// ####################### Added Categories Enable / Disable ###############
//	  $sql_data_array = array('sort_order' => $sort_order);
//		$categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);
//changed by Monika for inactive bug
//		$sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status, 'pricebreak' => $pricebreak);
	$sql_data_array = array('sort_order' => $sort_order, 'pricebreak' => $pricebreak);
// ####################### End Added Categories Enable / Disable ###############

 

Hope this helps someone else too - Thanks Monika!

Link to comment
Share on other sites

Setting the category not to default to "inactive" after editing.

Monika's code seemed to have been modified from the original.

 

Mine looked like the below.

 

// ####################### Added Categories Enable / Disable ###############

// $sql_data_array = array('sort_order' => $sort_order);

$categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);

$sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status);

// ####################### End Added Categories Enable / Disable ###############

 

I commented out all the lines and it seems to work fine now.

 

// ####################### Added Categories Enable / Disable ###############

// $sql_data_array = array('sort_order' => $sort_order);

// below 2 lines commented out to default for category status to remain the same

// $categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);

// $sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status);

// ####################### End Added Categories Enable / Disable ###############

 

I've been looking for how to do it for weeks.

All credit goes to Monika.

 

Thank you, Thank you

Link to comment
Share on other sites

Setting the category not to default to "inactive" after editing.

Monika's code seemed to have been modified from the original.

 

Mine looked like the below.

 

// ####################### Added Categories Enable / Disable ###############

// $sql_data_array = array('sort_order' => $sort_order);

$categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);

$sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status);

// ####################### End Added Categories Enable / Disable ###############

 

I commented out all the lines and it seems to work fine now.

 

// ####################### Added Categories Enable / Disable ###############

// $sql_data_array = array('sort_order' => $sort_order);

// below 2 lines commented out to default for category status to remain the same

// $categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);

// $sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status);

// ####################### End Added Categories Enable / Disable ###############

 

I've been looking for how to do it for weeks.

All credit goes to Monika.

 

Thank you, Thank you

 

Hi,

 

Ruth forgot to remove the custom mod she has in her code ;-)

 

this is what yours SHOULD look like, or you will never again be able to edit sort order!!!

 

// ####################### Added Categories Enable / Disable ###############

$sql_data_array = array('sort_order' => $sort_order); // commented back in by Monika so sorting is possible

// below 2 lines commented out to default for category status to remain the same

// $categories_status = tep_db_prepare_input($HTTP_POST_VARS['categories_status']);

// $sql_data_array = array('sort_order' => $sort_order, 'categories_status' => $categories_status);

// ####################### End Added Categories Enable / Disable ###############

Edited by Monika in Germany

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

  • 1 month later...

HELP??!!!

 

Hello, I have a mildly modified site and am having difficulties with getting the Enable/Disable Categories mod to work.

 

After the configuration of my files as per the documentation, I find that:

 

1. My Category Administration page, displays a new column "status" for each category. This column however has no red/green button, and indeed I cannot find anywhere to modify this status.

 

So, the following problems are all occurring, which I'm assuming are only coming from the inability to 'activate' the status of my categories in the admin panel.

 

2. My categories still display on my shops product menu, however each category is now empty of products

3. My Categories no longer display the menu images for the subcategories (I'm also assuming this is because the subcategories are somehow disabled)

 

 

I have checked and rechecked all my file alterations in the admin directory, and cannot find where the issue may be.

 

--> I'm wondering whether the contribution Attribute_Sets-5.5-2.cip.zip is the cause of this issue?

 

I've tried installing this package twice now to no avail. Are there any other alternatives that will work to enable/disable my categories?

Link to comment
Share on other sites

  • 3 weeks later...

Hi, Ive attempted to install this contribution for a friend and its all gone tits up.

 

Ive followed the instructions.

Overwritten all the files (starting with the earliest version, to the latest).

Ran the piece of code in the SQL database.

 

But on attempting to access the admin panel I am stumped by this error :

"Fatal error: Call to undefined function: tep_admin_check_login() in /htdocs/catalog/admin/includes/application_top.php on line 215"

 

Application_top has not been modified itself so why are the newly modified files stopping application_top from using the function "tep_admin_check_login()"?

 

Any help GREATLY appreciated! :(

His site is sitting in an unusable state.

 

Thank you!

Link to comment
Share on other sites

I've installed this contribution and everything seems to be working great with the categories.

 

The only problem I have is that my specials page is now broken.

 

All I get displayed in the specials box is:-=

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-9, 9' at line 1

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

[TEP STOP]

 

Any help with this would be much appreciated.

 

Thanks in advance

Link to comment
Share on other sites

I wasn't getting the category red/green buttons to show up either, but after digging around I found the following lines of code in /admin/categories.php on line 827 that were not clearly marked and needed to be added:

 

<!-- // ################" Added Categories Disable #############
			<td class="dataTableContent" align="center"> </td>
-->
			<td class="dataTableContent" align="center">
<?php
  if ($categories['categories_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=0&cID=' . $categories['categories_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=1&cID=' . $categories['categories_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?>
			</td>
<!-- // ################" End Added Categories Disable ############# -->

 

I added that in and I finally got the buttons to show up, although they don't do anything! They turn red, but the categories never disappear from the first page.

 

The products inside the categories will disappear, but the category name never moves at all.

 

Has anyone figured this out? Am I doing something completely wrong? I've installed this several times!!!

Link to comment
Share on other sites

I wasn't getting the category red/green buttons to show up either, but after digging around I found the following lines of code in /admin/categories.php on line 827 that were not clearly marked and needed to be added:

 

<!-- // ################" Added Categories Disable #############
			<td class="dataTableContent" align="center"> </td>
-->
			<td class="dataTableContent" align="center">
<?php
  if ($categories['categories_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=0&cID=' . $categories['categories_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag_cat&flag=1&cID=' . $categories['categories_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?>
			</td>
<!-- // ################" End Added Categories Disable ############# -->

 

I added that in and I finally got the buttons to show up, although they don't do anything! They turn red, but the categories never disappear from the first page.

 

The products inside the categories will disappear, but the category name never moves at all.

 

Has anyone figured this out? Am I doing something completely wrong? I've installed this several times!!!

 

mreigle there are no categories on the first page, you must be using another contibution like 'categories on fron page' and if thats the case you need to alter the code that you inserted for that to only show the categories that aren't disabled..

 

 

I'm still looking for help getting my specials working again after installing this contribution...

Link to comment
Share on other sites

  • 3 weeks later...

Hi all,

 

I've installed this contrib, but I guess it doesn't work exactly as I thought it would/should. When I disable the category in admin, I expected to go to my front end catalog and find that the category would not show in the "categories" box. However, this isn't what's happening. I still see the category in the "categories" box, and when I click on the category I disabled, it says "there currently are no products within this category". Is this supposed to happen?

 

I changed my "categories" box code to the new "categories_query" used in "index.php", however this did not resolve my issue. Has anyone been able to figure if this is supposed to be happening or if I'm missing something?

 

Thanks for the help!

Chris B.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...