Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Index page that displays the Categories list


pete_vo

Recommended Posts

Hi there, i am looking to have the index page display the Categories like it is in this site

http://www.lachilli.com/index.php?osCsid=c...869a5f967a9e7cd

 

but i do not know what files i need to look at to start making these amendments, can anyone shed some light on what files i need to start looking at on my own site to get it to display like this site is?

Link to comment
Share on other sites

You would need to create a Categories box for your images. I started with something like the New Products box. Then add fields to your database for the category image (if you want to use a different image than the category page) and a field for text if you want it. The category name is already stored, so just retrieve it. Don't forget to add the new field(s) to the admin/categories.php so you can add the data.

 

I've done this for several stores. I probably should put it up as a Contribution. PM me if you want links to some sample stores. If you want I'll post the code.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Would be awesome if you could paste the code, running into this problem myself :\

 

Ok, I think I have it figured out, to the best of my abilities at least. In the index.php page:

 

  require('includes/application_top.php');

// the following cPath references come from application_top.php
 $category_depth = 'top';

 

I changed this to:

 

  require('includes/application_top.php');

// the following cPath references come from application_top.php
 $category_depth = 'nested';

 

Further down in the code (I was getting a reverse array error), I went from:

 

<?php
if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
  $category_links = array_reverse($cPath_array);

 

To this:

 

<?php
if (isset($cPath)) {
// check to see if there are deeper categories within the current category
  $category_links = array($cPath_array);

 

 

This change basically makes the site to go to index.php?cPath=0 when the page loads.

Link to comment
Share on other sites

That's actually quite clever. I've been trying to think of a case where that wouldn't work, but I can't see any. It's a perfect solution.

 

I'm still going to release my version, since it allows a few options that this method can't do (different images, adding descriptive text, etc.) Even though it's nowhere near as elegant.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...