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

Funkydunk's COOL mod for total meta tag control

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-24-2003, 04:54 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default Funkydunk's COOL mod for total meta tag control

I had Funkydunk do an x-cart customization for my 3.3.5 stores so that I could have total control over the title and meta tags for each category to score higher in the search engines. It works perfectly, and I want to share it with the rest of you. I have no idea if this works in 3.4.0, but it's fine in 3.3.5...3.3.6 will probably work fine too.

First, patch your SQL database with this info:
Quote:
INSERT INTO xcart_config VALUES ('meta_title', 'Meta Title', '', 'Company', 600, 'text');
INSERT INTO xcart_config VALUES ('meta_description', 'Meta Description', 'Offering Dolphin Jewelry, Dolphin Gifts, Dolphin Art, Dolphin Toys,Dolphin Animals and other Dolphin related products.', 'Company', 601, 'text');
INSERT INTO xcart_config VALUES ('meta_keywords', 'Meta Keywords', 'dolphins,dolphin jewelry,dolphin gifts,dolphin art,dolphin toys,dolphin tattoos,dolphin figurine,dolphin home decor,dolphin water fountains,dolphin clothing,dolphin books,dolphin videos,dolphin tote bags', 'Company', 602, 'text');

ALTER TABLE `xcart_categories` ADD `page_title` VARCHAR( 255 ) AFTER `description` ;
ALTER TABLE `xcart_categories` ADD `meta_description` VARCHAR( 255 ) AFTER `page_title` ;

Then replace the <title> tag of your home.tpl with this line, making sure you replace the COMPANYNAME.COM with whatever you want to show after your *product descriptions*
Quote:
<title>{if $main eq "catalog"}{if $location eq ""}{$config.Company.meta_title}{else}{* funkydunk metamod 2003 *}{if $current_category.page_title eq ""}{strip}{section name=position loop=$location start=0 }{if %position.last% eq "true"}{$location[position].0|escape}{/if}{/section}{/strip}{else}{$current_category.page_title}{/if}{* end of metamod *}{/if}{elseif $main eq "product"}{*{$current_category.page_title}:*}{ if $product.product ne ''}{$product.product} - COMPANYNAME.COM{/if}{elseif $main eq "help"}{$lng.txt_subtitle_help}{elseif $main eq "cart"}{$lng.txt_subtitle_cart}{elseif $main eq "checkout"}{$lng.txt_subtitle_checkout}{elseif $main eq "order_message"}{$lng.txt_subtitle_thankyou}{/if}</title>

Next, replace your skin1/admin/main/category_modify.tpl file with this one:
Quote:
{* $Id: category_modify.tpl,v 1.20 2002/11/10 09:26:46 ndv Exp $ *}
{include file="location.tpl" last_location="Add/Modify category"}
{capture name=dialog}
<table border=0>
<form name="addform" action="category_modify.php?mode={$smarty.get.mode }" method=post enctype="multipart/form-data">
<tr>
<td>[img]../icon.php?categoryid={$cat}&rand={$rand}[/img]</td>
<td colspan=2></td>
</tr>
<tr>
<td height="10" class=FormButton nowrap>Icon</td>
<td width="10" height="10"></td>
<td><input type="file" name="userfile"></td>
</tr>
<TR>
<TD height="10" class=FormButton nowrap>Orderб═by</TD>
<TD width="10" height="10"></TD>
<TD height="10"><INPUT type=text name="order_by" size=4 value="{if $category_error ne ""}{$smarty.post.order_by}{elseif $smarty.get.mode ne "add"}{$current_category.order_by}{/if}">
</TR>
<tr>
<td height="10" class=FormButton nowrap>Category</td>
<td width="10" height="10"><font class=CustomerMessage>*</font></td>
<td height="10">
<input type="text" name="category_name" size="30" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"htmlall"}{e lseif $smarty.get.mode ne "add"}{$current_category.category|escape:"htmlall" }{/if}">
{if $category_error ne ""}
<font color=red><< Wrong value</font>
{/if}
</td>
</tr>
<tr>
<td height="10" class=FormButton nowrap valign=top>Description</td>
<td width="10" height="10"><font class=CustomerMessage></font></td>
<td height="10">
<textarea cols=65 rows=15 name=description>
{if $category_error ne ""}{$smarty.post.description|escape:"htmlall"}{els eif $smarty.get.mode ne "add"}{$current_category.description|escape:"htmla ll"}{/if}
</textarea>
</td>
</tr>

{* funkydunk metamod 2003 *}
<tr>
<td height=10 class=FormButton nowrap>Page Title</td>
<td width="10" height="10"><font class=FormButtonOrange></font></td>
<td height=10>
<input type=text name=page_title size="30" value="{if $category_error ne ""}{$smarty.post.page_title|escape:"htmlall"}{else if $smarty.get.mode ne "add"}{$current_category.page_title|escape:"htmlal l"}{/if}">
</td>
</tr>

<tr>
<td height=10 class=FormButton nowrap>Meta Description</td>
<td width="10" height="10"><font class=FormButtonOrange></font></td>
<td height=10>
<input type=text name=meta_description size="30" value="{if $category_error ne ""}{$smarty.post.meta_description|escape:"htmlall" }{elseif $smarty.get.mode ne "add"}{$current_category.meta_description|escape:" htmlall"}{/if}">
</td>
</tr>
{* end of funkydunk metamod 2003 *}

<tr>
{* funkydunk metamod 2003 *}
<td height=10 class=FormButton nowrap>Meta Keywords</td>
{* end of funkydunk metamod 2003 *}
<td width="10" height="10"><font class=FormButtonOrange></font></td>
<td height=10>
<input type=text name=meta_tags size="30" value="{if $category_error ne ""}{$smarty.post.meta_tags|escape:"htmlall"}{elsei f $smarty.get.mode ne "add"}{$current_category.meta_tags|escape:"htmlall "}{/if}">
</td>
</tr>
<TR>
<TD height=10 class=FormButton nowrap>Membership</TD>
<TD width=10 height=10><FONT class=FormButtonOrange></FONT></TD>
<TD height=10>
<SELECT name=cat_membership>
<OPTION value=""{if $current_category.membership eq ""} selected{/if}>All</OPTION>
{section name=mi loop=$membership_levels}
{if $membership_levels[mi].usertype eq "C"}
<OPTION value="{$membership_levels[mi].membership}"{if $current_category.membership eq $membership_levels[mi].membership} selected{/if}>{$membership_levels[mi].membership}</OPTION>
{/if}
{/section}
</SELECT>
</TD>
</TR>
<tr>
<td height=10 class=FormButton nowrap>Availability</td>
<td width=10 height=10><font class=CustomerMessage></font></td>
<td height="10">
<select name=avail>
<option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option>
<option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option>
</select>
</td>
</tr>
<tr>
<td width="78" class=FormButton></td>
<td width="10"></td>
<td width="282">


<input type=submit value="Submit">
</td>
</tr>
<input type=hidden name=cat value={$cat}>
</form>
</table>
{/capture}
{include file="dialog.tpl" title="Add/Modify category" content=$smarty.capture.dialog extra="width=100%"}

Then replace your (store)/admin/category_modify.php file with this:
Quote:
<?
/************************************************** ***************************\
+-----------------------------------------------------------------------------+
| X-Cart |
| Copyright (c) 2001-2002 Ruslan R. Fazliev. All rights reserved. |
+-----------------------------------------------------------------------------+
| The Ruslan R. Fazliev forbids, under any circumstances, the unauthorized |
| reproduction of software or use of illegally obtained software. Making |
| illegal copies of software is prohibited. Individuals who violate copyright |
| law and software licensing agreements may be subject to criminal or civil |
| action by the owner of the copyright. |
| |
| 1. It is illegal to copy a software, and install that single program for |
| simultaneous use on multiple machines. |
| |
| 2. Unauthorized copies of software may not be used in any way. This applies |
| even though you yourself may not have made the illegal copy. |
| |
| 3. Purchase of the appropriate number of copies of a software is necessary |
| for maintaining legal status. |
| |
| DISCLAIMER |
| |
| THIS SOFTWARE IS PROVIDED BY Ruslan R. Fazliev ``AS IS'' AND ANY |
| EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| DISCLAIMED. IN NO EVENT SHALL Ruslan R. Fazliev OR ITS |
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| The Initial Developer of the Original Code is Ruslan R. Fazliev. |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2002 |
| Ruslan R. Fazliev. All Rights Reserved. |
+-----------------------------------------------------------------------------+
\************************************************* ****************************/

#
# $Id: category_modify.php,v 1.41 2002/12/04 08:12:50 matr Exp $
#

require "../smarty.php";
require "../config.php";
require "./auth.php";
require "../include/security.php";

#
# Update category or create new
#

#
# Check for errors
#

if ($REQUEST_METHOD == "POST" && $mode == "add" && (substr_count($category_name,"/") || empty($category_name))) {
#
# Error: Category name contains symbol "/"
#
$smarty->assign("category_error", "1");
}
elseif ($REQUEST_METHOD == "POST") {

if (func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
move_uploaded_file($userfile, "$file_temp_dir/$userfile_name");
$userfile = "$file_temp_dir/$userfile_name";

list($image_size, $image_x, $image_y) = func_get_image_size($userfile);

$fd = fopen($userfile, "rb");
$image = addslashes(fread($fd, $image_size));
fclose($fd);

unlink($userfile);
}

if ($mode == "add" && !empty($cat) && !substr_count($category_name,"/")) {
#
# Get id, name and icon of parent category
#
$category_data = func_query_first("select $sql_tbl[categories].categoryid, $sql_tbl[categories].category, $sql_tbl[icons].image, $sql_tbl[categories].image_x, $sql_tbl[categories].image_y, $sql_tbl[categories].order_by, $sql_tbl[categories].membership, $sql_tbl[icons].image_type from $sql_tbl[categories], $sql_tbl[icons] where $sql_tbl[categories].categoryid='$cat' and $sql_tbl[categories].categoryid=$sql_tbl[icons].categoryid");
if ($category_data) {
$parent_categoryid = $category_data["categoryid"];
$parent_category = $category_data["category"];

if (!func_is_image_userfile($userfile, $userfile_size, $userfile_type)) {
$image = $category_data["image"];
$image_x = $category_data["image_x"];
$image_y = $category_data["image_y"];
$userfile_type = $category_data["image_type"];
$image = addslashes($image);
}
}
#
# Create new category
#
db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('".addslashes($parent_category)."/$category_name', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','$order_by','$cat_membership')");
$cat = db_insert_id();

db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$parent_category/$category_name/%'");

db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_type')");
}
elseif ($mode == "add" && !substr_count($category_name,"/")) {
#
# Create new category with root parent
#
db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('$category_name', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','$order_by','$cat_membership')");
$cat = db_insert_id();
db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'");
db_query("insert into $sql_tbl[icons] (categoryid, image, image_type) values ('$cat', '$image', '$userfile_type')");
} else {
#
# Update existing category name
# and all subcategories names
#
$categories_chain = explode("/",$category_name);
$category_path = "";
#
# Move category feature
#
foreach($categories_chain as $category_section) {
$category_path .= $category_section;
if ($category_path != $category_name && !func_query_first("select * from $sql_tbl[categories] where category='$category_path'")){
db_query("insert into $sql_tbl[categories] (category, description, page_title, meta_description, meta_tags, avail, order_by, membership) values ('$category_path', '$description','$page_title', '$meta_description', '$meta_tags', '$avail','','$cat_membership')");
db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_path/%'");
};
$category_path .= "/";
}

$old_category_name = array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$cat'"));
db_query("update $sql_tbl[categories] set category='$category_name', description='$description',page_title='$page_title ', meta_description='$meta_description', meta_tags='$meta_tags', avail='$avail', order_by='$order_by', membership='$cat_membership' where categoryid='$cat'");
db_query("UPDATE $sql_tbl[categories] SET membership='$cat_membership' WHERE category LIKE '$category_name/%'");

db_query("update $sql_tbl[categories] set category=replace(category, '$old_category_name', '$category_name') where category like '$old_category_name/%'");
}

#
# Insert category icon
#
if (func_is_image_userfile($userfile, $userfile_size, $userfile_type))
db_query("update $sql_tbl[icons] set image='$image', image_type='$userfile_type' where categoryid='$cat'");

header("Location: category_modify.php?cat=$cat");
exit;
}

require "../include/categories.php";

require "./location_ajust.php";

$smarty->assign("usertype",$usertype);
$smarty->assign("rand", rand());
$smarty->assign("main","category_modify");
$smarty->assign("location",$location);

@include "../modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>

Finally, this can replace your meta.tpl file (be warned, I have the editorns.js script called from the root directory instead of the default path meta.tpl comes with. If your store isn't in a directory called (store) then you will want to leave those lines out:
Quote:
{* $Id: meta.tpl,v 1.9 2002/11/19 14:53:27 ndv Exp $ *}
{* funkydunk metamod *}{if $current_category.meta_description ne ""}<META NAME="description" CONTENT="{$current_category.meta_description}">{el se}<META NAME="description" CONTENT="{$config.Company.meta_description}">{/if}{* end of funkydunk metamod *}
{if $current_category.meta_tags ne ""}
<META NAME="keywords" content="{$current_category.meta_tags}">
{* funkydunk metamod *}{else}<META NAME="Keywords" CONTENT="{$config.Company.meta_keywords}">{* end of funkydunk metamod *}{/if}
{* funkydunk metamod 2003 *}
<META NAME="title" CONTENT="{$config.Company.meta_title}">
{* end of funkydunk metamod*}
<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="noarchive">
<META NAME="audience" CONTENT="all">
<META NAME="revisit-after" CONTENT="7 days">
<META NAME="Content-Language" CONTENT="en-us,english">
<META NAME="distribution" CONTENT="global">
{if $smarty.session.editor_mode eq "editor"}
<script>var store_language = "{$actual_languge}"</script>
{if $user_agent eq "ns"}
<script src="/store/skin1/editorns.js"></script>
{else}
<script src="/store/skin1/editor.js"></script>
{/if}
{/if}

Now when you go in to edit a category, you will have Page Title, Meta Description and Meta Keywords available. ALSO, the meta keywords WON'T just be added to the regular meta keywords that are specified in the old meta.tpl.

Enjoy!
Cameron
Reply With Quote
  #2  
Old 05-26-2003, 01:00 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 05-26-2003, 01:08 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

I forgot to mention that under your company options you can specify general meta tags / title tag for the non category pages.
Reply With Quote
  #4  
Old 05-29-2003, 10:32 AM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default

Does the Meta Tags for the category tranfer to the product pages???

Is there a way to change a product page's meta tags other than change them every time you create an HTML catalog?

Thanks,
Greg
Reply With Quote
  #5  
Old 05-29-2003, 10:35 AM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Actually, no. The products pull their meta info from the tags you set under the "company options"
Reply With Quote
  #6  
Old 05-29-2003, 10:37 AM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default

That is extremely bad news.... Bummer
Reply With Quote
  #7  
Old 06-04-2003, 12:21 AM
 
travisc travisc is offline
 

Member
  
Join Date: May 2003
Posts: 22
 

Default are meta tags really that important?

Seems like less and less importance is placed on the meta tag now days. Most engines seem to use the first paragraph or text on your index page. Can someone tell me the benefit of using this mod, beyond the obvious of having nice metas.
Reply With Quote
  #8  
Old 06-05-2003, 07:51 AM
 
eleven eleven is offline
 

Senior Member
  
Join Date: Nov 2002
Location: Charlotte, NC, USA
Posts: 118
 

Default the title is important though

Yes, metatags aren't very important, BUT page titles are very important. If you use the HTML Catalog feature, this mod is great.
__________________
|| E L E V E N ||
Reply With Quote
  #9  
Old 07-06-2003, 07:30 PM
 
nerd luv nerd luv is offline
 

Advanced Member
  
Join Date: Jun 2003
Location: California, USA
Posts: 58
 

Default

Just added this to my site and I'm very pleased with it! Hopefully there will be a way to incoprorate this with the product pages as well. Thank you funkydunk!
Reply With Quote
  #10  
Old 07-06-2003, 09:16 PM
 
stryker898 stryker898 is offline
 

Senior Member
  
Join Date: Jan 2003
Posts: 113
 

Default

The question is does this mod work with 3.4.2-3? Also, I just want to make sure its worth it. Right now each page has the same Title and Meta with the description of the product way down on the page. Not good from what I have seen so far.
Will this mod make it so the each product page (when converted to HTML catalog) will have a unique Meta and Title?

Chris
__________________
Never take life too seriously, cause none of us are getting out of here alive!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


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 09:07 AM.

   

 
X-Cart forums © 2001-2020