Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Breadcrumb in store only showing lowest level category and product


beechrose

Recommended Posts

Someone PLEASE help. I am so stumped and I have no idea what I'm looking at. I'm only a newbie to PHP code and I'm afraid I have no idea how to fix this.

 

I wanted my store to show the product name in the breadcrub, so I installed this contrib to my store:

 

http://www.oscommerce.com/community/contri...arch,breadcrumb

 

Now it shows the right breadcrumb ONLY in the lowest-level subcategory or the product info page. In all the other categories and subcategories pages, it only shows ITEM CATEGORIES (what I set as the default language to say in the headers). Even if it's a subcategory, it only shows ITEM CATEGORIES in the header. Only when you get to either the deepest-level subcategory page or the product info page itself does it show (for example) Shop >> Furniture >> Lamps >> Desk Lamps >> Gray Clip-on Lamp.

 

Here is the code in my application_top.php that is relevant to the breadcrumbs:

 

// include the breadcrumb class and start the breadcrumb trail
 require(DIR_WS_CLASSES . 'breadcrumb.php');
 $breadcrumb = new breadcrumb;

//  $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

// add category names or the manufacturer name to the breadcrumb trail
 if (isset($cPath_array)) {
   for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
     $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
     if (tep_db_num_rows($categories_query) > 0) {
       $categories = tep_db_fetch_array($categories_query);
       $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
     } else {
       break;
     }
   }
 } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
   $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
   if (tep_db_num_rows($manufacturers_query)) {
     $manufacturers = tep_db_fetch_array($manufacturers_query);
     $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
   }
 }

// add the products model to the breadcrumb trail
//  if (isset($HTTP_GET_VARS['products_id'])) {
//    $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
//    if (tep_db_num_rows($model_query)) {
//      $model = tep_db_fetch_array($model_query);
//      $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
//    }
//  }
// add the products name to the breadcrumb trail
if (isset($HTTP_GET_VARS['products_id'])) {
$model_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
if (tep_db_num_rows($model_query)) {
$model = tep_db_fetch_array($model_query);
$breadcrumb->add($model['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
}
}

 

My client is having me use a template purchased from TemplateMonster; however, I re-uploaded the original OSC application_top.php and all that does is not show the product name on the product info page's breadcrumb. It is still not showing any breadcrumb except at the deepest level of subcategory.

 

Can anyone shed some light on what's going on???? Thank you :(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...