Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Always show Category in breadcrumbs when on product page.


evbeej

Recommended Posts

Hello. 

 

If there is another post for this that I have missed, please forgive me. 

 

I am looking for a code edit so that when you click on a product, you always see the category which it resides in. 

 

At the moment, it appears correctly when i click on a category page, then select the subcategory then the product.

 

But the navigation allows customers to bypass the category page and go straight to the subcategory, which then misses the category in the breadcrumbs. 

 

At the moment by selecting the subcategory the breadcrumbs show:

 

home >> SubCategory >> Product. 

 

But I want it to always show the full path, so:

 

home >> Category >> SubCategory >> Product. 

 

Any ideas? 

 

Thank you in advance! 

Link to comment
Share on other sites

You need to ensure that any link direct to a product has either:

 

1.  the FULL cPath

http://demo.oscommerce.com/product_info.php?cPath=3_14&products_id=15

Breadcrumb:   Top » Catalog » DVD Movies » Thriller » DVD-FRAN

or

2.  no cPath

http://demo.oscommerce.com/product_info.php?products_id=15

Breadcrumb:   Top » Catalog » DVD Movies » Thriller » DVD-FRAN

 

If you have the cPath and something is missing from it, then you will have a broken breadcrumb:

 

http://demo.oscommerce.com/product_info.php?cPath=3&products_id=15

Top » Catalog » DVD Movies » DVD-FRAN

Link to comment
Share on other sites

Ok, so as you suggested, it is missing out part of the cPath when i bypass the category page.. 

..but how do i get it to correct that? 

 

Any point in the right direction would be appreciated!  :blush:

Link to comment
Share on other sites

Ok, I think i have fixed this. 

 

I just edited the link on the navigation! so instead of linking it to :

 

<a href='/index.php?cPath=" . $subValue['categories_id']."'></a>

 

i linked it to:

 

<a href='/index.php?cPath=" . $resultValue['categories_id'] . "_" . $subValue['categories_id']."'>

 

Thanks for the help Burt! 

Link to comment
Share on other sites

  • 3 months later...

Archived

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

×
×
  • Create New...