Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with Display Category Name In Main Content


ozstar

Recommended Posts

HI,

 

This seems to be just what I need however I can't get it to work even with the update changes.

 

Display Category Name In Main Content by Nik Le Page

 

Two files to change..

 

1. catalog/inc/lang/eng/index.php

 

- works (it just changes the title "Look what we see'

 

 

2. catalog/index.php

- doesn't seem to work - only puts a "/" where the actual Catalog name should be.

 

This is the code

 

In /catalog/index.php, find this code (line 232 in clean osCommerce v2.2 MS) -

 

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<?php

// optional Product List Filter

 

 

to something like:

 

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading">

<?php

// hacked to display current category name in main content area! Nik

echo HEADING_TITLE . '\'' . $tree[$current_category_id]['name'] . '\'';

?>

</td>

 

<?php

// optional Product List Filter

Link to comment
Share on other sites

  • 2 weeks later...

I have had this contrib installed for some time and noticed soon after installing that all I got most of the time was blank where the tree name was supposed to be.

 

I'm just now revisiting it and am finding that it seems no one else has a solution either.

 

If anyone has a solution it would be great to hear from you.

I beleive it's just not the right call function, but not being a php'er only hacker at best I don't know what to do with it.

 

 

HI,

 

This seems to be just what I need however I can't get it to work even with the update changes.

 

Display Category Name In Main Content by Nik Le Page

 

Two files to change..

 

1. catalog/inc/lang/eng/index.php

 

- works (it just changes the title "Look what we see'

2. catalog/index.php

- doesn't seem to work - only puts a "/" where the actual Catalog name should be.

 

This is the code

 

In /catalog/index.php, find this code (line 232 in clean osCommerce v2.2 MS) -

 

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<?php

// optional Product List Filter

to something like:

 

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading">

<?php

// hacked to display current category name in main content area! Nik

echo HEADING_TITLE . '\'' . $tree[$current_category_id]['name'] . '\'';

?>

</td>

 

<?php

// optional Product List Filter

Link to comment
Share on other sites

I have had this contrib installed for some time and noticed soon after installing that all I got most of the time was blank where the tree name was supposed to be.

 

I'm just now revisiting it and am finding that it seems no one else has a solution either.

 

If anyone has a solution it would be great to hear from you.

I beleive it's just not the right call function, but not being a php'er only hacker at best I don't know what to do with it.

 

 

Just found the answer here: http://www.oscommerce.com/forums/index.php?showtopic=167121&hl=

 

Replace this, as per this particular contribution.

<?php echo HEADING_TITLE . '\'' . ($tree[$current_category_id]['name']) . '\''; ?>

 

With this

<?php echo HEADING_TITLE . '\'' . $category['categories_name'] . '\''; ?>

 

And add this just above. (See more detail below)

  $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query);

 

What you need to end up with is this.

	  }
  }

 $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query);
?>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE . '\'' . $category['categories_name'] . '\''; ?></td>

 

I've actually tweeked mine a little further so the catagory name stands out better and it can be done to your desire but you should get the idea from the example below.

<?php echo '<font size="2">' . HEADING_TITLE . '</font>\'' . $category['categories_name'] . '\''; ?>

 

I had a hunch this sort of query would be required, I'm glad someone else was able to get a working function for this. Thanks very much go to the author this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...