Jump to content



Photo
- - - - -

[contribution support] Custom META Tags per ITEM


  • Please log in to reply
86 replies to this topic

#61   toptiara

toptiara
  • Members
  • 141 posts
  • Real Name:Dan
  • Gender:Male
  • Location:Perth, Australia

Posted 18 June 2007 - 12:15

Sorry I can't edit my last post so have had to add a new one.

This is the content from includes/functions/general.php that relates to this contribution :

//Default META TAGS: Change these to what you want.
//These will be the default throughout the entire store
$Description="<my description>";
$Keywords="<my keywords>";
$Pagetitle="<my default title>";
$Reviewheader="Product Review: ";

switch($strPAGE){
case 'product_info':
case 'product_review':
$product_info_query = tep_db_query("select products_keywords, products_metadescription, products_pagetitle from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $id . "' and language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
if (tep_not_null($product_info['products_keywords'])){$Keywords=$product_info['products_keywords'];}
if (tep_not_null($product_info['products_metadescription'])){$Description=$product_info['products_metadescription'];}
if (tep_not_null($product_info['products_pagetitle'])){$Pagetitle=$product_info['products_pagetitle'];}
break;

case 'categories':
if(strrpos($id,'_')!=false){ $id=substr($id,strrpos($id,'_')+1);}
$categories_query = tep_db_query("select categories_keywords, categories_metadescription, categories_pagetitle from " . TABLE_CATEGORIES . " where categories_id = '" . $id . "'");
$categories = tep_db_fetch_array($categories_query);
if (tep_not_null($categories['categories_keywords'])){$Keywords=$categories['categories_keywords'];}
if (tep_not_null($categories['categories_metadescription'])){$Description=$categories['categories_metadescription'];}
if (tep_not_null($categories['categories_pagetitle'])){$Pagetitle=$categories['categories_pagetitle'];}
break;
}

if($strPAGE=='product_review') { // Add 'Product Review:' to TITLE
$Pagetitle= $Reviewheader . $Pagetitle;
}

return ("<META NAME=\"Description\" CONTENT=\"" . $Description . "\">\n" .
"<META NAME=\"Keywords\" CONTENT=\"" . $Keywords . "\">\n" .
"<TITLE>" . $Pagetitle . "</TITLE>\n");
}
// -Randelia Custom_META_Tags_Per_Item.


Here is a category address (which the meta tags work correctly on) :
http://toptiara.com/...x_cpath-21.html

Here is a product address (which the tags will not work on) :
http://toptiara.com/...cts_id-133.html


Looking at the code, it should be picking up the 'product_info' part of the address and parsing the relevant keywords, description and title, but it is not doing so. I don't know enough PHP to debug it. Anybody able to identify what might need to be changed to remedy it please?
Hand made jewellery and tiaras on our website

Please bear with me. Im an osC noobie!

#62   toptiara

toptiara
  • Members
  • 141 posts
  • Real Name:Dan
  • Gender:Male
  • Location:Perth, Australia

Posted 19 June 2007 - 22:38

Sorry I can't edit my last post so have had to add a new one.

This is the content from includes/functions/general.php that relates to this contribution :

//Default META TAGS: Change these to what you want.
//These will be the default throughout the entire store
$Description="<my description>";
$Keywords="<my keywords>";
$Pagetitle="<my default title>";
$Reviewheader="Product Review: ";

switch($strPAGE){
case 'product_info':
case 'product_review':
$product_info_query = tep_db_query("select products_keywords, products_metadescription, products_pagetitle from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $id . "' and language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
if (tep_not_null($product_info['products_keywords'])){$Keywords=$product_info['products_keywords'];}
if (tep_not_null($product_info['products_metadescription'])){$Description=$product_info['products_metadescription'];}
if (tep_not_null($product_info['products_pagetitle'])){$Pagetitle=$product_info['products_pagetitle'];}
break;

case 'categories':
if(strrpos($id,'_')!=false){ $id=substr($id,strrpos($id,'_')+1);}
$categories_query = tep_db_query("select categories_keywords, categories_metadescription, categories_pagetitle from " . TABLE_CATEGORIES . " where categories_id = '" . $id . "'");
$categories = tep_db_fetch_array($categories_query);
if (tep_not_null($categories['categories_keywords'])){$Keywords=$categories['categories_keywords'];}
if (tep_not_null($categories['categories_metadescription'])){$Description=$categories['categories_metadescription'];}
if (tep_not_null($categories['categories_pagetitle'])){$Pagetitle=$categories['categories_pagetitle'];}
break;
}

if($strPAGE=='product_review') { // Add 'Product Review:' to TITLE
$Pagetitle= $Reviewheader . $Pagetitle;
}

return ("<META NAME=\"Description\" CONTENT=\"" . $Description . "\">\n" .
"<META NAME=\"Keywords\" CONTENT=\"" . $Keywords . "\">\n" .
"<TITLE>" . $Pagetitle . "</TITLE>\n");
}
// -Randelia Custom_META_Tags_Per_Item.
Here is a category address (which the meta tags work correctly on) :
http://toptiara.com/...x_cpath-21.html

Here is a product address (which the tags will not work on) :
http://toptiara.com/...cts_id-133.html
Looking at the code, it should be picking up the 'product_info' part of the address and parsing the relevant keywords, description and title, but it is not doing so. I don't know enough PHP to debug it. Anybody able to identify what might need to be changed to remedy it please?


Seems there is limited to no support for this contribution any more looking at the thread history.

I switched to the header tags controller contribution. Removing this one was pretty easy (albeit a little long due to code changes) and install of the other was pretty easy too. The best bit is that the other one works /smile.gif' class='bbc_emoticon' alt=':)' />
Hand made jewellery and tiaras on our website

Please bear with me. Im an osC noobie!

#63 ONLINE   toyzonline

toyzonline
  • Members
  • 370 posts
  • Real Name:Ricardo
  • Gender:Male
  • Location:Cheshire, England

Posted 27 December 2007 - 11:54

I have installed this and whether I manually change the admin/catagories or upload the file provided I get the following error:

Parse error: syntax error, unexpected '}' in /home/supreme/public_html/admin/categories.php on line 1122

Any Ideas?

#64   lisaanne

lisaanne
  • Members
  • 26 posts
  • Real Name:Lisa Bailey

Posted 05 March 2008 - 11:31

Hi,

I really like this contribution - and whilst setting it up everything was going well... until I discovered I only get the defaults on the product info pages. The category pages are right, and the metadata for the products is going into the database - just something isn't letting it display on the products_info page like it should.

Anyone else had this problem/got any ideas?

I've used pretty much the files that came with the pack, so don't think I've typo-ed anything!

Thanks,
lisa x

#65   bigfishish

bigfishish
  • Members
  • 2 posts
  • Real Name:Christopher Reilly
  • Gender:Male

Posted 25 March 2008 - 22:03

This is a definitely a hack, but it worked for me. On product_info.php replace the <?php echo ShowMETA('product_info', $products_id, $languages_id); ?> part with the following...

<?php // Randelia Custom_META_Tags_Per_Item. Includes TITLE!
// echo ShowMETA('product_info', $products_id, $languages_id);

$product_info_query = tep_db_query("select products_keywords, products_metadescription, products_pagetitle from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

echo '<title>' . $product_info['products_pagetitle']. '</title>';
echo '<meta name="description" content="' . $product_info['products_metadescription']. '">';
echo '<meta name="keywords" content="' . $product_info['products_keywords']. '">';
?>


Perhaps someone can more elegantly put this in the showMETA function like the rest of the mod, but I couldn't get it to work.
Notice that products_id = '" . (int)$HTTP_GET_VARS['products_id'] differs from the mod's syntax which calls the $id variable.

Hope this helps.

#66   fan4chevy

fan4chevy
  • Members
  • 367 posts
  • Real Name:Charles

Posted 31 March 2008 - 05:05

Hi,

I love the mod!

I have it all working with the exception of the actual individual product page. I can't seem to figure out why the title is not displaying the title that I put for the individual product rather than the category.

Your help is appreciated.

Not sure how to cancel this reply but I figured it out I did not have echo ShowMETA('product_info', $products_id, $languages_id); ?>

Edited by fan4chevy, 31 March 2008 - 05:20.


#67   MediaHound

MediaHound
  • Members
  • 58 posts
  • Real Name:MediaHound

Posted 11 May 2008 - 14:21

Hi,
This is a great contribution.
I have just installed it and it works great.
My shop uses MVS - Multi Vendor Shipping, so I had to merge the two modifications in the places where they overlapped in /admin/categories.php

There were two queries that needed to be merged, these are the two, in order as they appear in the instructions.

$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, pd.products_keywords, pd.products_metadescription, pd.products_pagetitle, p.products_id, p.products_quantity, p.products_model, p.vendors_prod_id, p.products_image, p.products_price, p.vendors_product_price, p.products_weight, p.vendors_prod_comments, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.vendors_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
Above is the first one you will encounter, this code is the merged query, use this instead.
Below is the second one you will encounter. This code is the merged query, use this instead.
	  $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, pd.products_keywords, pd.products_metadescription, pd.products_pagetitle, p.products_quantity, p.products_model, p.vendors_prod_id, p.products_image, p.products_price, p.vendors_product_price, p.products_weight, p.vendors_prod_comments, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id, p.vendors_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");

I have updated the contribution with the modified /admin/categories.php to merge it with the MVS hack.
I think these two queries were all that was needed (along with some common sense as far as arranging things goes) but I have included the complete merged file as it works on my site in the contrib.
I hope it helps someone and I'm not liable if it breaks your site! You may not need to, but it may be advisable to test on a non-production site first!
If anything, maybe just use it as a guide as you merge your files as you have them on your particular shop.

#68   tanicos

tanicos
  • Banned
  • 152 posts
  • Real Name:cosminel

Posted 15 May 2008 - 10:39

i just want to thank you from the bottom of my heart...it works like a charm...with SEO urls and others too...really good

#69   JSR

JSR
  • Members
  • 149 posts
  • Real Name:Chanel
  • Gender:Female
  • Location:Planet Earth

Posted 01 June 2008 - 10:00

Great Contribution, Easy and quick to install.
Question though, does anyone know how to alter the code so it would be possible to have the multilingual feature for the categories as well as the products? I get stuck trying to edit...

#70   klingdesigns

klingdesigns
  • Members
  • 21 posts
  • Real Name:Corey Kling
  • Gender:Male
  • Location:Indiana

Posted 04 July 2008 - 00:03

I wanted to thank Bigfish,
I was having the same problem with the product info only showing the default and your code made it work. Although the default doesn't work now, it still shows what I enter in the database for the tags.

This had me totally stumped and I installed it successfully on my companies website and worked perfectly, but i'm now doing a site for someone and it wouldn't work on product info (only the defaults) I ran up and down the code and even turned off search engine safe urls' on both sites. Although this new one I'm working on had someone else install OSC and did some weird stuff to it but I still couldn't figure out the problem. Wonder if it's a register globals problem? I know my work has them turned on but not sure what this new sites host has.

I usually steel php code and can modify to an extent but am still learning a lot.

Again, Thanks Bigfish. I'd rather have the database inputs for the meta tags working rather then the defaults.

#71   nick_w3

nick_w3
  • Members
  • 1 posts
  • Real Name:Nick
  • Location:Los Angeles, CA

Posted 17 July 2008 - 17:30

Bigfish,

Thank you very much for your contribution to solving the issue!

#72   glammabags

glammabags
  • Members
  • 30 posts
  • Real Name:Blanca

Posted 21 July 2008 - 17:36

Hello.

I'm using your meta tags contribution, and needed a little help.

I have an admin section which I'm using this in, and there's a little problem. ( PMed you o this, but checked with my client & it's ok for me to post too apparently.)

I can edit the meta tags for existing products, but when I try and edit the tags for existing categories, I can't find the update/save button. It's completely vanished.

Any ideas??


I just installed the contribution and works like a charm but have this same problem... anybody knows how to solve it? Thanks!

#73   omaatje

omaatje
  • Members
  • 1 posts
  • Real Name:vaart

Posted 04 August 2008 - 10:34

Bigfish,

Thank you very much for your contribution to solving the issue!

Bigfish

You give credit to your ''nick'' /biggrin.gif' class='bbc_emoticon' alt=':D' />

thanks from me also, works like a charme now.
You made my life easyer and my shop better.

#74   alymirza

alymirza
  • Members
  • 36 posts
  • Real Name:Aly Mirza

Posted 12 September 2008 - 13:19

Hello I am new and in the process of learning...
ur contribution sounds great..i need some help

Its written in instalation step
Pretty Easy Install: Run a SQL script, easy copy-paste modifications on 5 files, 1 detailed copy-paste file: If you have a modified the original admin/categories.php this install method is for you.

now can u tell me how and from where to run the SQL script...

secondly

if i am sing teh about method...i just need to modify the files or do i have to upload teh files also


regards
aly

#75   allright

allright
  • Members
  • 102 posts
  • Real Name:YH

Posted 26 October 2008 - 00:40

Hello all,

Firstly appreciate much for this great contribution /smile.gif' class='bbc_emoticon' alt=':)' />

I following exactly the installation instructions. After setting some testing Tag contents, what can be seen is only the following on the webpage:
default page title goes here...

The Version I installed:
1. osCommerce 2.2 MS2 RC2a
2. Custom META Tags per Item v1.0 for Oscommerce 2.2 MS2

Please kindly advise if I missed out some setting steps? thank you very much.

Best regards,
allright

#76   ntopcugil

ntopcugil
  • Members
  • 5 posts
  • Real Name:Nuri

Posted 24 November 2008 - 23:47

Is it possible to make custom title for manufacturers?

#77   timbeeren

timbeeren
  • Members
  • 13 posts
  • Real Name:Tim Beeren

Posted 10 December 2008 - 18:09

Does anyone knows how to integrate the tags in your categories if you use this contribution: Category Descriptions MS2 1.4 --> http://addons.oscommerce.com/info/1373

???

#78   andycatax

andycatax
  • Members
  • 89 posts
  • Real Name:andy

Posted 18 February 2009 - 20:08

Is there a way to do this for manufactures title and meta tags? i have it all working great but the manufactures meta tags are all default.

Thanks
Andy

#79   andycatax

andycatax
  • Members
  • 89 posts
  • Real Name:andy

Posted 23 May 2009 - 17:33

Has anyone got this working with manufacturers, i have tried but failed. Any tipon how to change the admin/manufacturers.php file

Thanks
andy

#80   fan4chevy

fan4chevy
  • Members
  • 367 posts
  • Real Name:Charles

Posted 12 February 2010 - 03:59

In case anyone is interested. I uploaded a file to the contribution for a better search. The file will enable searching through Title, Meta Keywords, Description. etc.

Very easy to install. Only change one file. Works great on OSC.

Hope this helps,

Charles