Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Category Title help needed


Guest

Recommended Posts

Hi, does anyone know what code I should use in catalog/includes/languages/english.php to change the "Let's See what we have hear" and display the Category Title of the category the customer is viewing.

 

I have tried editing index.php and the code I found worked but I use the graphical Borders contrib and I can't intergrate it properly.

 

The graphical borders code is pulling the title from english.php ok so I just need to know if it's possible and how to change to the category title.

 

Thanks

Link to comment
Share on other sites

I did this by adding a few lines of code to /catalog/application_top.php

 

// 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;
  }
}

// MODIFY START	
define('CURRENT_HEADING_TITLE', $categories['categories_name']);
// MODIFY STOP

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

// MODIFY START	
define('CURRENT_HEADING_TITLE', $manufacturers['manufacturers_name']);
// MODIFY STOP

 }

 

Then in /catalog/index.php

 

Between

 

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

And

 

} else { // default page

 

Change "HEADING_TITLE" to "CURRENT_HEADING_TITLE".

Link to comment
Share on other sites

I did this by adding a few lines of code to /catalog/application_top.php

 

// 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;
  }
}

// MODIFY START	
define('CURRENT_HEADING_TITLE', $categories['categories_name']);
// MODIFY STOP

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

// MODIFY START	
define('CURRENT_HEADING_TITLE', $manufacturers['manufacturers_name']);
// MODIFY STOP

 }

 

Then in /catalog/index.php

 

Between

 

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

And

 

} else { // default page

 

Change "HEADING_TITLE" to "CURRENT_HEADING_TITLE".

Thanks for the post. I'm at work this evening so I will try your suggestion tomorrow and let you know how I got on.

 

Just to check, is it not possible to leave the code alone and just change the language file to supply this information?

 

Thanks again uscetech, I'll post my results tomorrow.

Link to comment
Share on other sites

Did you take a look at the file catalog/includes/languages/english/index.php ?

 

Thanks for the post. I'm at work this evening so I will try your suggestion tomorrow and let you know how I got on.

 

Just to check, is it not possible to leave the code alone and just change the language file to supply this information?

 

Thanks again uscetech, I'll post my results tomorrow.

Link to comment
Share on other sites

Thanks for the post. I'm at work this evening so I will try your suggestion tomorrow and let you know how I got on.

 

Just to check, is it not possible to leave the code alone and just change the language file to supply this information?

 

Thanks again uscetech, I'll post my results tomorrow.

This suggestion works to a degree, it places the correct category title in the main area header image when viewing a category listing page but now on the index page it is showing the title "CURRENT_HEADING_TITLE"

 

My index page doesn't have separate commands for the <?php echo HEADING_TITLE; ?>.

I have one line to display the title for all the index.php various functions.

 

I think this is why I need to make the change via the launguage file as this line is pulling the different titles correctly, I just need to change the "Let's See What We Have Here" to the category title.

 

Thanks for the suggestion and please post any ideas. I'm very gratefull.

 

Thanks

Link to comment
Share on other sites

I've cracked it for now with some work to do. At present I can't get parent categories name to show if the is a child category within.

Link to comment
Share on other sites

Just to check, is it not possible to leave the code alone and just change the language file to supply this information?

 

Not that I'm aware of.

 

This suggestion works to a degree, it places the correct category title in the main area header image when viewing a category listing page but now on the index page it is showing the title "CURRENT_HEADING_TITLE"

 

Try replacing all of the "HEADING_TITLE" with "CURRENT_HEADING_TITLE" except for the ones after

 

} else { // default page

 

The default page should be left alone so it will say "welcome to my store..."

Link to comment
Share on other sites

Not that I'm aware of.

Try replacing all of the "HEADING_TITLE" with "CURRENT_HEADING_TITLE" except for the ones after

 

} else { // default page

 

The default page should be left alone so it will say "welcome to my store..."

This is the problem I only have one HEADING_TITLE, that's it just one and it give me the title for the home page as well as the category view.

 

I have solved this however. I placed a database query directly above this line and changed the Let's See What We Have Here in the language file to output the results of the query if not on the default index page and it works.

 

It's not perfect as the hack will display the name of a category if it has no sub categories. If a category has sub categories then only the sub category will display not the parent.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...