Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with my subcategory links


rbboyl

Recommended Posts

Hi everyone, new to the forums.

 

I've done a search and didn't see anyone who has experienced this issue.

 

My oscommerce site is www.99jewels.com

 

If you click on a parent category, it displays all sub categories with name and picture in the products area of the site. However, if you notice the link/cPath that it leads you to is incorrect. The first sub-category is always linked to index.php (I've tried changing the sort order and it's still the same) and then the rest of the sub-categories are all off by one number in the child category id number.

 

Example:

 

Click on the parent category "Diamond Charms" in the left category box. The first sub-category is "Good Luck". If you notice, the link for "Good Luck" in the left box is "cPath=14_17" (which is correct) while the link for "Good Luck" in the main product box is to "index.php". You'll also notice that the next sub-category "Love and Flowers" links to "cPath=14_17" which is the path for Good Luck. As you go through each sub-category, you'll see that the cPaths are off by one.

 

I'm not sure how to fix this problem. I've looked at the database and all the parent and child category ids are correct. Has anybody encountered this issue and know where to start troubleshooting?

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 4 weeks later...

I think I fixed it. If anybody wants to try this and let me know if it works. I can't see how it would break anything else...

 

in index.php, lines 97-107 in my installation, may be different because of modules I have installed, but look for:

 

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

$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

 

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';

 

$rows++;

$cPath_new = tep_get_path($categories['categories_id']);

$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

 

 

 

The problem is the $cPath_new = tep_get_path($categories['categories_id']); , it should be set before you print out your first subcategory, so move it up a few lines like so:

 

 

 

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

$cPath_new = tep_get_path($categories['categories_id']);

$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

 

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';

 

$rows++;

$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 3 weeks later...

Archived

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

×
×
  • Create New...