Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Enable/Disable categories contribution


tlelliott77

Recommended Posts

Hi there,

 

I've installed this contribution but upin testing it it takes a significant amount of time to parse the page. I've done a bug report and it hangs on 77 which is the following code

 

[77] => select distinct p.products_id, pd.products_name from products p, products_description pd, categories c  where p.products_status = '1' and c.categories_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '1' order by p.products_ordered desc, pd.products_name limit 5

 

 

which with a parse time of Current Parse Time: 7.834 s with 82 queries 77 took a fair chunk of those to perform [77] => 6.939117

 

This only happens when I have the enable/disable categories contribution installed

 

Any ideas?

 

Thanks

 

Dave

Link to comment
Share on other sites

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

Top Posters In This Topic

Hi there!

 

I have installed many contributions, and this one is the most problematic that I found.

 

I tried really hard to fix and use this contribution but without success.

 

None of the suggestions for index.php works.

None of the suggestions for products_new.php works.

 

 

/advanced_search_results.php os working.

/allprods.php is working.

/includes/boxes/categories.php is working.

/includes/boxes/manufacturers.php is working.

/includes/boxes/best_sellers.php is working.

The admin part is working.

 

I still see products from disabled categories in the main page and products_new.php.

 

Is it possible that some good samaritan post a complete and working full package for this VERY useful contributtion? Everybody from this community wil be very gratefull.

 

Thank you very much.

Edited by cururu
Link to comment
Share on other sites

It's been awhile and I'm a bit rusty:

 

This is what I have in my index.php (I only have the latest STS, master products and header tags installed)

 

		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
//Master Products
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_listing_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  }
}
//Master Products EOF

 

 

And this is what the contribution is telling me to change it to:

 

// ################## Added Enable Disable Categorie #################
//	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

  } else {
// We show them all
// ################## Added Enable Disable Categorie #################
//	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
// ################## Added Enable Disable Categorie #################
//		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
// ################## Added Enable Disable Categorie #################
//		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  }
}

 

There are some slight discrepencies when you compare them (I use beyond compare) - how up to date is the Enable/Disable code?

Link to comment
Share on other sites

Okay, this is what I have now:

 

From line 179 of my index.php

 

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// ################## Added Enable Disable Categorie #################
//	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
  } else {
// We show them all
// ################## Added Enable Disable Categorie #################
//	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
// ################## Added Enable Disable Categorie #################
//		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
//Master Products
//		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id,  p2c where p.products_status = '1' and p.products_listing_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	  $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  }
}
//Master Products EOF

Link to comment
Share on other sites

  • 2 weeks later...

Hi there.

I tried the contribution and it seems to be great but I still have some bugs I can't disable:

 

I'm runing oscommerce 2.2 rc1. I use enable & disable categories 1.6.1.1, the missing sql entry (from a readme from an older version), updated it to 1.6.1.2 (updated products_new.php) and the specials update for e.&d. contrib., from this page: http://www.oscommerce.com/community/contributions,326

 

My first problem: When I execute products_new.php i get an error message:

1054 - Unknown column 'p.manufacturers_id' in 'on clause'

select count(distinct p.products_id) as total from products p, categories c, products_to_categories p2c left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where c.categories_status=1 and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'

[TEP STOP]

 

The second bug: I still can see the images from items in disabled categories. I can see them in the what's new window and in the specials window.

 

My third problem: When I execute specials.php there are still items from disabled categories listed.

 

And at least the last one: When I use the Dropdown Menu to surf within the manufactures i also get en error:

1054 - Unknown column 'p.products_id' in 'on clause'

select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials s on p.products_id = s.products_id left join products_to_categories p2c on p.products_id = p2c.products_id left join categories c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '4'

[TEP STOP]

and I can still access manufactures from products that are only in disabled categories.

 

Can someone help me because I'm new with oscommerce (and all these contributions). Also php is new for me (so I don't know how to solve the two errors). I copied the lines in these php files as the guide / install notice told me.

Link to comment
Share on other sites

  • 3 weeks later...

Ok, seems as if my problems are because my provider as updated the database to mysql5. Is there a translation from mysql4 to mysql5 for these contrib?

I tried it by myself but then I only change the 1054 errors into 1064 ones.

 

It would be wonderfull when someone can post his or her steps to success.

Link to comment
Share on other sites

  • 3 weeks later...

Hi everyone,

 

Great contribution and thanks to all those supporting it.

 

I have run into a similar problem as other where disabled categories are still showing from the front end. I think though my problem might be slightly different because the code that pulls in the categories is on my /include/header.php file. It is done like this due to our design layout.

 

The code that displays categories is below and I was hoping some one could assist in adding the proper functions to not show disabled categories. All help is greatly appreciated.

 

<?   // ---- CATEGORIES
 function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;
  if(!$tree[$counter]['level']){			   
 //$categories_string .= $categories_string ? '<tr><td height=1></td></tr>' : '';			 
  // $categories_string .= '
//   <tr><td width=22 height=19 bgcolor=#D2D2D2 align=center><img src=images/m07.gif width=5 height=5 align=center></td>
//   <td bgcolor=#E9E9E9 width=165><span class=ch4></span><a class=ml3 href=
//				  ';
$categories_string .= '<li><a href="';

if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '">';
// display categry name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></li> ';

  }else{  // SUBCATEGORY

$categories_string .= '<li>';
  // $categories_string .= '
//   <tr><td width=22 height=19 bgcolor=#D2D2D2 align=center><img src=images/m07.gif width=5 height=5 align=center></td>
 //  <td bgcolor=#E9E9E9 width=186><span class=ch4></span>
 //		  ';

for($i=0;$i<$tree[$counter]['le vel'];$i++)
$categories_string .= '     ';
  $categories_string .= '     <a href="';   
if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '">-';
// display category name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></li>';
  }  

if ($tree[$counter]['next_id'] != false) {
  tep_show_category($tree[$counter]['next_id']);
}  
 }

 define(TABLE_CATEGORIES, "categories");
 define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");
 $categories_string = '';
 $tree = array();
 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
											'parent' => $categories['parent_id'],
											'level' => 0,
											'path' => $categories['categories_id'],
											'next_id' => false);

if (isset($parent_id)) {
  $tree[$parent_id]['next_id'] = $categories['categories_id'];
}

$parent_id = $categories['categories_id'];
if (!isset($first_element)) {
  $first_element = $categories['categories_id'];
}
 }
 //------------------------
 if ($cPath) {
$new_path = '';
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
  unset($parent_id);
  unset($first_id);
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  if (tep_db_num_rows($categories_query)) {
	$new_path .= $value;
	while ($row = tep_db_fetch_array($categories_query)) {
	  $tree[$row['categories_id']] = array('name' => $row['categories_name'],
										   'parent' => $row['parent_id'],
										   'level' => $key+1,
										   'path' => $new_path . '_' . $row['categories_id'],
										   'next_id' => false);

	  if (isset($parent_id)) {
		$tree[$parent_id]['next_id'] = $row['categories_id'];
	 }

	  $parent_id = $row['categories_id'];
	 if (!isset($first_id)) {
		$first_id = $row['categories_id'];
	  }
	  $last_id = $row['categories_id'];
   }
	$tree[$last_id]['next_id'] = $tree[$value]['next_id'];
	$tree[$value]['next_id'] = $first_id;
	$new_path .= '_';
  } else {
	break;
  }
}
 }
 $categories_string .=  '';
 tep_show_category($first_element); 
 $categories_string .=  '';
 echo $categories_string;
?>

Sincerely

Mike

Link to comment
Share on other sites

No I didint. I figured out that my provider uses also mysql4 so I changed the database.

 

I figured out that when you use mysql4 there is still a bug. When you select a manufacteur that has products in disabled categories you can select these disabled categories (but there are no products inside) from the show dropdown menu.

 

My problem is: I'm not good with sql so I don't know what to change exactly to make it sql5 cvompatible and to make it still compatible with the contrib.

 

The good thing for me: I don't need the what's new, manufactures and products new boxes so even when my provider disables sql4 I can still use the contrib. But you know it's better to have a working installation than to fix several things with workarounds.

Link to comment
Share on other sites

  • 1 month later...

Hey guys, I am trying to install this mod into my CRE Loaded site, but the mod assumes it is a default installation, and wants me to rewrite the entire file on many files. Is there somewhere where the specific changes made to the files are listed? Rather than wading through the entire file of both mine and the ones that come with this contribution to see what differences are there?

Link to comment
Share on other sites

Hi,

I am very interested in this mod but cannot get it to work with my sql5 and 2.2 rc1 default install. the catagories will vanish but then when you renable them they wont link to the actual catagories. is it possible for some kind person who is good at coding to look at this much needed mod and get it to work on a vanilla 2.2 rc1 install please and then package a complete file and manual editing post so that i can then futher mod the site i am working on

 

thanks in advance

Edited by haggisuk99
Link to comment
Share on other sites

  • 2 months later...

I have this menu contribution and having problems installing the enable-disable.

http://addons.oscommerce.com/info/4228

I am not a good coder

but below is what I am think needs to be changed.

 

$result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.'order by sort_order, cd.categories_name');

 

 

and below has the changes that need to be made. I don't know where to put the "c.categories_status = '1'" in the above code

thank you for your help

 

noppie

 

// #################### Added Enable / Disable Categories ##############
//	  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");
// #################### End Added Enable / Disable Categories ##############

 

 

 

 

 

so here is is includes/boxes/dm_categories.php

 

<?php
/*
 $Id: dm_categories.php,v 1.00 2006/05/07 01:13:58 nate_02631 Exp $

 Ties the store category menu into the PHP Layers Menu library, allowing display
of categories as DTHML drop-down or fly-out menus, collapsable tree-style menus
or horizontal/vertical indented plain menus.

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 Nate Welch http://www.natewelch.com

 Released under the GNU General Public License
*/

// BEGIN Configuration Options

 // Set the value below corresponding to the type of menu you want to render
// 0 = Horizontal Drop-down; 1 = Vertical Flyout; 2 = Tree Menu;
// 3 = Plain Horizontal Menu; 4 = Plain Vertical Menu
// Include the appropriate stylesheet in your store stylesheet, and if rendering
// types '0' or '1', you must also echo (output) the "menu footer" variable
// in your store footer as described in the readme (or submenus won't work)
$menu_type = 3;

 // Set to false to display the menu output only. Set to true to display in
// a regular box. The former is useful for better integrating the menu with your layout.
$show_dmcats_as_box = true;				

 // Set to 'true' to assign TITLE tags to each of the menu's items, 'false' to leave blank
$menu_use_titles = true;	

 // Name of the icon file to be used preceding menu items. Leave blank for no icons.
// NOTE: Does not apply to plain style menus. Icon should be in the /images directory
$menu_icon_file = '';

// Width and height of icons used in menus (does not apply to plain menus).
$menu_icon_width = 16;
$menu_icon_height = 16;

 // Set the graphic to be used for the forward arrow and down arrow images used in 
// drop-down and fly-out menus. Images must reside in your catalog's /images directory
$menu_fwdarrowimg  = 'forward-arrow.png';		
 $menu_downarrowimg = 'down-arrow.png';		

// Indicates whether or not to render your entire category list or just the root categories
// and the currently selected submenu tree. Rendering the full list is useful for dynamic menu
// generation where you want the user to have instant access to all categories. The other option
// is the default oSC behaviour, when the subcats aren't available until the parent is clicked,
// more suitable for plain-style menus 
$show_full_tree = true;		

// For tree menus, set to true to have only nodes corresponding to the current category path
// expanded. If set to false, the tree menu will retain expanded/collapse nodes the user has
// selected (as well as expanding any for categories they've entered)
$menu_tree_current_path = true;				

 // Set the three numerical values below to adjust the offset of submenus in
 // horizontal drop-down and vertical fly-out menus. Values adjust the following (in order)
 // Top Offset: # of pixels from top border of previous menu the submenu appears
 // Right Offset: # of pixels from right border of previous menu the submenu appears
 // Left Offset: # of pixels from left border of previous menu the submenu appears
 // if the submenu pops to left (i.e. if window border is reached).  Negative values are allowed.
 $menu_layer_offset = array (0,4,4);	

// Show icons on tree menus? If set to false, only expand/collapse icons and connecting lines are shown
$GLOBALS['dm_tree_folder_icons'] = true;

// This is the HTML that you would like to appear before/after your categories menu if *not*
// displaying in a standard "box". This is useful for reconciling tables or clearing
// floats, depending on your layout needs.	For example if not including in a box in the
// default osC template, you would need opening/closing <tr><td> tags...
$before_nobox_html = '';
 $after_nobox_html = '';	

// END Configuration Options


// Misc setting to make folder icon clickable to expand tree menu nodes
$GLOBALS['dm_tree_titleclick'] = true;	

// Initialize HTML and info_box class if displaying inside a box
if ($show_dmcats_as_box) {
echo '<tr><td>';
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
new infoBoxHeading($info_box_contents, true, false);					
}

// Generate the menu data output (uses configuration options above)
$categories_string = tep_make_cat_dmlist();

// Include required libraries based on menu type
require_once 'includes/functions/dynamenu/lib/PHPLIB.php';
require_once 'includes/functions/dynamenu/lib/layersmenu-common.inc.php';

if ($menu_type < 2) { // Setup for DHTML style menus

?>
	<script language="JavaScript" type="text/javascript">
		<!--
			<?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>
		// -->
	</script>
	<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu-library.js"></script>
	<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layersmenu.js"></script>
<?php

require_once 'includes/functions/dynamenu/lib/layersmenu.inc.php';
$mid = new LayersMenu($menu_layer_offset[0],$menu_layer_offset[1],$menu_layer_offset[2],1);

} elseif ($menu_type > 2) { // Setup for plain style menus

require_once 'includes/functions/dynamenu/lib/plainmenu.inc.php';
$mid = new PlainMenu();

} else {  // Setup for tree style menus

	?>
	<script language="JavaScript" type="text/javascript">
		<!--
			<?php require_once 'includes/functions/dynamenu/libjs/layersmenu-browser_detection.js'; ?>

							<?php

							   if ($menu_tree_current_path) {
									 echo "\n".'var menu_tree_current_path = true';   		   
								 } else {
									 echo "\n".'var menu_tree_current_path = false'; 									 
								 }

							?>
	// -->
	</script>
	<script language="JavaScript" type="text/javascript" src="includes/functions/dynamenu/libjs/layerstreemenu-cookies.js"></script>
<?php

	require_once 'includes/functions/dynamenu/lib/treemenu.inc.php';
	$mid = new TreeMenu();

}

// Set menu config variables
$mid->setDirroot('./');
$mid->setLibjsdir('./includes/functions/dynamenu/libjs/');

if ($menu_type !=2) {
$mid->setTpldir('./includes/functions/dynamenu/templates/');
}

$mid->setImgdir('./images/');
$mid->setImgwww('images/');
$mid->setIcondir('./images/');
$mid->setIconwww('images/');
$mid->setIconsize($menu_icon_width, $menu_icon_height);

// Generate menus
$mid->setMenuStructureString($categories_string);
$mid->parseStructureForMenu('catmenu');

switch ($menu_type) {
case 0: // Horizontal drop-down
	$mid->setDownArrowImg($menu_downarrowimg);
	$mid->setForwardArrowImg($menu_fwdarrowimg);
	$mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');						
	$mid->setSubMenuTpl('layersmenu-horiz_sub_menu.ihtml');							
		  $mid->newHorizontalMenu('catmenu');	
			$mid->printHeader();
	$categories_menu = $mid->getMenu('catmenu');
			$GLOBALS['dmfooter'] = $mid->getFooter();								
	break;
case 1:  // Vertical fly-out
	$mid->setDownArrowImg($menu_downarrowimg);
	$mid->setForwardArrowImg($menu_fwdarrowimg);
	$mid->setVerticalMenuTpl('layersmenu-vertical_menu.ihtml');				
	$mid->setSubMenuTpl('layersmenu-vert_sub_menu.ihtml');							
			$mid->newVerticalMenu('catmenu');
			$mid->printHeader();
	$categories_menu = $mid->getMenu('catmenu');
			$GLOBALS['dmfooter'] = $mid->getFooter();												
	break;
case 2:  // Tree menu
		$categories_menu = $mid->newTreeMenu('catmenu');
	break;
case 3:  // Horizontal plain menu
	$mid->setPlainMenuTpl('layersmenu-horizontal_plain_menu.ihtml');		
	$categories_menu = $mid->newHorizontalPlainMenu('catmenu');							
	break;
case 4:  // Vertical plain menu
	$mid->setPlainMenuTpl('layersmenu-plain_menu.ihtml');		
	$categories_menu = $mid->newPlainMenu('catmenu');						
	break;	 	 
}	


// Output list inside a box if specified, otherwise just output unordered list
if ($show_dmcats_as_box) {
$info_box_contents = array();
$info_box_contents[] = array('text' => $categories_menu);
new infoBox($info_box_contents);
	echo '</td></tr>';	
} else {
	echo $before_nobox_html;	
echo $categories_menu;
	echo $after_nobox_html;
}

// Create the root category list
function tep_make_cat_dmlist($rootcatid = 0, $maxlevel = 0){

global $cPath_array, $show_full_tree, $languages_id;

global $idname_for_menu, $cPath_array, $show_full_tree, $languages_id;

// Modify category query if not fetching all categories (limit to root cats and selected subcat tree)
	if (!$show_full_tree) {
	$parent_query	= 'AND (c.parent_id = "0"';	

			if (isset($cPath_array)) {

				$cPath_array_temp = $cPath_array;

				foreach($cPath_array_temp AS $key => $value) {
						$parent_query	.= ' OR c.parent_id = "'.$value.'"';
					}

					unset($cPath_array_temp);
			}	

	$parent_query .= ')';				
	} else {
	$parent_query	= '';	
	}		

	[font="Arial Black"][b]$result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.'order by sort_order, cd.categories_name');
[/b][/font]
	while ($row = tep_db_fetch_array($result)) {				
	$table[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
}

$output .= tep_make_cat_dmbranch($rootcatid, $table, 0, $maxlevel);

return $output;
}

// Create the branches off the category list
function tep_make_cat_dmbranch($parcat, $table, $level, $maxlevel) {

global $cPath_array, $menu_use_titles, $menu_icon_file;

$list = $table[$parcat];

// Build data for menu
	while(list($key,$val) = each($list)){

			if (isset($cPath_array) && in_array($key, $cPath_array)) {
		$this_expanded = '1';
		$this_selected = 'dmselected';						
	} else {
		$this_expanded = '';
		$this_selected = '';									
		}	

	if (!$level) {
				unset($GLOBALS['cPath_set']);
					$GLOBALS['cPath_set'][0] = $key;
		$cPath_new = 'cPath=' . $key;

	} else {
					$GLOBALS['cPath_set'][$level] = $key;		
		$cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));
	}

			if ($menu_use_titles) {
				$this_title = $val;
			} else {
				$this_title = '';				
			}				

	if (SHOW_COUNTS == 'true') {
		$products_in_category = tep_count_products_in_category($key);
		if ($products_in_category > 0) {
			$val .= ' (' . $products_in_category . ')';
		}
	}

			// Output for file to be parsed by PHP Layers Menu
			// Each line (terminated by a newline "\n" is a pipe delimited string with the following fields:
			// [dots]|[text]|[link]|[title]|[icon]|[target]|[expanded]
			// dots - number of dots signifies the level of the link '.' root level items, '..' first submenu, etc....
			// text - text for link; title - tooltip for link; icon - icon for link; target - "dmselected" CSS class if item is selected
			// expanded - signifies if the node is expanded or collapsed by default (applies only to tree style menus)
			$output .= str_repeat(".", $level+1).'|'.$val.'|'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'|'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";							 

	if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) {
		$output .= tep_make_cat_dmbranch($key,$table,$level + 1,$maxlevel);
	}

	} // End while loop

return $output;
}	

?>

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= "  ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '->';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '<br>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, false, false);

 

$categories_string = '';

$tree = array();

 

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

// $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent m _id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");

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

 

while ($categories = tep_db_fetch_array($categories_query)) {

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

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

// $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");

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

 

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $categories_string);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

Link to comment
Share on other sites

  • 4 months later...

Hello. I just got stuck with this contrib....

 

reading all the posts in this thread i can see that you must edit everything that somehow shows products or categories. in heavy modded shops this is a real big thing.

 

wouldn't it be much easier to modify the admin/categories.php in this way that not just the categories get dis/enabled but also the products in there!? you just select the category to disable and ALL products in this cat are disabled automatically (products_status=0). so you dont need to modify more and more files in frontend because this just increases your server loads because of more date needed to be catched from the DB. the products status is something thats already in the system. why not just disable them too with just 1 click? for subcategories it works why not for products too?

 

would be nice if anyone of the pros in here could give a solution to this. i just don't get a clue how to solve this correct.

 

THANKS!

Link to comment
Share on other sites

  • 2 months later...

Been searching and looking for a solution to a porblem with the install of this mod into my store. Please help. I installed this mod twice and narrowed it down to one line in the index.php code that causes. Either that line in the mod is bad or, whatever it points to is messed up. Please help me pinpoint my issue. Thanks

 

 

HERE IS THE LINE OF CODE CAUSING THE ISSUE (or pointing me to where the issue lies) Around line 200 in the mod, the last mod in the index.php file.

// ################## Added Enable Disable Categorie #################
//		$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

HERE IS THE LINE OF CODE FROM MY ORIGINAL FILE I USE TO MAKE THE STORE WORK (but of course the mod doesn't work properly, you can see the category even if it is disabled.

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

 

HERE IS THE ERROR MESSAGE I GET ON ANY PRODUCT PAGE. CATEGORIES WORK OK

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id left join categories c on c.categories_id = p2c.categories_id where c.categories_status = '1' and p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '23'

 

[TEP STOP]

 

 

 

Thanks for any help you can give in advance. This was the install I did, seemed like the most recent full install. " Enable & Disable Categories 1.6.1.1 djenniex 2 Aug 2005"

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
Hi there

 

Could someone just confirm for me, when you disable a category should products in that category be able to be found in the search results?

 

Thanks

 

Dave

 

 

Yes, unless there disabled.

 

I found this package way overcomplex for the task, You could use Hide Categories & Products http://addons.oscommerce.com/info/5907

 

which is a much simpler package, but does the same job for the most part.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Yes, unless there disabled.

 

I found this package way overcomplex for the task, You could use Hide Categories & Products http://addons.oscommerce.com/info/5907

 

which is a much simpler package, but does the same job for the most part.

 

Hey Sam

 

Thanks for your contribution - very easy to install and very effective.

 

One question, are you able to help out with how I would disable the products being listed in products_new.php ? I tried looking for the code as per your instructions, but that file doesn't seem to call from categories.

 

Cheers

Sol

Link to comment
Share on other sites

products_new.php does not look at categories so you would need to refer to PRODUCTS_TO_CATEGORIES then CATEGORIES, but if you simply disable the products within the category that will work, is that not an option?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Hi,

 

I'm trying to install Enable Disable Categories contribution (latest version) I already have the latest version of Header Tags SEO V 3.0.8. http://addons.oscommerce.com/info/5851 I see there are conflicts with adding the code. For example:

 

In EDC it says to add to catalog/admin/categories.php:

 

***FIND:

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

 

***REPLACE WITH:

// BOF Enable & Disable Categories

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, 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)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

// EOF Enable & Disable Categories

 

 

***FIND:

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified 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)$languages_id . "' order by c.sort_order, cd.categories_name");

 

***REPLACE WITH:

// BOF Enable & Disable Categories

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, 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)$languages_id . "' order by c.sort_order, cd.categories_name");

// EOF Enable & Disable Categories

 

 

 

My code that has been changed for Header Tags has already been modified as:

 

/*** Begin Header Tags SEO ***/

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

} else {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description 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)$languages_id . "' order by c.sort_order, cd.categories_name");

/*** End Header Tags SEO ***/

 

As you can see they are different.

 

I haven't progressed any further so I don't know any other conflicts. I also have just installed the Product Extra Fields contribution http://addons.oscommerce.com/info/2202 .

 

Does anyone have these mods on their site with EDC too? And if so can you show me how to incorporate all three without code conflicts?

 

Thanx in advance!

Link to comment
Share on other sites

If you put the comflicting queries on separate lines and line up each word it is easy to see what is missing/added to each query...... I believe your answer is:

 

/*** Begin Header Tags SEO ***/

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

}else{

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description 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)$languages_id . "' order by c.sort_order, cd.categories_name");

/*** End Header Tags SEO ***/

 

Hi,

 

I'm trying to install Enable Disable Categories contribution (latest version) I already have the latest version of Header Tags SEO V 3.0.8. http://addons.oscommerce.com/info/5851 I see there are conflicts with adding the code. For example:

 

In EDC it says to add to catalog/admin/categories.php:

 

***FIND:

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

 

***REPLACE WITH:

// BOF Enable & Disable Categories

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, 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)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

// EOF Enable & Disable Categories

 

 

***FIND:

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified 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)$languages_id . "' order by c.sort_order, cd.categories_name");

 

***REPLACE WITH:

// BOF Enable & Disable Categories

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, 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)$languages_id . "' order by c.sort_order, cd.categories_name");

// EOF Enable & Disable Categories

 

 

 

My code that has been changed for Header Tags has already been modified as:

 

/*** Begin Header Tags SEO ***/

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

} else {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.categories_htc_title_tag, cd.categories_htc_desc_tag, cd.categories_htc_keywords_tag, cd.categories_htc_description 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)$languages_id . "' order by c.sort_order, cd.categories_name");

/*** End Header Tags SEO ***/

 

As you can see they are different.

 

I haven't progressed any further so I don't know any other conflicts. I also have just installed the Product Extra Fields contribution http://addons.oscommerce.com/info/2202 .

 

Does anyone have these mods on their site with EDC too? And if so can you show me how to incorporate all three without code conflicts?

 

Thanx in advance!

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...