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)
-   -   Xuru SEO Mod --> Free SEO Mod (https://forum.x-cart.com/showthread.php?t=24832)

JeremyL 09-12-2006 12:19 AM

X-CART-SEO Mod --> Free SEO Mod
 
The only free SEO Mod for X-Cart seems to have died (XC SEO). I have decided to take the GPL code contributed by it's author and run with it.

The first goal will be to debug and turn the current code into a production release. I will then use that base code to turn this into a full service SEO mod dealing with both URLs and on page content. All of this while making it easy to cinfigure in the backend.

What I need first is to create a roadmap for this plugin and I need your input on the mod in it's current state and what you would like to see.

Please test this current code base and tell me what bugs you can find and how you think it can be improved. I will then begin the work on a production release.

Known Bugs (so far)
  • Some CSS image links have broken urls like this one "/xcart/skin1/images/top_b.gif)/xcart//xcart/". (anyone see other urls like this one?)
  • Printable page link does not work
  • Are there still SSL link issues? I don't have SSL installed to test.
  • What pages are not being rewritten properly? I think most all pages not dealing with the catalog should not be getting rewritten. Cart.php does not need to get indexed and so on. Please list what you consider needing static pages and which pages should be left out.
Current Features
  • Creates html links for higher search engine rankings and increased traffic
  • Replaces your PHP links with .html links
  • Updates automatically and removes the need for manually generating a catalog
  • Uses folders instead of .html files for category names
  • Adds additional keywords to your product and category urls through use of a sub-folder for increased keyword density.
  • Creates one link per product to prevent penalization from search engines for duplicate content.
  • Auto-creates your product and category urls on installation - In X-CART-SEO, this is handled automatically
To Do
  • Need default robots.txt file
  • Please let me know what you want
  • Static Catalog pages should 301 redirect to SEF Mod pages
Note that I am testing on Version 4.1.3. I could use a test bed for 4.0x versions.

You can download it here:
http://code.google.com/p/x-cart-seo/

You can also post and / or see what bugs we are working on here:
http://code.google.com/p/x-cart-seo/issues/list

I'll still respond to bugs in this thread in case people don't have a gmail account.

Install docs can be found here:
http://x-cart-seo.googlecode.com/svn/trunk/x-cart-seo%20docs/

Kjellstroem 09-12-2006 12:56 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Thanks for putting in the time to work on a free seo mod. Is there any special process to install the plugin?

JeremyL 09-12-2006 01:02 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
See addition to the first post for install instructions.

I have already made some improvements in the code to fix some bugs.
  • There is no longer a query string after the .html extension
  • Product images now work if you are using the database to store them
  • The search is now sortable

intel352 09-12-2006 04:55 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
hey jeremy, glad to see someone has taken this over. i've been so focused on other projects in the company that i haven't been able to devote any time to that (plus the server that my personal sites were hosted on, got hacked, been having to rebuild...)

we've got SSL certs, so I'll test out your changes sometime soon. i think one major issue (if i remember correctly) was /~username type of websites (for shared SSL certs) didn't seem to work right (but again, it's been what, 4 or 5 months? so i could be wrong)

cheers

intel352 09-12-2006 05:11 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
oh, btw, i'm surprised the install instructions are working for you, on v4.1. That was another issue, where v4.1 has changed enough that the install instructions had to be changed regarding where a couple of the code inserts should be placed. i'll test today to verify that is still the case

JeremyL 09-12-2006 07:02 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Good to see you still around. Being how long it had been since and update and the fact the site was down, I thought maybe you had changed jobs and didn't have a need for x-cart any more.

On the install instructions, they actually are not correct as far as where to put the new code. All the code pieces you mentioned looking for have changed so I just put the new code where I figured it would work and it did. I just haven't gotten to rewriting them for 4.1.x. Soon I will try and create an install doc for both versions and put them in the release files.

I'm going out of town until Thurs. later on today, but will start working some more on this when I get back.

intel352 09-12-2006 07:12 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
the outputfilter file replaces the php urls with the html counterparts, at the Smarty level.

i dunno if you've seen how other SEO mods work for x-cart, but DSEFU for instance, had edits for every template that referenced .php urls, which was a huge amount of work. I wanted to replace everything everywhere fairly easily, so the outputfilter parses the smarty templates before the content gets sent to the browser

the reference to "lofi" is where I attempt to cleanup for SE's, but that mode is optional, and only a part of the outputfilter.

intel352 09-12-2006 07:15 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
just a note, in the outputfilter, the array: '$remove_tags' should probably be named '$exclude_tags' or something similar. those are tags that *shouldn't* be removed by func_strip_tags, if i remember correctly.

JeremyL 09-12-2006 07:44 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Sorry, I have not had a chance to see how the others work. Didn't want to spend the $$$ when this one could just be finished.

I was getting confused because in the other thread you and another guy started talking about how the system didnt recognize something as a bot. It was really late last night so I don't remember exactly.

I'm still trying to get my head around all the regex. Times like this is when I wish I had a VS.NET system for php so I could step through the code line by line and see the contents of the vars.

intel352 09-12-2006 07:48 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Ha, something like that would be nice ;-)
Maybe try something like Zend Studio 5 with the debugger enabled (never used the debugger, but supposed to show alot of info)

Additionally, a project for this mod has now been created at Google:
http://code.google.com/p/x-cart-seo/

Create a user account with google if you don't already have one, I'll add you to the team.

JeremyL 09-12-2006 07:56 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
xurunet is my account name

intel352 09-12-2006 08:00 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
acct created, check your PM inbox. when you get a chance, might want to update the initial post (if editing is allowed) to mention the SVN location (and it has Issue tracking, which is nice)

Jon 09-12-2006 10:14 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by intel352
i dunno if you've seen how other SEO mods work for x-cart, but DSEFU for instance, had edits for every template that referenced .php urls, which was a huge amount of work. I wanted to replace everything everywhere fairly easily, so the outputfilter parses the smarty templates before the content gets sent to the browser


While this makes for less work, it should be noted that it's a huge amount of overhead, particularily with an intensive function like preg_replace, and likely will effect performance significantly.

intel352 09-12-2006 10:21 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
:-D and thus the reason that it's free ;-)

I've been tossing other ideas around for intercepting at a lower level to replace the URLs, but I haven't come up with anything solid yet. But as you said, performance does take a hit, so if we can't figure out a way to speed it up sufficiently, I'll probably go the DSEFU route of IF-statements in the template files (that method doesn't lend itself well to users that have a fully customized theme, though)

Alternatively, could provide a script with the mod, that would backup the user's specified theme, and then recreate the theme with all of the url structures rewritten to .html instead of .php (as needed). Then assuming we hook in to the proper areas with the mod and catch any urls that were generated dynamically by x-cart, that should remove any need for the outputfilter

we'll see, hopefully the solution will be painless :-D

Jon 09-12-2006 10:56 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Yeah I understand. Just wanted users to be aware that there are positives and negatives to both approaches (edits vs. filtering) and there currently isn't an in-between :)

intel352 09-12-2006 11:13 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
:-)

Jayk 09-12-2006 07:10 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Thanks intel352 for all of your work and JeremyL for picking up the torch.

I am looking forward to seeing install instructions for 4.1.x so that I can try this mod out. After reading through the threads, it looks very interesting.

Cheers,
Jason

hooter 09-12-2006 07:34 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Just to clarify, DSEFU no longer requires template edits whatsoever and hasn't for over a month now.

Kudos to the free project team though, for offering their time and expertise to the xcart community. 8)

Quote:

Originally Posted by intel352
sufficiently, I'll probably go the DSEFU route of IF-statements in the template files (that method doesn't lend itself well to users that have a fully customized theme, though)


geckoday 09-12-2006 09:07 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by Jon
While this makes for less work, it should be noted that it's a huge amount of overhead, particularily with an intensive function like preg_replace, and likely will effect performance significantly.

It actually doesn't have much of an affect on performance. I implemented a stripped down version of this mod so it works pretty similar to DSEFU. I'm now doing some profiling of X-Cart using XDebug to find where the most time is spent and I'm not seeing a noticeable difference in execution time with or without the output filter doing preg_replace on the URL's.

intel352 09-13-2006 04:33 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
awesome, glad to see you're putting some time into testing this for us geckoday ;-)
might i ask, how many products do you have in your test store? i think with stores that have less urls to display, it's not so bad, but if you were to go to a product page that had 100+ urls, it might get a bit intensive (my employer's website has a ton of cross-referencing links over the entire site, since our site is based around music, and every CDG, Artist, and Song is a product link)

so i'll be interested to see the performance difference when used in a such an environment (i'll be testing it soon on a test version of my employer's site, haven't been able to just yet)


@hooter: glad DSEFU got rid of the template edits, that's awesome ;-)

intel352 09-13-2006 04:46 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
@geckoday: you mentioned you implemented a stripped down version. out of curiousity, what did you strip out?

geckoday 09-13-2006 06:35 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by intel352
might i ask, how many products do you have in your test store? i think with stores that have less urls to display, it's not so bad, but if you were to go to a product page that had 100+ urls, it might get a bit intensive (my employer's website has a ton of cross-referencing links over the entire site, since our site is based around music, and every CDG, Artist, and Song is a product link)

I have 16 products/page. I just loaded up some test products and tried 200 products/page. It wasn't a very good test as the page generation time and size of the HTML page (118K) was unacceptable even without the output filter. But for reference XDebug was showing about 1/10 second increase in CPU and elapsed page generation time went from about 4.75 seconds to 5.37 seconds with the filter. I think most of that time is due to the large size of the HTML. If I customized the templates to generate much more compact HTML I think the difference would be far less.

BTW, when you are testing you can add a query string variable benchmark=y (e.g. http://www.example.com/home.php?cat=262&benchmark=y) to your URL's and then if you list the page source you'll see page generation times at the end of the source.

geckoday 09-13-2006 06:51 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by intel352
@geckoday: you mentioned you implemented a stripped down version. out of curiousity, what did you strip out?

I wasn't ready to spend the time debugging as I have way too many other projects on my plate for the holiday season. So I went for bare bones get the job done simplicity and cut out a lot of the features. I really gutted it and borrowed some from the HTML catalog generation to simplify. Lofi, config stuff, category folders, image links and any pages other than category, product or manufacturers are all gone. Any links with extraneous query string parameters are ignored (e.g. sort= on category pages).

B00MER 09-13-2006 06:58 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
What did one regular expression say to the other?

.+

:D

intel352 09-13-2006 06:59 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
When testing, assuming you're intending to apply this to a live site, please carefully test the effects of the SEO mod when in SSL mode (if you will be incorporating SSL into your store). This was an area that the mod suffered in during testing last I remember.

I appreciate all your feedback on this btw. If you reach a point where you're happy with the stripped-down mod, would you mind sending me a copy of your stripped implementation, so I can view the code changes? It might be a good idea to offer a SEO-Lite version as well, I'm thinking.

Email is intel352 [AT] gmail [DOT] com

intel352 09-13-2006 06:59 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by B00MER
What did one regular expression say to the other?

.+

:D


lmfao

geckoday 09-14-2006 07:23 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by intel352
When testing, assuming you're intending to apply this to a live site, please carefully test the effects of the SEO mod when in SSL mode (if you will be incorporating SSL into your store). This was an area that the mod suffered in during testing last I remember.

I appreciate all your feedback on this btw. If you reach a point where you're happy with the stripped-down mod, would you mind sending me a copy of your stripped implementation, so I can view the code changes? It might be a good idea to offer a SEO-Lite version as well, I'm thinking.

Email is intel352 [AT] gmail [DOT] com

I have had it running live and taking orders for several weeks now. I have found one problem where x-cart adds a query string ?xid=xxxxxxxxxxx when leaving checkout pages and my .htaccess ignores it causing page not found. I'm going to update it to allow query strings then I'll send it along.

intel352 09-14-2006 07:44 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Great, thanks gecko ;-)

JeremyL 09-14-2006 01:05 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
I have updated the install docs. They will be included in all new release downloads and can be found here

http://x-cart-seo.googlecode.com/svn/trunk/x-cart-seo%20docs/

Jayk 09-14-2006 02:18 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
In the install docs, under files that need to be edited, you show:

/smarty.php
/auth.php
/smarty.php

I think the first one is supposed to be config.php. :wink:

Cheers,
Jason

Jayk 09-14-2006 02:23 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Is anyone running this mod on a 4.1.x production site? I'd like to see it in action before I give it a whirl.

Thanks,
Jason

JeremyL 09-14-2006 02:49 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by Jayk
In the install docs, under files that need to be edited, you show:

/smarty.php
/auth.php
/smarty.php

I think the first one is supposed to be config.php. :wink:

Cheers,
Jason


Fixed. Thanks

JeremyL 09-14-2006 02:51 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by Jayk
Is anyone running this mod on a 4.1.x production site? I'd like to see it in action before I give it a whirl.

Thanks,
Jason


I've got it on a private url. I'll install a test copy on a public url tonight and post it.

intel352 09-14-2006 05:02 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
I personally do not recommend the mod for production use currently. If anything, please wait until geckoday uploads his modified files, they have been in use on a production site with few issues for awhile now.

Additionally, if I remember correctly, when I installed mod on x-cart 4.1, I believe I did have to modify auth.php at one point. I don't remember exactly tho. The entry point for the mod in 4.1 was different than in 4.0

I'll check the docs tomorrow, don't have long on a net connection tonight

geckoday 09-15-2006 11:34 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
1 Attachment(s)
OK, here's my version. One known issue. Foreign characters in product names don't get converted into something usable in a URL (neither do they in the HTML catalog BTW since I borrowed the code from there). Intel352 has a fix for that and will post it later.

Unzip the attached file to include/templater/plugins/outputfilter.seo.php

In your .htaccess file add this:
Code:

RewriteEngine on

RewriteBase /

# Rewrite SEO category URL's
RewriteRule ^([^/]*/)?[^/]+-c-([0-9]+)-p-([0-9]+)\.html$  $1home.php?cat=$2&page=$3                    [L]
RewriteRule ^([^/]*/)?[^/]+-c-([0-9]+)\.html$            $1home.php?cat=$2                            [L]

# Rewrite SEO manufacturers URL's
RewriteRule ^([^/]*/)?[^/]+-m-([0-9]+)-p-([0-9]+)\.html$  $1manufacturers.php?manufacturerid=$2&page=$3 [L]
RewriteRule ^([^/]*/)?[^/]+-m-([0-9]+)\.html$            $1manufacturers.php?manufacturerid=$2        [L]

# Rewrite SEO product URL's
RewriteRule ^([^/]*/)?[^/]+-pr-([0-9]+)\.html$            $1product.php?productid=$2                    [L]


In smarty.php add this at the end just above the warning comments:
PHP Code:

############################################################
# SEO Optimization Mod
############################################################
#
# Output Filters
#
include_once($xcart_dir."/include/templater/plugins/outputfilter.seo.php");
if(
AREA_TYPE=='C' && $HTTPS != "on" && class_exists('seo_filter')) {
  
$seo = new seo_filter;
  
$smarty->register_outputfilter(array($seo,"outputfilter"));
}
# END SEO 


That's it. I have tested this on 4.0.19 and looked at versions 4.0.12 - 4.1.2 and it should work in those just fine. It really doesn't modify any existing code so it will probably work with any 4.0.x or 4.1.x version.

It is running live at http://www.snowriver.com. Performance may suck as I'm having problems with my VPS host. They keep getting someone bogging down the machine and its not me. Been going on for over a week now calling them every day. No time to be cheap moving into the holiday season so I'm moving to a dedicated server soon to avoid having problems due to other denizens of the server I'm on.

intel352 09-15-2006 11:46 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
I'm working with geckoday's code at the moment, it's nicely done. Testing on X-Cart 4.1.2 shows that the mod works well.

I'm making a few modifications so that Accented characters will translate properly, and I'm also working on code to redirect the old home|product|manufacturers.php urls to the new .html url, to help prevent duplicate content.

I'll create a code branch in the SVN repository and upload my changes there, as well as creating an archive for you guys to download directly ;-)

Jon 09-15-2006 12:17 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Just a note, you'll also want to rewrite the sort links on the category pages, the printable urls, and the js=n/y links or block them in an .htaccess file to prevent duplicate content.

geckoday 09-15-2006 09:53 PM

Re: Xuru SEO Mod --> Free SEO Mod
 
Quote:

Originally Posted by Jon
Just a note, you'll also want to rewrite the sort links on the category pages, the printable urls, and the js=n/y links or block them in an .htaccess file to prevent duplicate content.

Those items would also cause duplicate content in base X-Cart. My mod is a step up but not the holy grail which is exactly what was intended. As I said earlier, it works pretty much just like DSEFU which doesn't do those things and there seems to be a lot of people happy with its ability to increase rankings.

geckoday 09-16-2006 06:57 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Ooops. I forgot to post the changes to the Froogle module. These froogle changes apply to 4.0.19 and 4.1.x. You can probably figure out the equivalent change for earlier releases but I don't believe they work with the new google base anyway. At the top of froogle.php right after this:
PHP Code:

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


Add this:
PHP Code:

$seo = new seo_filter


Then find this:
PHP Code:

$post substr(str_replace(array("\t","\r","\n"), array(" ","",""), $product['product']), 080)."\t".
                
$product['descr']."\t".
                
$http_location.constant("DIR_CUSTOMER")."/".$prod_url."\t"

And replace it with this:
PHP Code:

# Build SEO URL
      
$prod_url $seo->_product_filename($product['productid'], $product['product']);

            
# Post string
            
$post substr(str_replace(array("\t","\r","\n"), array(" ","",""), $product['product']), 080)."\t".
                
$product['descr']."\t".
                
$http_location.constant("DIR_CUSTOMER")."/".$prod_url."\t"


NOTE: Edited Saturday 9/16 at about 2:40 PM PDT to remove unneccessary include_once, added note on releases and fixed the find/replace for the product URL (I was wolfing down breakfast rushing to get out the door to open my B&M store and botched it horribly). Just goes to show you there are good reasons to pay for DSEFU or CDSEO - you get someone who has packaged it for human consumption already and will install it and make sure it works on your box.

B00MER 09-16-2006 11:32 AM

Re: Xuru SEO Mod --> Free SEO Mod
 
Shouldn't Smarty auto-magically include/require anything within its plugin subdir?

:arrow: http://smarty.php.net/manual/en/plugins.php :?:

Making this line, not needed?
PHP Code:

include_once $xcart_dir."/include/templater/plugins/outputfilter.seo.php"



All times are GMT -8. The time now is 10:35 PM.

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