Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Free Mod for Product Page Custom Meta Tags & Titles
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 01-27-2005, 07:02 PM
 
belen belen is offline
 

Member
  
Join Date: Nov 2002
Posts: 12
 

Default Free Mod for Product Page Custom Meta Tags & Titles

Though the new versions of X-Cart are improving the ability to specify meta tags and titles for SEO, I have had many clients frustrated with not being able to optimize product pages, as these are usually where they want people to land. Below is a mod that doesn't involve modifying the database or fields - only 2 template edits and the use of an include file. I am implementing it in the 4.x branch, but I think it will translate down with no issue.

1) Create .txt files for your <head> data, including title, meta description, meta keywords and any others you wish to include. Example:
Code:
<title>Keyword 1, Keyword 2 from Company Name</title> <meta name="keywords" content="keyword phrase1,keyword phrase2,keyword phrase3,keyword phrase4,keyword phrase5"> <meta name="description" content="Keyword 1, Keyword 2 from Company Name. Descriptive sentence."> <meta name="GOOGLEBOT" content="index,follow"> <meta name="robots" content="index,follow"> <!-- This web site contains information about: keyword phrase1,keyword phrase2,keyword phrase3,keyword phrase4,keyword phrase5 -->
You will create one of these for each product, naming it with the X-Cart Product ID number (ie - "16145.txt")

2) You will upload these to a directory on your server called meta. I prefer to place mine at the root of my web directory, at the same level as my x-cart directory, so it is at "/meta/" and xcart is at "/store/"

3) First, you need to diable the default title tag if you are on a product page, since it is included in your meta include.

Open <xcart_root_dir>/skin1/customer/home.tpl and add the following code above and below the existing<TITLE> tags (existing code indicated for your reference)
Code:
***begin existing code*** <HTML> <HEAD> ***end existing code*** {if $product.product ne ""} {else} ***begin existing code*** <TITLE> x-cart title code </TITLE> ***end existing code*** {/if}

4) Now we will edit the meta template.

Open <xcart_root_dir>/skin1/meta.tpl and add the following code (existing code is marked for your reference)
Code:
***begin existing code*** <META name="ROBOTS" content="NOINDEX"> <META name="ROBOTS" content="NOFOLLOW"> {else} ***end existing code*** {if $product.product ne ""} {assign var="meta" value=$product.productid} {php} $meta = $this->get_template_vars('meta'); $meta_data = "../meta/".$meta.".txt"; readfile($meta_data); {/php} {else} ***begin existing code*** <META name="description" content="{if $current_category.meta_descr ne ""}{$current_category.meta_descr}{/if} {$config.SEO.meta_descr}"> <META name="keywords" content="{if $current_category.meta_keywords ne ""}{$current_category.meta_keywords}{/if} {$config.SEO.meta_keywords}"> {/if} ***end existing code*** {/if} ***begin existing code*** {if $webmaster_mode eq "editor"}
What we are doing is first checking to see if the product variable is set to equal anything. If it is, then we know we are on a product page. Then we assign a variable name we can use to the productID, we concatnate it with the path for the meta include file, and then ask PHP to spit out the include file for us. If we aren't on a product page, it ignores this and moves along to the standard meta data.

The fact that my clients can edit their meta data in a text file to their heart's content and I don't have to apply mods to the database and structure, thereby avoiding upgrade headaches made me very very happy. Until X-Cart realizes that product pages *are* important for some people to optimize, I am content to use this mostly un-invasive solution.

I hope this helps some of you out there - I know this is a topic that can cause much headache!

----------------------------------
belen
me@belen.net
www.belen.net
Reply With Quote
  #2  
Old 01-27-2005, 07:27 PM
  rjcbear's Avatar 
rjcbear rjcbear is offline
 

X-Adept
  
Join Date: Jun 2004
Location: Alabama,U.S.A
Posts: 503
 

Default

Intersting but kind of complicated.

Here is one free mod that work wonders one of them is free and the other one is a pay mod. How do I know they work wonders I use them.

the free mod is:

http://www.bcsengineering.com/store/customer/product.php?productid=88

the paid mod is:

http://www.bcsengineering.com/store/customer/product.php?productid=95

this two mods come from www.Bcsengineering.com

go get them

Kind regards,
Ricky
__________________
X-CART Gold version 4.0.14 & 4.1.11
Apache Version 1.3.29 (Unix)
EWDHosting-Quality X-cart Hosting
We will always sell you the right shoe and the left one is free.
Reply With Quote
  #3  
Old 01-27-2005, 10:10 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

I'll second that... Carries mods ROCK! And she is Most Excellent to deal with! Stop waisting your time and go get the real thing.
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #4  
Old 01-27-2005, 10:41 PM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

But credit where credit is due, thanks to the original poster for their mod.
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #5  
Old 01-28-2005, 12:00 AM
 
Taffy Taffy is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: Azusa, California, USA
Posts: 54
 

Default

Quote:
Originally Posted by cotc2001
But credit where credit is due, thanks to the original poster for their mod.

Yes, no doubt. I really appreciate the guys who come in here and let us see their code. I am on this wave riding it as far as I can take it. The more info I can get from all of you the better.
__________________
X-Cart 4.1.11
PHP 5.1.4
MySQL server 5.0.23
Windows
www.ericsperformanceparts.com
Reply With Quote
  #6  
Old 01-28-2005, 06:48 AM
 
belen belen is offline
 

Member
  
Join Date: Nov 2002
Posts: 12
 

Default Thanks for the kind support

I had seen Carrie's mod and, while nice, did not fit the specific needs of my clients. They needed ALOT more control over the product title, not just keywords and descriptions. One of the things I have found the most useful in this forum is that so many people have so many solutions that are all just a little different.

Thank you to those of you who are kind enough to appreciate what I have shared, even if it isn't of help to you. I often feel I don't give enough back to this community and I was just trying to offer a token.

---------------
belen
Reply With Quote
  #7  
Old 08-04-2005, 09:49 AM
 
jdiehl jdiehl is offline
 

eXpert
  
Join Date: Dec 2003
Location: Kansas City, MO
Posts: 270
 

Default Thanks Belen

Outstanding Job. I agree with you that while Carrie's mod is good, I needed different abilities.

I was able to modify your code to work on Category Pages and on the added Static Pages that I have. I even added the ability for it to check to see if the file existed, and if not then it would load the defaults like it did before the mod. This gives me the ability to work on some of the pages without being forced to work on all of them immediately.

Great Job, Thank you very much for sharing.
__________________
Jason Diehl

Finding Cures for Your Online Headaches: http://www.internetmedicineman.com/
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:24 PM.

   

 
X-Cart forums © 2001-2018