Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with a couple of lines of PHP


ComicWisdom

Recommended Posts

I am trying to change the heading titles on my pages to match the category level being viewed.

 

When a top category is listed, I want the page heading to read ‘Available Species.”

I have that figured out with this.

 

define('HEADING_TITLE', 'Available Species');

 

What I think I need to do is to add 2 new definitions, as below, one for the next category level down that will read “Available Specimen,” and another for anything that doesn’t fit in these categories like “accessories” which will have a blank heading or at least a heading on a template page.

 

 
define(SUBCAT_HEADING_TITLE’, ‘Available Specimen’);
define (ACCCAT_HEADING_TITLE’, ‘ ‘);

 

The problem is that I don’t know how to phrase the “if” statement to make the program substitute headings.

 

Could someone help please?

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

I am trying to change the heading titles on my pages to match the category level being viewed.

 

When a top category is listed, I want the page heading to read ‘Available Species.”

I have that figured out with this.

 

define('HEADING_TITLE', 'Available Species');

 

What I think I need to do is to add 2 new definitions, as below, one for the next category level down that will read “Available Specimen,” and another for anything that doesn’t fit in these categories like “accessories” which will have a blank heading or at least a heading on a template page.

 

 
define(SUBCAT_HEADING_TITLE’, ‘Available Specimen’);
define (ACCCAT_HEADING_TITLE’, ‘ ‘);

 

The problem is that I don’t know how to phrase the “if” statement to make the program substitute headings.

 

Could someone help please?

 

Hi Ralph,

 

What I tend to do is reference the cPath number in the URL bar.

 

For example:

 

If you are viewing the "Available Specimen" page, you will notice in the address (URL) bar there will be something similar to...

 

index.php?cPath=30& PHPSESSID

 

You simply reference to the cPath number...

 

if ($HTTP_GET_VARS['cPath'] == '30')
{
		 echo '<tr>
			<td><span class="headingMatt">' . HEADING_TITLE; .' </span></td>
		  </tr>';			  
}
else if($HTTP_GET_VARS['cPath'] == '24')
{				
		 echo '<tr>
			<td><span class="headingMatt">' . OTHER_HEADING_TITLE; .' </span></td>
		  </tr>';
}

 

Try something along those lines.

You could also search through the Contributions because I'm pretty sure there will be something for this.

Link to comment
Share on other sites

Hi Ralph,

 

What I tend to do is reference the cPath number in the URL bar.

 

For example:

 

If you are viewing the "Available Specimen" page, you will notice in the address (URL) bar there will be something similar to...

 

index.php?cPath=30& PHPSESSID

 

You simply reference to the cPath number...

 

if ($HTTP_GET_VARS['cPath'] == '30')
{
		 echo '<tr>
			<td><span class="headingMatt">' . HEADING_TITLE; .' </span></td>
		  </tr>';			  
}
else if($HTTP_GET_VARS['cPath'] == '24')
{				
		 echo '<tr>
			<td><span class="headingMatt">' . OTHER_HEADING_TITLE; .' </span></td>
		  </tr>';
}

 

Try something along those lines.

You could also search through the Contributions because I'm pretty sure there will be something for this.

 

This would work great with top level categories and I am using it in spots, but I need the lower level categories to change. For example:

 

NOT

index.php?cPath=30& PHPSESSID

 

BUT

index.php?cPath=30_1& PHPSESSID

Or

index.php?cPath=467_322& PHPSESSID

 

And all those in between. So I'm sure it has to be written in code that would express it by level. I think. Though I don't know how.

 

There are 26-30 categories that would be titled "Available Species".

About 3500 subcategories that would be labled "Available Specimens"

 

I have looked through the contributions but have found nothing close.

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

I think this one might work better for your situation

http://www.oscommerce.com/community/contributions,4294

Gives each category andsub cat its own page heading and descriptions. (good for seo)

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

Thank you for the help. So far, I am two-thirds of the way there.

 

 

By analysing the contribution.:

http://www.oscommerce.com/community/contributions,1954

which gives the directions:

 

"In catalog/index.php (back it up first!), change the first 2 occurrences of HEADING_TITLE (line 76 & line 254)."

 

I have discoverd that I can change the second occurence of HEADING_TITLE to SUBCAT_HEADING_TITLE and I get exactly what I want for my first two needs.

 

Categories show: Available Species

SubCategories show: Available Specimen

 

Now if I can only figure out what to do with the group of Accessories so that these pages of which there are only a few and have their titles in their template, show nothing at all, I'll be all set.

 

Any more ideas out there?

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...