Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help: Category Name instead of "Lets see what we have h


Snowman

Recommended Posts

  • Replies 101
  • Created
  • Last Reply
  • 4 weeks later...
  • 1 year later...

Where do you put this at? I know about the

 

<td class="pageHeading"><?php

echo $category['categories_name'];

?></td>

 

for the first entry of HEADING_TITLE.

 

Have things changed since 2005?

 

 

	  <?php 
  if (isset($HTTP_GET_VARS['manufacturers_id'])) {  
$category_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
$category = tep_db_fetch_array($category_query);
if ($category['manufacturers_name'] != "") {echo $category['manufacturers_name'];} else { echo HEADING_TITLE;}
  } else {
$main_cat_id = explode("_",$cPath);
$heading_title_display = "";
$where_to_start = count($main_cat_id);
if ($where_to_start == 1) {
	$sql = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id='" . $main_cat_id[0] . "'and language_id = '" . (int)$languages_id . "'");
	$row = tep_db_fetch_array($sql);
	$heading_title_display .= $row["categories_name"];
	}
if ($where_to_start > 1) {
	for ($test=1; $test<count($main_cat_id); $test++){
  $sql = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id='" . $main_cat_id[$test] . "'and language_id = '" . (int)$languages_id . "'");
  $row = tep_db_fetch_array($sql);
  $heading_title_display .= $row["categories_name"];
  if($test < (count($main_cat_id)-1)){$heading_title_display .= " - ";}
	}
}
if ($heading_title_display != "") {echo $heading_title_display;} else { echo HEADING_TITLE;}
  }
  ?>

Link to comment
Share on other sites

Just as an add on in OSC2.2MS2 the 'Let's see what we have here' for manufactures can be easily be changed using the code below. This includes the category name change as well

 

in

catalog/includes/languages/english/index.php

 

change the code from

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {
 define('HEADING_TITLE', 'Let\'s See What We Have Here');
 define('TABLE_HEADING_IMAGE', '');
 ...
 ...
} elseif ($category_depth == 'nested') {
 define('HEADING_TITLE', 'Categories');
}

 

to

 

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {
 if (isset($HTTP_GET_VARS['manufacturers_id'])) {
   define('HEADING_TITLE', $manufacturers['manufacturers_name']. ' Products');
 }
 else{
   define('HEADING_TITLE', $categories['categories_name']);
 }
 define('TABLE_HEADING_IMAGE', '');
 ...
 ...
} elseif ($category_depth == 'nested') {
 define('HEADING_TITLE', $categories['categories_name']);
}

 

Rob

 

You 'da man

 

Much simpler, yet very effective code

Link to comment
Share on other sites

Hi

 

I would really like to do this as well...(replace the 'lets see what we have here then' with the current chosen catagory)

 

Firstly after reading above..I do not have a default.php file. I have searched the whole catalogue directory and it finds no such file..why is that?

 

My copy of os-commerce is very recent, only a couple of weeks a go.

 

Secondly, is there a clean concise method for doing this project anywhere..I have checked the help pdf files and it is not in there. Can a site guru sum it up for us?

 

Thanks Si

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...

Thanks for this fix! (It really should be included in the OSC2.2 stable release.)

 

It works great... except that on the Home Page, the heading above the new items shows:

TABLE_HEADING_NEW_PRODUCTS

 

After clicking on a Category, other pages do no show the Manufacturer, Product, etc.

 

Our old store was in WS4D, which is now orphaned & obsolete. Now, I'm a newbie again with OSC, and clueless about PHP, but did attempt to puzzle out the code. It appears that there is supposed to be heading image to go on index.php. Is that correct, and if so, do I need to create that image?

 

 

Actually, having the latest items displayed as per their "entered date" is pretty useless to me. We add merchandise to our catalog all the time, and the order of entry has very little to do with the desirability of Featuring them on the Home Page.

 

Is there some way to have the Home Page show "Featured Items" instead? Maybe put some items into a "Featured" category, then force the Featured category to display on the index page when someone visits the site?

 

Thanks to all for the great assistance here!

Link to comment
Share on other sites

I wish they were all this easy.

 

Thanx man. Worked perfectly first rattle out of the box.

 

Sterling

Sterling (a.k.a. DailyLunatic)

Useful Threads: Basics for Design.

Useful URL's: Knowledge Base, SQL Tutorial,

My Setup: Master Products v1.2, Need help installing Bundled Products v1.4.

Link to comment
Share on other sites

Change the define to

 

define('HEADING_TITLE', $categories['categories_name']);

then a little below that change

 

the nested define from

 

} elseif ($category_depth == 'nested') {

define('HEADING_TITLE', 'Categories');

 

to

 

} elseif ($category_depth == 'nested') {

define('HEADING_TITLE', $categories['categories_name']);

 

HTH

Tom

thanks! this worked for me!

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Works great, thanks for the solution. BUT... is there any way to alter the look of the category text itself, such as to add bold or a color or font change? I have tried, but keep getting parse errors on my pathetic attempts.

Link to comment
Share on other sites

Works great, thanks for the solution. BUT... is there any way to alter the look of the category text itself, such as to add bold or a color or font change? I have tried, but keep getting parse errors on my pathetic attempts.

 

stylesheet.css in your main directory. all formatting is defined there.

Open it in a WYSIWYG html editor and play around with the file. Surely you'll get it!

Link to comment
Share on other sites

Hey All,

 

I've read through this thread hoping to find the answer to my question. I've come close, but just can't find what I'm looking for. Hopefully some kind soul will aim me in the right direction.

 

I'm trying to edit the page that starts with 'Let's See What We Have Here' to remove the graphic at the right end of that line and I can't find the correct file. I've looked everywhere I can think of, but obviously I'm not thinking correctly. What file do I need to edit?

 

Also, I'm working on commenting the stylesheet.css file so that anyone can (easily) tell what segment the code controls. Not done yet, but getting close. Is something like this worth posting for others to use/see?

 

Dave

Link to comment
Share on other sites

Works great, thanks for the solution. BUT... is there any way to alter the look of the category text itself, such as to add bold or a color or font change? I have tried, but keep getting parse errors on my pathetic attempts.

 

After making the above change to get the category to show up instead of "Let's see what we have here", I viewed the HTML page source for the resulting page. I searched for "CDROM Drives Category" (I added the word 'Category' to my code), and the HTML code just before it, "class="pageHeading", tells me what to change in the CSS file to affect the attributes of this line of text:

 

...
<!-- start Default Content //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td [color="#FF0000"]class="pageHeading"[/color]>CDROM Drives Category</td>
           <td align="right"><img src="images/subcategory_cdrom_drives.gif" border="0" alt="CDROM Drives Category" title=" CDROM Drives Category " width="57" height="32"></td>
         </tr>

       </table></td>
...

 

In the file "stylesheet.css" in your catalog root directory you'll find this code, this is where you change the attributes for the "category" text:

...
TD.[color="#FF0000"]pageHeading[/color], DIV.pageHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 20px;
 font-weight: bold;
 color: #9a9a9a;
}
...

Link to comment
Share on other sites

Hello Again,

The code I am interested in is Category Name instead of

'Let's See What We Have Here"

Thanks Again

O.K.,

Problem SOLVED!!!

 

Solution was not posted clear enough for a newbee.

 

(modified from original post, this thread, #31, Ocean Ranch.)

 

 

The file to change is in catalog/includes/languages/english/index.php

 

Change

 

define ('HEADING_TITLE','Let\'s See What We Have Here');

 

to

 

define (HEADING_TITLE', $categories_name']);

 

Change

 

elseif ($category_depth == 'nested') {

define ('HEADING_TITLE', 'Categories');

 

to

elseif ($category_depth == 'nested') {

define ('HEADING_TITLE', $categories['categories_name']);

 

And Yes this code does work for new release candidates. (I am using in RC-2a)

Link to comment
Share on other sites

  • 3 weeks later...

@ rivercity - I tried this (I'm on RC2a also), but it just puts $categories_name at the top of the list, rather than the category name. It works for nested things, ie, if you click on a category and it then shows the sub-categories, the main category name is at the top. But if you're in any category that has no more sub-categories then it says $categories_name.

 

Hope that makes sense.

 

EDIT: Sorted it. This is what I did:

 

Change

 

define ('HEADING_TITLE','Let\'s See What We Have Here');

and

elseif ($category_depth == 'nested') {
define ('HEADING_TITLE', 'Categories');

 

to

 

define ('HEADING_TITLE', $categories['categories_name']);

and

elseif ($category_depth == 'nested') {
 define ('HEADING_TITLE', $categories['categories_name']);

 

Basically, I just made gave both statements $categories['categories_name']

Link to comment
Share on other sites

Okay, I've got the category name to display rather than the default 'Let's See What We Have Here'. Now, I've got two additional items I'd like to include - one minor and one that has been driving me nuts.

 

The minor item - I'd like to add the text 'What's in' in front of the category name, so that it reads 'What in 'category name'. I can get the text (What's in) to display, but for some reason, the category name won't display with the text - I seem to be trapped in an either/or circle. Any idea on the correct syntax?

 

The 'driving me nuts' item - I would really, really like to remove the image to the far right of the (new) category name. I've tried everything that I could find, but nothing has succeeded. The best I have gotten is a broken image indicator

 

Any thoughts on these two items?

 

TIA

 

Dave

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

For osCommerce-2.2rc2 - Here is the code to change Let's See What We Have Here to the Category Name. This works for sub-categories as well (at least in my test) This code was borrowed from an earlier post being used for a much earlier version of osCommerce and I have tested in two different osCommerce -2.2rc2 stores and it works. The directions for inserting the code weren't exactly clear, so I am posting this for clarification.

 

Hack: Add Category Name over Product Listings instead of Let’s See What We Have Here

 

Open catalog/index.php and find:

 

require('includes/application_top.php');

 

After it, insert:

 

//category name hack starts

 

function tep_get_category_name($category_id) {

 

global $languages_id;

 

$category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $languages_id . "'");

 

$category = tep_db_fetch_array($category_query);

 

return $category['categories_name'];

 

}

 

//category name hack stops

 

Then find all references to:

 

<?php echo HEADING_TITLE; ?>

 

and change to:

 

<?php echo tep_get_category_name($current_category_id); ?>

 

Then open categories/includes/languages/english/index.php, find:

 

define('HEADING_TITLE', 'Let\’s See What We Have Here');

 

And change to:

 

define('HEADING_TITLE', $current_category_id);

 

Then find:

 

elseif ($category_depth == 'nested') {

define('HEADING_TITLE', 'Categories');

 

And change to:

 

elseif ($category_depth == 'nested') {

define ('HEADING_TITLE', $categories['categories_name']);

 

 

Post these files to the server in their corresponding locations. Check your catalog to view the Category Headings over the Product Listing. Remember, always back up your files before making changes.

Link to comment
Share on other sites

For osCommerce-2.2rc2 - Here is the code to change Let's See What We Have Here to the Category Name. This works for sub-categories as well (at least in my test) This code was borrowed from an earlier post being used for a much earlier version of osCommerce and I have tested in two different osCommerce -2.2rc2 stores and it works. The directions for inserting the code weren't exactly clear, so I am posting this for clarification.

 

Hack: Add Category Name over Product Listings instead of Let’s See What We Have Here

 

Open catalog/index.php and find:

 

require('includes/application_top.php');

 

After it, insert:

 

//category name hack starts

 

function tep_get_category_name($category_id) {

 

global $languages_id;

 

$category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $languages_id . "'");

 

$category = tep_db_fetch_array($category_query);

 

return $category['categories_name'];

 

}

 

//category name hack stops

 

Then find all references to:

 

<?php echo HEADING_TITLE; ?>

 

and change to:

 

<?php echo tep_get_category_name($current_category_id); ?>

 

Then open categories/includes/languages/english/index.php, find:

 

define('HEADING_TITLE', 'Let\’s See What We Have Here');

 

And change to:

 

define('HEADING_TITLE', $current_category_id);

 

Then find:

 

elseif ($category_depth == 'nested') {

define('HEADING_TITLE', 'Categories');

 

And change to:

 

elseif ($category_depth == 'nested') {

define ('HEADING_TITLE', $categories['categories_name']);

Post these files to the server in their corresponding locations. Check your catalog to view the Category Headings over the Product Listing. Remember, always back up your files before making changes.

I tried this but now get:

 

Parse error: syntax error, unexpected T_ELSEIF in /home/effortle/public_html/hair/includes/languages/english/index.php on line 38

 

Any suggestions?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...