Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * - 4 votes

Header Tags for novices


771 replies to this topic

#41 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 30 January 2007, 00:29

Hi Allen

Sorry to hear that the problem is still there and I think I understand. Ive been working on a site for the big valentine season the whole evening & 2morrow as well, so for give me not to have the time to look at it in details :( as I am not familiar with STS. ONce I get the time I will take a look as many people seem to use STS.

Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#42 bigal50

  • Community Member
  • 16 posts
  • Real Name:Allen

Posted 30 January 2007, 02:10

Hi Ken,

Found a post in Tips and Tricks with the answer

As always BACKUP before making any changes

In catalog/includes/modules/sts_inc/general.php

Look for the following, around line 67
$sts->template['headertags']= "<title>" . TITLE ."</title>";

Replace with the following
// Header Tags for novices w/STS BOF
	$sts->template['headertags']= "<title>";
	$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') : TITLE;
	$sts->template['headertags'] .= "</title>";
	$sts->template['headertags'] .= "<meta name=\"description\" content=\"";
	$sts->template['headertags'] .= (strlen($product_info_tags['products_description']) > 10) ? strip_tags($product_info_tags['products_description']) : strip_tags($breadcrumb_tags->trail_tags(' '));
	$sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\"";
	$sts->template['headertags'] .= strip_tags($breadcrumb_tags->trail_tags(', '));
	$sts->template['headertags'] .= "\">";
// Header Tags for novices w/STS

Thanks to Egor for this code. I only copied it to this thread

Thanks Ken for the great contrib and trying to help me with this. You might want to add this to your docs to make it easier for others with STS to use Header Tags for novices.

Thanks
Allen

#43 bigal50

  • Community Member
  • 16 posts
  • Real Name:Allen

Posted 30 January 2007, 03:38

After a little testing it seems that there might be a flaw in the above code, at least on my site. It is only putting the Store Name - Catagory - Catagory in the title and just the catagory in Description and Keywords. Could be that I'm using a different version of STS that what Egor was using, I'm using STS v4.3.3

Here is part of the header from a product page
<head>
					
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Parts and Things - DVD Movies</title><meta name="description" content="DVD Movies"><meta name="keywords" content="DVD Movies"><base href="http://www.partsanthings.com/catalog/">


Allen

#44 bigal50

  • Community Member
  • 16 posts
  • Real Name:Allen

Posted 30 January 2007, 04:53

This may not be the best solution but it seems to work on my site, it's closer to Ken's original contrib in the way it places thing in the title, description & keywords.

Don't forget BACKUP before editing files.

In catalog/includes/modules/general.php around line 68

Find the following
$sts->template['headertags']= "<title>" . TITLE ."</title>";

Replace with this
// Header Tags for novices w/STS v4.3.3 BOF
 
	$sts->template['headertags']= "<title>";
  //  $sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') : TITLE;
	$sts->template['headertags'] .= $header_tags[title_tag];
	$sts->template['headertags'] .= ' - ' . TITLE;
	$sts->template['headertags'] .= "</title>";
	$sts->template['headertags'] .= "<meta name=\"description\" content=\"";
	$sts->template['headertags'] .= $header_tags[desc_tag];
	$sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\"";
	$sts->template['headertags'] .= $header_tags[keywords_tag];
	$sts->template['headertags'] .= "\">";
	
 // Header Tags for novices EOF

This works with the catalog/admin/header_tags_edit.php too.


Allen

Edited by bigal50, 30 January 2007, 04:56.


#45 Patty

  • Community Member
  • 245 posts
  • Real Name:Patricia
  • Gender:Female
  • Location:Brazil

Posted 30 January 2007, 17:55

Very nice contribution, thank you for making it available. :thumbsup:

Someone has posted the same kind of error I'm getting, but there was no solution posted as of yet:

Quote

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

select count(*) as total from products p, products_description pd where p.products_id = pd.products_id and pd.language_id = '4'order by

[TEP STOP]

This happens when I click the Update button or when I go to the next page.
I have no other errors on my admin, everything seems to be working fine.

Could you please shed a light? Although I'm no noobie to osCommerce and PHP and MySQL, I'm no programmer.

TIA for your help.
Patty

#46 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 30 January 2007, 21:42

Hi Patty

As far as I am concerned, this is a strange error and it seems it doesnt mean what it says as you'd notice there's no such query as 'select count as total' in the header tags edit php file. The first person who reported the problem was Toby but unfornately there's no further response from him. AS this problem seems only happen to some people and I my self cannot re-produce the problem whatsoever (php4, php 5, mysql 4, mysql 5), I guess although not comclusive it may be something to do with the setup of your osc shop. It'd be useful for future investigation if you'd state how you access this header tags edit, ie, is it via a link in the catalog box or directly key in the file name in the address bar?

Good Luck!

Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#47 Patty

  • Community Member
  • 245 posts
  • Real Name:Patricia
  • Gender:Female
  • Location:Brazil

Posted 30 January 2007, 21:48

Hey, Ken. Tks for your reply.

It turned out the problem seems to occur only on older versions of MySQL. I noticed the version on my local machine was 3, so I upgrade it and the error is gone. :)

Tks for such a great and easy contribution. Everything is working great now. :thumbsup:
Patty

#48 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 30 January 2007, 21:56

Quote

...occur only on older versions of MySQL. I noticed the version on my local machine was 3, so I upgrade it and the error is gone. ..
Goodness me! I'd never ever thought there's still mysql 3 going around in this 21th century!
Anyway, good to hear you got it work.

Regards,

Ken

Edited by GemRock, 30 January 2007, 21:57.

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#49 Patty

  • Community Member
  • 245 posts
  • Real Name:Patricia
  • Gender:Female
  • Location:Brazil

Posted 30 January 2007, 22:01

Actually, I still don't understand why my version was 3.23.49. I use xampp 1.5.5, latest version, and it says MySQL version is 5. So I just reinstalled it, and although it's still showing v3.23.49 for MySQL, the error didn't happen again.

As a suggestion, it would be nice if the list of products on the edit page could link directly to each product on the store. ;)

Edited by Patty, 30 January 2007, 22:02.

Patty

#50 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 30 January 2007, 22:37

View PostPatty, on Jan 30 2007, 10:01 PM, said:

...it would be nice if the list of products on the edit page could link directly to each product on the store...
Dont understand what you mean?

Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#51 Patty

  • Community Member
  • 245 posts
  • Real Name:Patricia
  • Gender:Female
  • Location:Brazil

Posted 31 January 2007, 14:05

Hey, Ken.

I mean, clicking in one product on the Edit Tag page list will take to the product information page on the store. That would be nice. ;)
Patty

#52 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 31 January 2007, 16:02

Hi Patty

I dont know why you want it, but anyway it can be done I think:

1. Open header tags edit php, find this line (about line 221):
echo "<td class=\"smallText\" align=\"left\">".$products['products_name']."</td>\n";
Replace it with:
echo "<td class=\"smallText\" align=\"left\"><a href=" . tep_href_link_shop('product_info.php?products_id='. $products['products_id']). ">".$products['products_name']."</a></td>\n";
Save & close.

2. copy the code below & paste it into html_output.php under admin/includes/functions/, just before the closing ?> at the end of the file:
// The HTML href link wrapper function used in header tags edit HT4N - GemRock
  function tep_href_link_shop($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
	global $request_type, $session_started, $SID;

	if (!tep_not_null($page)) {
	  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
	}

	if ($connection == 'NONSSL') {
	  $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
	} elseif ($connection == 'SSL') {
	  if (ENABLE_SSL == true) {
		$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
	  } else {
		$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
	  }
	} else {
	  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
	}

	if (tep_not_null($parameters)) {
	  $link .= $page . '?' . tep_output_string($parameters);
	  $separator = '&';
	} else {
	  $link .= $page;
	  $separator = '?';
	}

	while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
	if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
	  if (tep_not_null($SID)) {
		$_sid = $SID;
	  } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
		if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
		  $_sid = tep_session_name() . '=' . tep_session_id();
		}
	  }
	}

	if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
	  while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

	  $link = str_replace('?', '/', $link);
	  $link = str_replace('&', '/', $link);
	  $link = str_replace('=', '/', $link);

	  $separator = '?';
	}

	if (isset($_sid)) {
	  $link .= $separator . tep_output_string($_sid);
	}

	return $link;
  }
save & close.

3. open configure.php under catalog/includes/, look for the define line for DIR_WS_HTTP_CATALOG, copy the whole line and paste into configure.php under folder admin/includes/, just above the ENABLE_SSL_CATALOG line.

Now, in header tags edit page, when you click any of the product names on the left, it'd take you to that product's info page.

Let me know if it works.

Ken

Edited by GemRock, 31 January 2007, 16:04.

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#53 bill110

  • Community Member
  • 1,156 posts
  • Real Name:Bill Hodge
  • Gender:Male
  • Location:Oklahoma, USA

Posted 01 February 2007, 11:29

I posted this in the wrong thread (the original topic)
The newest version says it's a complete package but does'nt have the screenshots or install text.
I downloaded the original but will use the newest for copy and paste to ensure no typos.
Thanks for the contribution.
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

#54 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 01 February 2007, 12:02

I have posted an acknowledgement here

Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#55 Patty

  • Community Member
  • 245 posts
  • Real Name:Patricia
  • Gender:Female
  • Location:Brazil

Posted 01 February 2007, 14:08

Hi, Ken.

It's not that I want it, I just thought it could be useful.
Tks for your prompt reply. I'll try that and post a feedback here. :thumbsup:
Patty

#56 Talle

  • Community Member
  • 40 posts
  • Real Name:Fredrik

Posted 03 February 2007, 11:41

Hi again.

How do I do if I want to skip the category in the page title and only want it to display productname and then shop name.
Or posibly productname - category - shopname.

Thx

//Talle

#57 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 03 February 2007, 12:43

View PostTalle, on Feb 3 2007, 11:41 AM, said:

...if I want to skip the category in the page title and only want it to display productname and then shop name.
Or posibly productname - category - shopname...
Hi Talle

Assuming your title tag in product info.php is this
<title><?php echo $header_tags[title_tag]; ?></title>
1. you could enter whatever you like in the title tags field (column) in header tags edit page, e.g., productname - shop name. or
2. you could change the title tag to something like this:
<title><?php echo $header_tags[products_name] . '-' . $categories['categories_name'] . '-' . TITLE; ?></title>
assuming your shop's TITLE is defined by using your shop name. You could replace '-' with space, ie, ' ', if you dont want '-' between product name and category name.
3. if you dont want category name, then delete
'-' . $categories['categories_name'] .

HTH

Ken

Edited by GemRock, 03 February 2007, 12:46.

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#58 Talle

  • Community Member
  • 40 posts
  • Real Name:Fredrik

Posted 03 February 2007, 17:07

Thank you Ken!

//Talle

#59 Talle

  • Community Member
  • 40 posts
  • Real Name:Fredrik

Posted 04 February 2007, 18:35

Just a quick question, what should I use to separate keywords?
is it just a (blank) or a ,(comma) or a ;

best regards

//Talle

#60 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 04 February 2007, 21:40

View PostTalle, on Feb 4 2007, 06:35 PM, said:

...what should I use to separate keywords?
is it just a (blank) or a ,(comma) or ...
Comma is the answer.

Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.