View Single Post
  #6  
Old 05-01-2009, 05:50 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,026
 

Default Re: Page Title in 4.2

OK guys here it is. This mod is for stores that do not use any 3rd party SEO mods and was tested on 4.2.1. I am pretty sure it will work on 4.2 as well. Use it and/or modify it in any way you want to fit your needs, after all it is FREE, just please do not charge other people for it claiming is something you did

1. Backup your store and database first. Better yet try this mod on a test store and make sure it works before applying it to your live store.

2. Adding language variables. You can use myphpadmin or x-cart patch/upgrade section for this, or just add them manually in the language section
Code:
INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_category_page_title', 'Category Page Title', 'Labels'); INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_product_page_title', 'Product Page Title', 'Labels'); INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_manufacturer_page_title', 'Manufacturer Page Title', 'Labels'); INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_pages_page_title', 'Static Page Title', 'Labels'); INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'lbl_page_title_what_is', 'What is Page Title?', 'Labels'); INSERT INTO `xcart_languages` (`code`, `name`, `value`, `topic`) VALUES ('US', 'txt_page_title_descr', 'Every html document (page) must have a TITLE element in its head section. This title element should be used to identify the contents of the document and is one of the most important factors for SEO friendly web page. The title should be less then 64 characters in length and it should contain your primary keyword phrase for that page and any secondary keyword phrase that you may be targeting.', 'Text');

3. Adding new fields for category, product, manufacturer and static pages in the corresponding tables. You can use myphpadmin or x-cart patch/upgrade section for this.
Code:
ALTER TABLE `xcart_categories` ADD `category_page_title` varchar(255) Not Null ALTER TABLE `xcart_products` ADD `product_page_title` varchar(255) Not Null ALTER TABLE `xcart_manufacturers` ADD `manufacturer_page_title` varchar(255) Not Null ALTER TABLE `xcart_pages` ADD `pages_page_title` varchar(255) Not Null

4. FOR CATEGORY PAGE TITLE
open admin/category_modify.php, find
Code:
$data = array( "category" => $category_name, "description" => $description, "meta_description" => $meta_description, "meta_keywords" => $meta_keywords, "avail" => $avail, "order_by" => $order_by, "override_child_meta" => $override_child_meta );
and replace with
Code:
$data = array( "category" => $category_name, "description" => $description, "meta_description" => $meta_description, "meta_keywords" => $meta_keywords, "avail" => $avail, "order_by" => $order_by, "override_child_meta" => $override_child_meta, "category_page_title" => $category_page_title #Added by CFL Systems for category page title );

open skin1/admin/main/category_modufy.tpl, find
Code:
<tr> <td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category}:</td> <td width="10" height="10"><font class="Star">*</font></td> <td height="10"> <input type="text" name="category_name" id="category_name" maxlength="255" size="65" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"html"}{elseif $mode ne "add"}{$current_category.category|escape:"html"}{/if}" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if}/> {if $category_error ne ""} {if $category_error eq "2"} <font color="red">&lt;&lt; {$lng.lbl_category_already_exists}</font> {else} <font color="red">&lt;&lt; {$lng.lbl_category_wrong_value}</font> {/if} {/if} </td> </tr>
and after it insert
Code:
{* Added by CFL Systems for category page title *} <tr> <td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category_page_title}:</td> <td width="10" height="10">&nbsp;</td> <td height="10"> <input type="text" name="category_page_title" id="category_page_title" maxlength="64" size="100" value="{if $category_error ne ""}{$smarty.post.category_page_title|escape:"html"}{elseif $mode ne "add"}{$current_category.category_page_title|escape:"html"}{/if}" /> <a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a> <div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div> </td> </tr> {* Added by CFL Systems for category page title *}

open include/import_categories.php, find
Code:
define('IMPORT_CATEGORIES', 1); $import_specification["CATEGORIES"] = array(
and add to the array
Code:
"category_page_title" => array() #Added by CFL Systems for category page title

in the same include/import_categories.php find
Code:
if (isset($category['product_count'])) $data['product_count'] = $category['product_count'];
and after it insert
Code:
if (isset($category['category_page_title'])) $data['category_page_title'] = $category['category_page_title']; #Added by CFL Systems for category page title

5. FOR PRODUCT PAGE TITLE
open include/product_modify.php and find
Code:
$query_data = array( "product" => $product, "keywords" => $keywords,
and add to the array
Code:
"product_page_title" => $product_page_title #Added by CFL Systems for product page title

open skin1/main/product_details.tpl, find
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product]" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_product_name}* :</td> <td class="ProductDetails"> <input type="text" name="product" id="product" size="45" class="InputWidth" value="{$product.product|escape}" {if $config.SEO.clean_urls_enabled eq "Y"}onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url)"{/if} /> {if $top_message.fillerror ne "" and $product.product eq ""}<font class="Star">&lt;&lt;</font>{/if} </td> </tr>
and after it insert
Code:
{* Added by CFL Systems for product page title *} <tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[product_page_title]" disabled="disabled" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_product_page_title}:</td> <td class="ProductDetails"><input type="text" name="product_page_title" maxlength="64" size="100" class="InputWidth" value="{$product.product_page_title|escape:"html"}" /> <a href="javascript:void(0);" class="NeedHelpLink" onmouseover="javascript: viewHelp('help_what_is_page_title', this);">{$lng.lbl_page_title_what_is}</a> <div id="help_what_is_page_title" class="NeedHelpBox" style="display:none">{$lng.txt_page_title_descr}</div></td> </tr> {* Added by CFL Systems for product page title *}

open include/import_products.php and find
Code:
$import_specification["PRODUCTS"] = array(
and add to the array
Code:
"product_page_title" => array() # ADDED by CFL Systems for product page title

Continue in the next thread
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote