X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   free SEO mod - XC SEO -> needs testing & feedback (https://forum.x-cart.com/showthread.php?t=21383)

intel352 04-26-2006 01:24 PM

free SEO mod - XC SEO -> needs testing & feedback
 
XC SEO Lite v 1.0.0 Released

Thread is available at the following url:
XC SEO Lite Released

Quote:

The XC SEO team is proud to announce the release of XC SEO Lite version 1.0.0.
XC SEO Lite is completely free, and licensed under the GNU GPL 2 license.
All code is versioned and available from our repository at:
http://code.google.com/p/x-cart-seo/

A zip of the release is available at the bottom of this post.
This release is for X-Cart 4.0.x and 4.1.x

A .htaccess file is included, it is recommended that you open the .htaccess file and COPY the contents into your existing .htaccess file.
Additionally, a default robots.txt has been included. The robots.txt file should be used with discretion and modified as needed for your own website.

Any incoming product/manufacturer/category links are properly 301 redirected to their html alias, so any existing pagerank should be transferred properly.

-------------
This project was started around April of 2006, grew into a sizeable modification that had several bugs due to the complexity of the code, and then lay dormant until recently. Xuru sparked new interest in the project by releasing a copy of the original XC SEO code with a few fixes included. Then geckoday released a stripped down and rewritten version of the XC SEO mod.

Due to the issues that still existed with the original code, I decided to use geckoday's rewritten code as a base. After several feature additions, and after testing the code on a production website with positive results, I'm proud to announce the first public release of XC SEO Lite.
-------------

XC SEO Lite functions similarly to DSEFU, in that it requires 0 template edits, and writes all Product/Manufacturer/Category urls to .html page aliases: sitename.com/categoryname.html

In the near future, I intend to release an XC SEO Advanced version that will function similar to the original XC SEO release (and similar to CDSEO), with the ability to rewrite urls using categories as folders: sitename.com/category1/category2/productname.html

--------------

Quote:

CHANGELOG

XC SEO Lite 1.0.0 (rev 6 - September 20, 2006)
====================================

* Replaced original XC SEO code with geckoday's rewritten code (rewrite of outputfilter & htaccess, he had dropped all other code/files)
* Altered code to replace accented characters with non-accented equivalent
* Added support for rewriting 'printable=Y' urls
* Added support for rewriting 'sort' & 'sort_direction' urls
* Added seo.php to rewrite/redirect category/product/manufacturer urls to new HTML alias
* Added ability to inject user-specified keyword into urls
* Added IF condition that turns off the mod under HTTPS urls
* Added conditional support for SEO mod in Froogle module
* Added default robots.txt



intel352 04-26-2006 01:43 PM

Patching X-Cart for the SEO mod:

open config.php:
Find
Code:

@include_once($xcart_dir."/config.local.php");

After, Add
Code:


############################################################
# SEO Optimization Mod by intel352
############################################################
$seo_enable = true; // enabling the seo url optimizer
$seo_bot_lofi = false; // enabling lofi mode for bots (not certain of effects yet)
# END SEO


Open auth.php:
Find
Code:

include_once $xcart_dir."/config.php";

After, Add
Code:


############################################################
# SEO Optimization Mod by intel352
############################################################
if($seo_enable)
        include_once $xcart_dir."/seo.php";
# END SEO


open smarty.php:
Find
Code:

$smarty->debug_tpl="file:debug_templates.tpl";


After, Add
Code:

############################################################
# SEO Optimization Mod by intel352
############################################################
#
# Output Filters
#
if(AREA_TYPE=='C' && $seo_enable)
        $smarty->load_filter('output','seo');
# END SEO


Open skin1_original/meta.tpl:
Find
Code:

{assign var="_meta_keywords" value="$_meta_keywords`$config.SEO.meta_keywords`"}
 <META name="description" content="{$_meta_descr|truncate:"500":"...":false|replace:'"':"'"}">
 <META name="keywords" content="{$_meta_keywords|truncate:"500":"":false|replace:'"':"'"}">


After, Add
Code:

{if $is_robot and $lofi_mode}
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW,NOARCHIVE">
<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE">
{/if}



Froogle SEO mod - this modification is optional:

open modules/Froogle/froogle.php:
Find
Code:

if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }


After, Add
Code:

############################################################
# SEO Optimization Mod by intel352
############################################################
#
# Output Filters
#
if($seo_enable && !is_object($seo)){
        include_once( $xcart_dir.'/include/class.xcart_seo.php' );
        $seo = new XCart_SEO;
}
# END SEO


Find
Code:

                        # Define product category path
                        $cats = array();
                        $catids = explode("/", $product['categoryid_path']);


After, Add
Code:

                        $seo->forceProductsArr($product['productid'], $product['product'], end($catids));


Find
Code:

                                        $tmbn = $http_location."/image.php?productid=".$product['productid'];

Replace With
Code:

                                        $tmbn = $seo->createProductUrl($product['productid'],$http_location);

Find
Code:

                        $post = $http_location.constant("DIR_CUSTOMER")."/product.php?productid=".$product['productid']."\t".

Replace With
Code:

                        $product_uri = $seo->createProductUrl($product['productid'],$http_location.constant("DIR_CUSTOMER"));
                        $post = $product_uri."\t".


Save and Close all files.

############################

IMPORTANT: if you already have a .htaccess file on your server, you need to (selectively) add in the changes, from the provided .htaccess file.

Download the zip file linked in the first post, extract the contents to your harddrive, and upload:
.htaccess -> xcart root
seo.php -> xcart root
include/class.xcart_seo.php -> include/
include/templater/plugins/outputfilter.seo.php -> include/templater/plugins/

Done

intel352 04-27-2006 06:15 AM

ToDo:
  • add Froogle compatibility - DONE
  • fix relative urls - DONE
  • create SEO urls for static pages & help pages
  • alter product and category urls to make sure they are accessible from *1* url only. this means the url being visited will need to be verified as the proper url, if not, 301 redirect to the proper url - DONE
  • add Alt text to urls that don't have it, for better keywords in site content
  • implement filter for Stopwords

cotc2001 04-27-2006 09:34 AM

Can you add to the "to do" list.

Intergrate with froogle feed generator.

Its a must for any type of mod like this.

I know the mod is generally for your client and i've got no right to ask but it would be cool

intel352 04-27-2006 09:37 AM

sure, that was actually one of my intentions, but I had forgotten :o

thanks for reminding me ;-) (btw, this is an in-house project for my corporate employer, but any improvements that are suggested are welcome, because they will benefit us as much as you :-) )


I'll edit the post above with the ToDo. just a note, I've now fixed relative urls, and the mod is working VERY nicely in testing (also had to fix any FORM urls, since they are all relative as well). i'll post the updated files soon

intel352 04-27-2006 10:23 AM

SEO MOD UPDATED - to version 0.2
  • fixed relative urls
  • rewrote home.php to home.html
  • added rules into .htaccess to set directory index to home.html

Note: the .htaccess file that I use is now included in the zip archive. Do not upload blindly. If you already have a .htaccess file, you'll need to merge in my changes.

intel352 04-27-2006 10:47 AM

Quote:

Originally Posted by cotc2001
Can you add to the "to do" list.

Intergrate with froogle feed generator.

Its a must for any type of mod like this.

I know the mod is generally for your client and i've got no right to ask but it would be cool


Just a note, old urls are directed to the new url location, so this mod wouldn't break .php links. So, you won't lose any froogle compatibility, per se.

Anywho, I'm working on implementing Froogle-module urls right now :-)

intel352 04-27-2006 01:10 PM

SEO MOD UPDATED - to version 0.3
  • Fixed a random bug affecting Category urls
  • Added Froogle support! (and added a new patch file for the Froogle mod)

EDIT: Once you install the SEO mod, you must Export the Froogle txt file for the SEO urls to be created in the export.

The install instructions have been updated, please read! (2nd post)

Cheers!

Megamuch 04-29-2006 03:54 AM

I'm trying to apply this mod to default 4.1 install.

I'm getting there. The category urls are working, just redirecting is not working actually. I just get kicked back to home.php.

Product urls are fubar, which is strange because the url system was not updated between 4.0.18 and 4.1 (To my knowledge).

I'll see what I can make of it.

intel352 04-29-2006 06:23 AM

keep in mind, the project is still not recommended for a live website, i found a bug the other day that requires a rewrite of some of the url-matching code.

i haven't tested on 4.1 yet, i'll have to test it to see what's going wrong


All times are GMT -8. The time now is 03:14 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.