Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Name in breadcrumb trail


Acheron

Recommended Posts

IMHO, it seems odd that the breadcrumb trail would show the product model but not the name. Anyway, easy enough to replace but I know many here know nothing about PHP/SQL soooo ...

 

In /catalog/includes/applicationtop.php FIND:

 

// 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']));
   }
 }

 

 

REPLACE with:

 

// 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'])) {
   $name_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($name_query)) {
     $name = tep_db_fetch_array($name_query);
     $breadcrumb->add($name['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
   }
 }

 

 

You could of course simply remove the old code instead of commenting it out, but I commented it out in case I (or you) wants to use it later. i.e. perhaps you want the breadcrumb to instead look like Manufacturer Product Name Product Model

Link to comment
Share on other sites

for section commenting out you could use /* at the beginning and */ at the end instead of line by line

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Hi

 

The code is working fine. Had to change something for MS2.1, but that was quick.

None the less if you run more than one language, like me, and you want the product names be displayed in the local language, than make the following change on Acherons code:

 

?if (isset($HTTP_GET_VARS['products_id'])) {

? ?$name_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'and language_id='" . $languages_id . "'");

 

and here the code for all of you who love copy & past :P

 

// 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 see http://www.oscommerce.com/forums/index.php?showtopic=94284
//
?if (isset($HTTP_GET_VARS['products_id'])) {
? ?$name_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'and language_id='" . $languages_id . "'");
? ?if (tep_db_num_rows($name_query)) {
? ? ?$name = tep_db_fetch_array($name_query);
? ? ?$breadcrumb->add($name['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
? ?}
?}

 

Cheers

 

Rich

B)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...