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)
-   -   [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1 (https://forum.x-cart.com/showthread.php?t=39539)

Kip 05-17-2008 05:31 PM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
While I work my way through the install, can you or one of the readers tell me generally how this works, i.e. how it's doing the URL rewriting, aside from the .htaccess?

My concern is that we've done many mod installs and custom hacks all throughout our X-Cart site (me grudgingly, but the clients want what they want). Other mods have you go through a tedious list of line-by-line hacks, which at least has the benefit of showing exactly what's going on in the code so we can adjust if necessary around all the messy hacks we've already done. But I can't quite tell exactly what XC SEO will do during its install.

Is there an assumption that, other than templates and other superficial customizations, the core X-Cart code is more or less the default? Any other kinds of gotchas that I should know about?

In particular, they've already had me hack up a completely custom form of "SEO" URLs, but one that doesn't include actual product names in the URLs. So I'm assuming I will have to back out of that first.

intel352 05-17-2008 06:51 PM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Hi Kip, XC SEO was the first X-Cart SEO module to make use of Smarty's output filter functionality (the other SEO modules at the time were tedious manual hacks to template files, php files, etc, to achieve a similar effect, but they have since decided to copy XC SEO's implementation method). Using the output filter means that manual template hacks are not needed. Before the page is output, XC SEO parses each page content for URLs that it recognizes, for Categories, Products, Manufacturers, Static Pages. When any urls are recognized, it automatically replaces each url with it's SEO'd counterpart.

While the install process doesn't require a fully stock installation, it does help to have a stock install, to ensure the patches apply properly. The patch changes only affect PHP files with fairly minor changes per file, so even if you have to manually patch, it's not as tedious as most modules.

While XC SEO replaces the URLs with aliases in the final output page, the .htaccess file will remap clicked alias urls back to their intended target in X-Cart.

The installer itself will insert SQL information that will add XC SEO as a module, you'll then have configuration options that you can change as needed via X-Cart General Settings for XC SEO. Additionally, XC SEO can be easily enabled/disabled as needed.

CybrMike 05-20-2008 07:59 AM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Jon,

I've looked at your mod and installed it. One thing that troubled me was the fact that it does a query for every single URL rewrite. Usually the same query over and over again. For example: Select category from xcart_categories WHERE categoryid='505';

To fix this, I simply added a &title= . urlencode(seo_title_of_product_or_category_name) to all of my urls (in appropriate products.tpl (or in my case, products_t.tpl) file, subcategories.tpl, categories.tpl, and a few misc others).

Then, in your code I before the query I added:

Code:

        if (!empty($options['title'])){
            $options['result_title'] = $options['title'];
            unset($options['title']);
        }


I also had to unset title from the _category_callback and _product_callback functions to remove ?title= from the URL:

Code:

    function _category_callback($found, $uri_only = false, $title = false) {

        $options = $this->_check_uri($found[3]);
        $options['result_title'] = $title;
        if($options['cat']){
            $filename = $this->_category_filename($options);
            unset($options['title']);
            $filename .= $this->_query_string_append($options);
            if($uri_only)
                return $filename;
            else
                return $found[1] . $found[2] . $this->_base_uri . $filename . $f
        }else{
            return $found[0];
        }
    }


This saved about 30 - 50+ queries per page. I am using memcache and it still sped things up significantly.

intel352 05-20-2008 09:07 AM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Hi Mike, nice change. I've actually implemented query result caching in XCSEO Pro to avoid situations with the same data being fetched repeatedly. I'm also investigating other improvements, such as building an array of all urls that need replacing, and build one-time queries that would fetch data for everything that needs to be replaced.

Any improvements that I come up with in Pro, that can be backported to basic, I'll backport.

BTW, while your method definitely improves performance, I do prefer to avoid having to edit template files. I've found users often have their skins replaced, or add mods that replace changes that have already been implemented, etc, more so with tpl files than php files. While you're a savvy user, and obviously know your way around code, most users aren't, so XC SEO basic is aimed at the "lowest common denominator", in this case.

But I appreciate your feedback, and I'll keep it in mind when making other changes to improve performance :-)

Ideally, I'd rather modify the function in X-Cart that pulls back product data, to cache that data to be globally accessible, same for categories, etc. There are multiple occasions when X-Cart itself queries more than once for the same dataset, and having that info cached already would be nice. Maybe I could develop that as a separate performance patch (would have to weigh the memory use against the benefit of less queries), and have XC SEO check for the existence of that performance patch, as an added optional speed boost.

EDIT: just as a note, I've worked on proprietary code before, that functions as a cache class. You could flag cache data as session based or persistent, and if persistent & memcache is available, the persistent data would be stored in memcache. That would be nice to have developed for X-Cart

m28m 05-23-2008 12:01 AM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Hi jon,i use XC SEO v1.3.0 but the Product rating star can not show ,it's my website problem ? V1.4.0 alredy fix this problem ?

intel352 05-23-2008 02:41 AM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Hi Ken, contact me via email (in my sig), we'll figure out what's going on :-)

Lingerieblowout 05-23-2008 05:33 PM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Any idea how to get XML Sitemap Generator to generate all the files site map XML etc .... there is no html files to be found in my XC ... http://www.xml-sitemaps.com/

Auren_B 05-24-2008 10:23 AM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Greetings! Does anyone know or have experience with XC SEO 1.3.0 correctly rewriting product pages, but not category pages. The links to category pages are bringing up a 404. Could it possibly be from using BCS Category Meta Titles? Thanks!

intel352 05-24-2008 12:26 PM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
Hi Lingerieblowout, I've sent you a PM to see if I can help you figure out the problem you're experiencing.

Auren, contact me via my email (in my sig), with your website URL, I'll see if I can help you troubleshoot.

Cheers

Auren_B 05-24-2008 12:51 PM

Re: [MODULE] XC SEO v1.4.0 Released for X-Cart 4.0 and 4.1
 
John, my associate Gary tells me he sent you a few emails during the last week about this, without reply. We're working on the same project. He's sending again right now. Thanks!


All times are GMT -8. The time now is 12:33 PM.

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