Loaded Commerce Community

Banner


Board index » Loaded Commerce Support » Tips & Tricks

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Sat May 14, 2005 2:32 pm 
Offline
CRE Freak
User avatar

Joined: Wed Feb 09, 2005 1:00 am
Posts: 124
Location: Memphis, TN
Alright, my store had some freaky model numbers, and some customers just didn't understand why those were in the trail, rather than the name of the product.

I personally think it might be better to no even include the product name, since they can clearly see what product they're viewing, however the category trail is a must... in either case, and however you decide to do it, I just wanted to share a quick way to exchange the product model number for the actual name of the product in the breadcrumb trail.

This might also help with search engine optimization, as you're adding yet another link to the internet with your products' name, pointing to your products' page.

In application_top.php, around Line 622, find this:
[php]// 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']));
}
}[/php]

Change it to this:
[php]//4524: Display product name, instead of Product Model, in 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)) {
$prod_name = tep_db_fetch_array($name_query);
$breadcrumb->add($prod_name['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
}
}[/php]



There are other things you might think about doing, like only displaying X number of characters, in case you use long names, and appending "..." in case they do get truncated. Because you don't necessarily want the product name taking up the whole width of the page.

Not to mention that if you have lots of category depth, this might also be more annoying than helpful. But I thought I would share anyway, in case someone finds this useful.

Peaces,

Young Thomas

_________________
www.fourfivetwofour.com
www.tommygeorge.com


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Tue Jun 20, 2006 10:10 am 
Offline
CRE Newbie
User avatar

Joined: Thu Jun 15, 2006 12:00 am
Posts: 10
Hey 4524 this is a great piece of code.
It worked first time and was just what I needed...
Thanks again


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Thu Jun 22, 2006 5:42 am 
Offline
CRE Freak
User avatar

Joined: Wed Feb 09, 2005 1:00 am
Posts: 124
Location: Memphis, TN
Glad it helped.
= )

Just for others' clarification, what exact version of the cart are you using?

I wrote this for 6.15, I believe - and if it works in newer versions, it might help someone else out, just to know that.

_________________
www.fourfivetwofour.com
www.tommygeorge.com


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Sat Jul 01, 2006 4:58 am 
Offline
CRE Newbie
User avatar

Joined: Thu Jun 15, 2006 12:00 am
Posts: 10
I'm using ver 6.2.41 and it worked beautifully
Thanks


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Tue Jun 05, 2007 5:13 pm 
Offline
CRE Freak
User avatar

Joined: Thu Mar 10, 2005 1:00 am
Posts: 46
Great hack ... thanks!


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Thu Jun 21, 2007 2:50 am 
Offline
CRE Newbie
User avatar

Joined: Wed Jun 20, 2007 12:00 am
Posts: 11
Location: Brisbane Australia
:D I was wondering about that..now i don't have to look...thanks.

Running CRE Loaded v 6.2[10.1] here.
Blokes And Sheilas Dot Com

_________________
Blokes And Sheilas Dot Com
[url=http://www.blokesandsheilas.com]
Image[/url]


Top
 Profile  
 
 Post subject: Re: Product NAME in breadcrumb trail, instead of MODEL
PostPosted: Sun Jun 20, 2010 5:48 pm 
Offline
CRE Addict
User avatar

Joined: Wed Aug 29, 2007 7:46 pm
Posts: 191
thank you! This didn't work out of the box on 6.4.1a but just had to do a little updating to make it work

Replace this
Code:
// add the products model to the breadcrumb trail
if (isset($_GET['products_id']) && $_GET['products_id'] != '') {
  $products_id = (int)$_GET['products_id']; 
  $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
  if (tep_db_num_rows($model_query)) {
    $model = tep_db_fetch_array($model_query);
    if (tep_not_null($model['products_model'])){
      $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $_GET['products_id']));
    }
  }


With this
Code:
// add the products name to the breadcrumb trail
if (isset($_GET['products_id']) && $_GET['products_id'] != '') {
  $products_id = (int)$_GET['products_id']; 
  $name_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $products_id . "'");
  if (tep_db_num_rows($name_query)) {
    $prod_name = tep_db_fetch_array($name_query);
    if (tep_not_null($prod_name['products_name'])){
      $breadcrumb->add($prod_name['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $_GET['products_id']));
    }
  }


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

Board index » Loaded Commerce Support » Tips & Tricks

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Wed May 23, 2012 7:40 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy