Page 1 of 5

[RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Tue Oct 07, 2008 7:12 pm
by david.gilbert
I've been Compiling all of my SEO Contribs into one complete Package for OpenCart 0.7x

This is to replace the Google Tools and URL Alias  Contribs previously posted. Many Enhancements have been made to the URL Alias function including the use of yoursite.com/category/product.html style urls.

This package will give you:
  • Full URL Alias Support with URL Alias Generator
  • Google analytics tracking and verify meta tag support.
  • Automagic Google Sitemap Generator.
All features appear as a new SEO tab in Admin -> Configuration -> Settings.

The Generate URL Aliases option appears under the Admin -> Configuration Menu.

Just drop the files into your site root (all files are in correct folders) then choose to enable which ever feature(s) you like.

A Big thanks to Bruce for all the help with the creation of this pack!

-Dave

Re: [Released] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Tue Oct 07, 2008 7:22 pm
by david.gilbert
One small note I forgot to mention:

The Google Sitemap addon uses the URL Alias table from the database to generate the sitemap. Even if you are not using search engine friendly URL's, you need to go to Admin -> Configuration -> Generate URL Alias to populate the URL Alias Table for the Google Sitemap to work.

The Google Sitemap controller determines the URL Styles being used and will create the sitemap accordingly for you.

-Dave

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 7:06 pm
by jty
I have this working now on 0.7.8 with Bruce's Sub category Code

After reading through the thread at http://forum.opencart.com/index.php/topic,1677.0.html

In generate_url_alias.php I replaced

Code: Select all

/*generate categories & subcategories
        $sql = "select c.parent_id, c.path, cd.name from category_description cd left join category c on (c.category_id = cd.category_id)";
        $this->_generate_url_alias($sql, 'controller=category&path={0}', array('path'), array('name'));
with
//generate category
        $sql = "select category_id, name from category_description";
        $this->_generate_url_alias($sql, 'controller=category&path={0}', array('category_id'), array('name'));

        //generate sub-category into category
        $sql = "select category.parent_id, category.category_id, category_description.category_id, category_description.name FROM category, category_description WHERE category.category_id = category_description.category_id";
        $this->_generate_url_alias($sql, 'controller=category&path={0}_{1}', array('parent_id', 'category_id'), array('name'));
I also had to add
$this->_insert_url_alias('controller=search&action=page', 'search.html');
$this->_insert_url_alias('controller=account_forgotten', 'forgotten-password.html');

I don't know if this is the correct way or the incorrect way but it works for me. Not being a programmer, I have to resort to desperate measures  8)

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 7:36 pm
by Qphoria
that is odd considering bruce and I both use the tree class framework.

I an going to be redoing the subcat contrib to have an admin panel that can allow many different configurations for 079+

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 8:30 pm
by jty
From the code of Bruce's that I found, which starts off with tmcguire, Bruce used
'href' => $url->href('category', false, array('path' => $result['category_id'])),

Your contribution uses
'href'  => $url->href('category', false, array('path' => $result['path'])),

Somehow, the use of either category_id or path in the subcategory menu link changes the subcategory-product link
I dunno. Too hard for me  :D

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 9:05 pm
by Qphoria
Yea, that goes back to the original fix I offered in the old URL Alias Generator thread:
http://forum.opencart.com/index.php/top ... ml#msg7483

Depending on if david and bruce used "category_id" again instead of "path" would probably be the difference here.
But it looks like they are using the code fix I offered from the other thread, tho you reverted it back to the old code. So I'm not sure why it doesn't work with my cat menu.  I will take a look

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 9:15 pm
by jty
Qphoria wrote: Depending on if david and bruce used "category_id" again instead of "path" would probably be the difference here.
But it looks like they are using the code fix I offered from the other thread. So I'm not sure why it doesn't work with my cat menu.  I will take a look
Looks to me like this SEO contribution is using path for the subcategory URL, hence your sub menu works for sub categories
But it's using category_id for the products so Bruce's subcategory product links work but yours don't but your subcategory link works but Bruce's don't

And that is why I got confused  ;D
Unless I'm reading it all wrong which is quite possible given I have no idea what I'm doing in code.

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 9:22 pm
by Qphoria
Ok, I installed this contrib on my 0.7.8 test site (fresh install) and I'm getting:
Notice: Undefined offset: 1 in D:\EasyWAMP\www\opencart078a\library\application\router.php on line 74

right off the bat for ALL links. The page never changes. I've not made any admin side changes yet.

-EDIT-
Now that I've run the Generate URL Alias thing, that error goes away, until I follow the path to my product. On the product page, it comes back.

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 9:28 pm
by Qphoria
jty wrote: Did you edit your htaccess file?

I also had to do this one to be able to turn off the SEO

Code: Select all

In this file:
library/environment/url.php
change:

if (!preg_match('/\/admin\/index.php/',$_SERVER['PHP_SELF'])) {

to:

if ((!preg_match('/\/admin\/index.php/',$_SERVER['PHP_SELF'])) && ($this->config->get('config_url_alias'))) {
But I don't want to turn off url alias.. thats the whole point of this contrib.

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 9:38 pm
by Qphoria
Ok, without using ANY subcategory contribs, the product link is already broken. There isn't even one in the URL_Alias table in the admin area. I'm not sure how a subcategory mod could add an alias

I have
Category 1 -> category-1.html (correct)
-- Cat1 Sub1  -> cat1-sub1.html (correct)
---- Sub1 SubA  -> sub1-suba.html (correct)
------ Product 1 -> none!

That is just following the default opencart structure without any category sidebox contribs.

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Fri Oct 10, 2008 10:09 pm
by david.gilbert
ok.. i'm working on a second release, some issues have popped up with the google sitemaps in testing. I built this contrib on my codebase @ opencart-extras (1.02)

I will install 0.7.8 again on my testing server and get it all fine tuned over the next day or 2 then re-release it.

-Dave

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Sat Oct 11, 2008 10:00 am
by david.gilbert
New File Released

Fixes
  • Put the correct Generate_URL_ALIAS.php in place (was still the older version)
  • Fixed Google sitemaps issues
If your config.php & admin/config.php does not already have it, Add the following line

Code: Select all

define('HOSTING_DIR', '/path/to/opencart'); 
Attached to both this and first post!

-Dave

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Sat Oct 11, 2008 2:13 pm
by jty
Thanks David, it works for sub category products now
I had to make a tiny change to Bruce's sub category code - changed from 'category_ID' to 'path'
Qphoria's sub category menu should work as that already uses 'path'

I found 2 missing URLS

Code: Select all

$this->_insert_url_alias('controller=search&action=page', 'search.html');
$this->_insert_url_alias('controller=account_forgotten', 'forgotten-password.html');
Thanks for such a fast fix

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Sat Oct 11, 2008 4:02 pm
by bruce
jty wrote: Thanks David, it works for sub category products now
I had to make a tiny change to Bruce's sub category code - changed from 'category_ID' to 'path'
Hi jty,

Could you please post the change you mentioned above, as a code snippet. I am not entirely sure where you meant.

thanks

Bruce

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Sat Oct 11, 2008 4:18 pm
by jty
Hi Bruce,
Over here http://forum.opencart.com/index.php/topic,654.15.html
On January 06, 2008, in category.php

change

Code: Select all

'href' => $url->href('category', false, array('path' => $result['category_id'])),
to

Code: Select all

href' => $url->href('category', false, array('path' => $result['path'])),
ie change category_ID to path
This will make your code work with this SEO contribution

Thanks for your code

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Tue Oct 14, 2008 8:44 pm
by Qphoria
jty wrote: Hi Bruce,
Over here http://forum.opencart.com/index.php/topic,654.15.html
On January 06, 2008, in category.php

change

Code: Select all

'href' => $url->href('category', false, array('path' => $result['category_id'])),
to

Code: Select all

href' => $url->href('category', false, array('path' => $result['path'])),
ie change category_ID to path
This will make your code work with this SEO contribution

Thanks for your code

A little more detail about path vs category_id
http://forum.opencart.com/index.php/top ... ml#msg7483

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Tue Oct 14, 2008 8:46 pm
by bruce
Hi Q,

Its not related to this thread but a fix for some old code in the subcategories module thread he linked to.

cheers

Bruce

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Tue Oct 14, 2008 9:15 pm
by Qphoria
bruce wrote: Hi Q,

Its not related to this thread but a fix for some old code in the subcategories module thread he linked to.

cheers

Bruce
Right. I was just referring more to my particular post in that thread that explains more why I used path instead of the previous uses of category_id. I too at one point had category_id in my code until I realized that path worked better for the hierarchy.

;)

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Wed Oct 15, 2008 7:06 am
by bruce
I use path too. It was a genuine bug in the posted code.

Re: [RELEASED] - OpenCart 0.7x Complete SEO Upgrade Package

Posted: Wed Oct 15, 2008 8:41 am
by Qphoria
bruce wrote: I use path too. It was a genuine bug in the posted code.
Oh sorry