Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Link back to parent categories


jambon

Recommended Posts

This a very quick mod of another mod that replaced the product / category's heading title (the "Let's see what we have here" with the current category's name.

I'm afraid i can't find the topic again so if you know who created the original or if it's you then please make yourself known!

The original used the breadcrumb to insert the current category as the product info title.

 

This places a link below the product or category title that links to it's parent.

 

//////////////////////////////////////////////////////////

 

Open catalog/includes/classes/breadcrumb.php

 

below (around line 20):

 

function breadcrumb() {
     $this->reset();
   }

   function reset() {
     $this->_trail = array();
   }

 

 

insert:

 

// start of added code for category/subcategory link
function lasturl() { $trail_size = sizeof($this->_trail); return

$this->_trail[$trail_size-2]['link'];
}
function lasttitle() { $trail_size = sizeof($this->_trail); return

$this->_trail[$trail_size-2]['title'];
}
// end of added code

 

 

/////////////////////////////////////////////

 

Open catalog/index.php

 

find:

 

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

 

It appears a few times...

 

Below it, or above, or wherever you want it insert this (put it anywhere you like, doesn't have to be near the product title:

 

<td class="back-one">Go back to <a href="<?php echo $breadcrumb->lasturl(); ?>"><?php echo $breadcrumb->lasttitle(); ?></a></td>

 

That's it!

 

Hope this helps someone.

Link to comment
Share on other sites

  • 7 months later...

Archived

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

×
×
  • Create New...