Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Removing categories from the categories box


Guest

Recommended Posts

Hi folks,

 

I've had a search around but I can't seem to find anything on this, apologies if it's been mentioned before because it's quite a simple thing.

 

I'm trying to edit categories.php so that the last 3 categories aren't displayed in the categories box. I still want the categories to be fully functional, and accessible by the user, but from different routes (so the contribution based on removing categories doesn't seem to be relevant in this case).

 

I was looking at the php file and when it counts the number of categories I basically want something like "Total - 3".... but I don't know enough about php to do this...... if anyone can offer any tips, that would be great - or even if you could just point me at the bit of code I need to look at, I might be able to figure it out myself from there.

 

Cheers!

Sam

Link to comment
Share on other sites

Nevermind, I decided to do it another way instead - sorry for the spam....

 

... but feel free to answer the question if you want - it might help other people.

Link to comment
Share on other sites

You can use enable disable categories http://www.oscommerce.com/community/contri...ons,326/page,23

 

As you can still view the categories is you know the correct url for them. They are just disabled in admin so you cant view them in the catalog menu. Not sure if the newer versions fixed it so that you cant view the page in the catalog if its a disabled category but in the older versions you can..

 

At least that gives you a start

 

PS the products wont show up in new products etc if there in a disabled category..

Link to comment
Share on other sites

Hi folks,

 

I've had a search around but I can't seem to find anything on this, apologies if it's been mentioned before because it's quite a simple thing.

 

I'm trying to edit categories.php so that the last 3 categories aren't displayed in the categories box. I still want the categories to be fully functional, and accessible by the user, but from different routes (so the contribution based on removing categories doesn't seem to be relevant in this case).

 

I was looking at the php file and when it counts the number of categories I basically want something like "Total - 3".... but I don't know enough about php to do this...... if anyone can offer any tips, that would be great - or even if you could just point me at the bit of code I need to look at, I might be able to figure it out myself from there.

 

What do you mean by the last three ? Like - you don't want the last three ever displayed ? no matter what they ever are ?

Or do you mean - there are three categories that exist that you do not want diplayed ?

 

If it's the latter, edit your /includes/boxes/categories.php query from this :

$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");

 

and add in a removal clause in your query like thi s: and c.categories_id not in ('2','3') or whatever your category numbers are. So to not display the categories 2 and 3, change to this :

$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 ."' and c.categories_id not in ('2','3') order by sort_order, cd.categories_name");

 

OR - if you only want to ever not display the last 3 categories, whatefver they are, you'll need a aggregated statement using limit and offset parameters. This is very ricky though! You'll also need to add a good orrder by clause if this is the case.

 

davidinottawa

Link to comment
Share on other sites

OR - if you only want to ever not display the last 3 categories, whatefver they are, you'll need a aggregated statement using limit and offset parameters. This is very ricky though! You'll also need to add a good orrder by clause if this is the case.

 

Yeah that was what I needed to do, but I bascially decided that was way too much effort for what I was trying to do so I came up with different approach to the site rather than a solution in php! Everybody's happy :-" (unless someone else is trying to do this... in which case good luck!

 

What I am having problems with now is something (which I think) should be much more simple, but I'm having a tough time getting my head round it (I'll keep it in this thread to save spamming with a new one).

 

I want to basically create a page which just contains the boxes round the edge, but no content in the centre - a page that I can add custom content to later on. Now... this seems simple enough to me but I'm staring at index.php and scratching my head - since stuff from all different files is being used it's really hard for me to determine what to keep and what to get rid of. Can anyone think of a quick solution to this, or better yet a file somewhere in osCommerce that I've overlooked which is something like this?

 

Thanks again for the replies above!

Link to comment
Share on other sites

I'll answer my own question in case it's of use to anyone else.

 

I found shipping.php to be the easiest file to modify, you only need to change shipping.php in the /catalog directory and shipping.php in the catalog/includes/languages/english directory. It's kind of self explanatory when you look at the files and from this you can create a 'custom' page so to speak.

 

I wanted to use it for a sort of philosophy of the store page, but you could use it for a links page or whatever. I also read somewhere that there is a contribution out there that allows something similar, but this is so simple I don't think a contribution is needed?!

 

Cheers for the help above anyway.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...