Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tags for novices


GemRock

Recommended Posts

Hi there and thanks for the quick answer .. here are the first 68 lines of my index.php (right before the doctype starts)

<?php
/*
 $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// the following cPath references come from application_top.php
 $category_depth = 'top';
 if (isset($cPath) && tep_not_null($cPath)) {
   $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
   $cateqories_products = tep_db_fetch_array($categories_products_query);
   if ($cateqories_products['total'] > 0) {
     $category_depth = 'products'; // display products
   } else {
     $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
     $category_parent = tep_db_fetch_array($category_parent_query);
     if ($category_parent['total'] > 0) {
       $category_depth = 'nested'; // navigate through the categories
          } else {
       $category_depth = 'products'; // category has no products, but display the 'no products' message
     }
   }
   //get current category tags when a category is selected
   $cat_tags_query = tep_db_query("SELECT categories_name, title_tag, desc_tag, keywords_tag FROM " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' AND language_id = '" . (int)$languages_id . "'");
   $cat_tags = tep_db_fetch_array($cat_tags_query);
   $categories_name = $cat_tags['categories_name'];
   $title_tag = $cat_tags['title_tag'];
   $desc_tag = $cat_tags['desc_tag'];
   $keywords_tag = $cat_tags['keywords_tag'];
   //set default
   $kws_home_default = $categories_name;
   $desc_home_default = $categories_name;
   $title_home_default = $categories_name;
 } else {
   //no category is selected: randomly select category names as keywords
     $cat_names_query = tep_db_query("SELECT categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " WHERE language_id = '" . (int)$languages_id . "'" . " ORDER BY RAND()");
     $kws_home_default = "";
     $num_rows = tep_db_num_rows($cat_names_query);
     if ($num_rows > 20){
       $i = rand(1,$num_rows);
       for ($count = $i; $count < $i + 20; $count++) {
           $cat_names = tep_db_fetch_array($cat_names_query);
           $kws_home_default .= $cat_names['categories_name'] . ', ';
       }
     } else {
         while ($cat_names = tep_db_fetch_array($cat_names_query)){
           $kws_home_default .= $cat_names['categories_name'] . ', ';
         }
     }
//default title tag for the index (home) page
   $title_home_default = "ENTER YOUR DEFAULT TITLE TEXT HERE";
//default keywords for the index (home) page
   $kws_home_default .= STORE_NAME;
//default Description for the index (home) page
   $desc_home_default = "ENTER YOUR DEFAULT DESCRIPTION TAG TEXT HERE FOR THE HOME PAGE";
 }


require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>

Link to comment
Share on other sites

P.S. I see a similar error is display in the login.php window but under line 17

Fatal error: Call to undefined function tep_redirect() in /home/rcro/public_html/login.php on line 17

Edited by T-B0N3
Link to comment
Share on other sites

what editor are you using to edit those php files? it looks like your editor has messed up the code. it all becomes one-liner when i pasted it to a proper php editor. you could try to use textpad which is free, if you dont have anything better.

 

below is the code you posted but after i restore it from one line to its proper format:

<?php

/*  $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]  Copyright © 2003 osCommerce
Released under the GNU General Public License
*/

require('includes/application_top.php');
// the following cPath references come from application_top.php
$category_depth = 'top';  if (isset($cPath) && tep_not_null($cPath)) {
 $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
 $cateqories_products = tep_db_fetch_array($categories_products_query);
 if ($cateqories_products['total'] > 0) {
$category_depth = 'products'; // display products
 } else {
   $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
   $category_parent = tep_db_fetch_array($category_parent_query);
	if ($category_parent['total'] > 0) {
	  $category_depth = 'nested'; // navigate through the categories
	   } else {
		 $category_depth = 'products'; //category has no products, but display the 'no products' message
	   }
	 }
	 //get current category tags when a category is selected
	   $cat_tags_query = tep_db_query("SELECT categories_name, title_tag, desc_tag, keywords_tag FROM " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' AND language_id = '" . (int)$languages_id . "'");
	   $cat_tags = tep_db_fetch_array($cat_tags_query);
	   $categories_name = $cat_tags['categories_name'];
	   $title_tag = $cat_tags['title_tag'];
	   $desc_tag = $cat_tags['desc_tag'];	$
	   keywords_tag = $cat_tags['keywords_tag'];
	   //set default
	   $kws_home_default = $categories_name;
	   $desc_home_default = $categories_name;
	   $title_home_default = $categories_name;
	   } else {
		 //no category is selected: randomly select category names as keywords
		 $cat_names_query = tep_db_query("SELECT categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " WHERE language_id = '" . (int)$languages_id . "'" . " ORDER BY RAND()");
		 $kws_home_default = "";
		 $num_rows = tep_db_num_rows($cat_names_query);
		  if ($num_rows > 20){
			$i = rand(1,$num_rows);
			for ($count = $i; $count < $i + 20; $count++) {
			   $cat_names = tep_db_fetch_array($cat_names_query);
				$kws_home_default .= $cat_names['categories_name'] . ', ';
			  }
			  } else {
				while ($cat_names = tep_db_fetch_array($cat_names_query)){
				  $kws_home_default .= $cat_names['categories_name'] . ', ';
				}
			  }
			  //default title tag for the index (home) page
			  $title_home_default = "ENTER YOUR DEFAULT TITLE TEXT HERE";
			  //default keywords for the index (home) page
			  $kws_home_default .= STORE_NAME;
			  //default Description for the index (home) page
			  $desc_home_default = "ENTER YOUR DEFAULT DESCRIPTION TAG TEXT HERE FOR THE HOME PAGE";
			}
			require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);?>

theres nothing wrong there.

 

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.

Link to comment
Share on other sites

Hi Ken, and thanks again for your help. I use notepad++ which should be able to handle php files just fine. The php file itself looks like ok to me. So, should I paste the code you gave me into the index just to give it a try or do you have any other suggestions ?

Link to comment
Share on other sites

pm me the ftp but i can only fix the index.php (home page) time wise...

 

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.

Link to comment
Share on other sites

Mi

 

The problem of your site is very simple: your application_top.php was zero byte, ie, a blank file. I now upload one from a standard osc-rc2a download and the site is working now. you could have sent me the ftp last night - it took one minute to figure out once looking at it. you need now to further customise your header tags.

 

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.

Link to comment
Share on other sites

HI . This is a great piece of work . Very useful to noobs in the coding area , like me . I have installed it ( v5 ,downloaded from your site ), along with seo url .Unfortunatelly it doesn't seem to work . I don't have any visible errors , nothing seems to be broken but even i change the keywords , title , or description nothing appears when i use the " view source " option of IE . I mean there are no keywords or title right there. Is like the contribution isn't even there . Can you , please , advise me ? thanks in advance .

Link to comment
Share on other sites

HI . This is a great piece of work . Very useful to noobs in the coding area , like me . I have installed it ( v5 ,downloaded from your site ), along with seo url .Unfortunatelly it doesn't seem to work . I don't have any visible errors , nothing seems to be broken but even i change the keywords , title , or description nothing appears when i use the " view source " option of IE . I mean there are no keywords or title right there. Is like the contribution isn't even there . Can you , please , advise me ? thanks in advance .

that only happens if:

1. you have not followed fully the instructions, especially the part of "how to use";

 

2. you are using a template system of some sort. while it could work on osc that uses a template system, the instruction does not cover how to install it on a template. you can find out how on this support thread - your fellow site owners have successfully done it.

 

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.

Link to comment
Share on other sites

Hi Ken,

 

Thanks a million! I owe you a beer. Sorry about last night ... the baby started crying and I had to hold him and put him to sleep, and by the time he was asleep I was dead.

 

i have no place big enough to keep a million thanks, although a beer would be nice during this hot 31C summer week here in London :)

btw, any good/famous beer in your part of the world so that i could check it out on the annual london beer festival? i know the poles are pround of their tyskie.

 

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.

Link to comment
Share on other sites

that only happens if:

1. you have not followed fully the instructions, especially the part of "how to use";

 

2. you are using a template system of some sort. while it could work on osc that uses a template system, the instruction does not cover how to install it on a template. you can find out how on this support thread - your fellow site owners have successfully done it.

 

Ken

 

Thank you very much Ken , for such a fast response . Indeed , i use a template bought from templatemonster.com . i am sure that i followed you instructions in "how to use" very well. i installed the contribution on my machine on a xampp installation and on the online server of my hosting (on a copy of my site used for testing ). in the morning i'll do it again and read the full support thread . thank you , again .

Link to comment
Share on other sites

Thank you very much Ken , for such a fast response . Indeed , i use a template bought from templatemonster.com . i am sure that i followed you instructions in "how to use" very well. i installed the contribution on my machine on a xampp installation and on the online server of my hosting (on a copy of my site used for testing ). in the morning i'll do it again and read the full support thread . thank you , again .

i dont know every single template from the said template maker but i have worked on some osc stores that use the templates from the said template maker. from what i have seen, there is no difference between the two (the other being the stock, non-template osc) as far as my contribution is concerned, so your focis may be looking at if you have done the bit called "How to use - adding dynamic header tags to your shop" in the instructions.

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.

Link to comment
Share on other sites

i have no place big enough to keep a million thanks, although a beer would be nice during this hot 31C summer week here in London :)

btw, any good/famous beer in your part of the world so that i could check it out on the annual london beer festival? i know the poles are pround of their tyskie.

 

Ken

 

Hi Ken,

 

Hmm ... well .. about the beer thingie. You could give Bergenbier a try (if you find it in there). Romania is not that famous about its beers, but fore its wine and traditional 90 degrees drinks. :)

Link to comment
Share on other sites

i dont know every single template from the said template maker but i have worked on some osc stores that use the templates from the said template maker. from what i have seen, there is no difference between the two (the other being the stock, non-template osc) as far as my contribution is concerned, so your focis may be looking at if you have done the bit called "How to use - adding dynamic header tags to your shop" in the instructions.

good luck,

Ken

 

Hi , Ken . I have finally figured it up . I took your advice and looked again on " how to use " instruction and i observed that there were 2 options for modifying the products_info.php . First time ( the one thet didn't work out ) i replaced the code with the first option but today i have given the second option a chance and it worked like a charm . Well , the results are amazeing since i can modify all the information about my products from my admin panel . I must say again that this contribution is GREAT , mate . Thank you again for your work and for your prompt and helpful support .

Link to comment
Share on other sites

Hi and thankyou so much for the cotrib

 

I have a few errors but will post them one at a time so not to clutter things up.

The first one is when I go my website and click on anything in the categories menu.

 

I get the following error:

 

1054 - Unknown column 'title_tag' in 'field list'

SELECT categories_name, title_tag, desc_tag, keywords_tag FROM categories_description where categories_id = '47' AND language_id = '1'

[TEP STOP]

 

Of course the 'categories_id =' is different in each category

 

Where do you think I went wrong?

What would you suggest please?

Link to comment
Share on other sites

Second error is when I am in oscommerce admin/catalog and I click on Product Meta Tags

 

I get a screen with the following

 

Header Tags Entry/Edit  


1054 - Unknown column 'pd.title_tag' in 'field list'

select p.products_id, p.manufacturers_id, pd.products_name, pd.title_tag, pd.desc_tag, pd.keywords_tag, p.manufacturers_id from products p, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' limit 0, 16

[TEP STOP]

Edited by amirage
Link to comment
Share on other sites

Next error is when clicking on Category Meta Tags

 

1054 - Unknown column 'cd.title_tag' in 'field list'

 

select c.categories_id, cd.categories_name, c.parent_id, cd.title_tag, cd.desc_tag, cd.keywords_tag from categories c, categories_description cd where c.categories_id = cd.categories_id and cd.language_id = '1' and c.parent_id = '0' order by c.sort_order, cd.categories_name

 

[TEP STOP]

Category Nmae Page Title Tag (Optional) Description Tag (Optional) Keywords Tag (Optional)

 

code]

 

Anyone able to help with where I went wrong?

At the end of the SE DYNAMIC Installation it also says

Now, go to your osCommerce Home page, click a category or product. This will add 3 new fields to the tables of products_description and categories_description in the database

 

Unsure which tables it adds, wanted to check I see them in there, can anyone tell me which tables they are to ensure I have it done correctly?

Sorry about all the questions...I'm a UNIVERSAL student willing to learn

;)

Thanks in advance

Link to comment
Share on other sites

...1054 - Unknown column 'cd.title_tag' in 'field list'...

very simple: you have NOT follow the instructions FULLY. in particular, failed to add some code to the application_top.php, which add the missing fields to the db/tables automatically.

 

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.

Link to comment
Share on other sites

very simple: you have NOT follow the instructions FULLY. in particular, failed to add some code to the application_top.php, which add the missing fields to the db/tables automatically.

 

Ken

 

 

YOU are simply a LEGEND thanks so much, I took another look and couldn't find where I'd gone wrong so just started with the additions again and voila no more errors.

Now, time to knuckle down and add some keywords and titles and get my ranking back up.

Thanks again BRILLIANCE! :rolleyes:

Link to comment
Share on other sites

  • 2 weeks later...

thank all for the appreciation!

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.

Link to comment
Share on other sites

  • 2 weeks later...

I have a problem. After first installing the contribution Ultimate SEO URLs I checked everything and everything was working 100%. Then I installed this contribution and it works like a charm in the shop that the customers see (thanks Ken for your great contribution!). The problem comes when I'm trying to login to the Admin area, I only get an error now stating:

 

Warning: include_once(includes/classes/seo.class.php) [function.include-once]: failed to open stream: No such file or directory in /home/stars/domains/mydomain.com/public_html/admin/includes/functions/html_output.php on line 22

 

Warning: include_once() [function.include]: Failed opening 'includes/classes/seo.class.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/stars/domains/mydomain.com/public_html/admin/includes/functions/html_output.php on line 22

 

Fatal error: Class 'SEO_URL' not found in /home/stars/domains/mydomain.com/public_html/admin/includes/functions/html_output.php on line 25

 

 

Any idea of what could be wrong? I have checked everything and the file that it is asking for (seo.class.php) is in the correct folder, and I have also uploaded it again to be sure it is no problem with that.

 

Please help me, thanks!

Link to comment
Share on other sites

I have a problem...

 

the problem did not relate to this contribution. the site just moved to a new server and have some file mis-matched here & there plus some old php 4 function not being compatible with the phpv5 now on the server. but all fixed now.

 

Good stuff sold on the site!

 

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.

Link to comment
Share on other sites

Great mod and worked first time after installing. However, there are two slight problems.

 

1. The homepage keywords tag displays my category names before displaying my default keywords. Eg. "category 1, category 2, category 3, category 4, default keyword 1, default keyword 2, default keyword 3...."

I would like to know if it is possible to not display the categories.

 

2. The title tags on the product pages displays the category before my own title Eg. "Category - My Own Title"

Again, please let me know how to amend so that it only displays my own title.

 

This is a great contribution though and will be using on all future sites i work on! Excellent work!!

 

Oh and i've used V.5.0 -

 

<title><?php echo (strlen($title_tag) > 1) ? $title_tag . ' - ' . TITLE : $title_home_default . ' - ' . TITLE; ?></title>
<meta name="description" content="<?php echo (strlen(strip_tags($desc_tag)) < 5)? $desc_home_default : strip_tags($desc_tag); ?>">
<meta name="keywords" content="<?php echo (strlen(strip_tags($keywords_tag)) < 5) ? $kws_home_default : strip_tags($keywords_tag); ?>">

Edited by Okari
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...