Jump to content
spidometrs

[CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

Recommended Posts

Forgive the formatting, i'm currently working on the layout so each page is a bit of a mess but you can see the exhibiting behaviour here:

 

http://gardenmachinerywebsite.co.uk/catalog/warner-m-3.html

 

If you click on the Show: and select a category, it will go back to home page. but this works with the contrib turned off. Puzzling.

 

Or go here: http://gardenmachinerywebsite.co.uk/catalog/conditions.php

 

and then select a manufacturer or category from the drop down boxes on left hand menu.

Share this post


Link to post
Share on other sites

One last thing I'll add is that this would work on my website before I moved hosting provider. It works on a different host account perfectly, this is new and since i moved to 1&1 / 1 and 1.

 

I'm wondering if it's how the html output query works on 1&1 servers, or if the .htaccess rewrites need to be written in a certain way to accommodate....

 

Any help would be brilliant.

Share this post


Link to post
Share on other sites
/index.php?catalog=index.php

 

However, I turn the seo function off and these search / filters all work perfectly.

 

You are using the wrong version of seo urls, use 2.1d ORIGINAL updated as last uploaded by me.

 

Another strange thing is I can access the search engine friendly page for the manufacturer by typing it in directly. e.g. /catalog/microsoft-m-2.html. It just seems like how it's handling the initial call from picking an option on any of my drop down menu's.

 

You should be able to do this .. this is normal operation.

Share this post


Link to post
Share on other sites
(FWR Media @ Feb 9 2009, 08:46 AM) post_snapback.gifI would imagine that & is being passed in the querystring via tep_redirect() there are quite a few posts in this topic about the change to make. Failing that turn off the W3C option in admin.

 

I made this change to seo.class

// case ($this->attributes['USE_SEO_REDIRECT'] == 'true'):

// header("HTTP/1.0 301 Moved Permanently");

// $url = str_replace('&', '&', $url);

// header("Location: $url"); // redirect...bye bye

// break;

$url = str_replace('&', '&', $url); // Remove the W3C & when redirecting

header("HTTP/1.0 301 Moved Permanently");

header("Location: $url"); // redirect...bye bye

break;

 

and also tried your suggestion "turn off the W3C option ".

 

Sorry to say no joy. Any other suggestion you may have for me?

Share this post


Link to post
Share on other sites
Thanks early bird!!

 

Sounds like I could be off to left join heaven.

 

Installing v2.0b on a server running mysql5?

 

http://addons.oscommerce.com/info/4654


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Thanks for the heads up, I rolled back to your working version and read your note about people changing the contrib - it works now! I feel satisfied for the day!

Share this post


Link to post
Share on other sites
Well after some coding I've came up with the following code to the manufacturer to product url that will add the category name to the url. So far this is what I have:

 

the SQL:

$sql = "SELECT p.products_id as id, pd.products_name as name, c.categories_id as id, cd.categories_name as cname FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd, ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd, ".TABLE_PRODUCTS_TO_CATEGORIES." ptc WHERE p.products_id=ptc.products_id and c.categories_id=ptc.categories_id and c.categories_id = cd.categories_id and p.products_status='1'";

 

and the below portion:

 

while ($product = $this->DB->FetchArray($product_query)) {

$define = 'define(\'PRODUCT_NAME_' . $product['id'] . '\', \'' .

 

$this->strip($product['cname']) . '/' . $this->strip($product['name']) . '\');';

$prod_cache .= $define . "\n";

eval("$define");

 

The only problem with the code above is it pulls the category as the product id. So in otherwords.. if product 3 is in category 1 it will still display category 3 for product 3. Im not an SQL programmer but I know thats where we need to look at. Maybe do something with the PRODUCTS_TO_CATEGORIES table.

 

If anyone can fix my code above to display the proper category I will release alot of my mods to oscommerce including a completely converted version from tables to a div/css version. Thanks!

 

 

I've been trying many different things to add the category to the url. I've successfully coded my own version on a separate page that drops all urls from the cache and than remakes them. I suppose I could make a script that compares the current url with the url in the cache and update as needed. I would however like to see if anyone could fix the code above as that wouldn't only help me but alot of others. Thanks!

Share this post


Link to post
Share on other sites

Version installed

 

2.1d ORIGINAL updated Jack_mcs 23 Nov 2008 on linux/php4/mysql5

 

Corrected the left joins so it will run on mysql5 as previously but on this site it is impossible to turn off the c- even when the admin setting

 

Add cPath to product URLs?

 

is set to false.

 

Believe it connected to this code in seo_classes.php, but hey what do i know.

 

Anyone have any thoughts?

 

Thanks

 

Geoffrey

 

/**
* Function to get the category name. Use evaluated cache, per page cache, or database query in that order of precedent 
* @author Bobby Easland 
* @version 1.1
* @param integer $cID NOTE: passed by reference
* @return string Stripped anchor text
*/		
	function get_category_name(&$cID){
			$full_cPath = $this->get_full_cPath($cID, $single_cID); // full cPath needed for uniformity
			switch(true){
					case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && defined('CATEGORY_NAME_' . $full_cPath)):
							$this->performance['CACHE_QUERY_SAVINGS']++;
							$return = constant('CATEGORY_NAME_' . $full_cPath);
							$this->cache['CATEGORIES'][$full_cPath] = $return;
							break;
					case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && isset($this->cache['CATEGORIES'][$full_cPath])):
							$this->performance['CACHE_QUERY_SAVINGS']++;
							$return = $this->cache['CATEGORIES'][$full_cPath];
							break;
					default:
							$this->performance['NUMBER_QUERIES']++;
							switch(true){
									case ($this->attributes['SEO_ADD_CAT_PARENT'] == 'true'):
											$sql = "SELECT c.categories_id, c.parent_id, cd.categories_name AS cName, cd2.categories_name AS pName
											FROM (".TABLE_CATEGORIES." c
											INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd ON cd.categories_id = '".(int)$single_cID."'
											AND cd.language_id='".(int)$this->languages_id."'
											) LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd2 ON c.parent_id = cd2.categories_id
											AND cd2.language_id = '".(int)$this->languages_id."'
											WHERE c.categories_id = '".(int)$single_cID."'
											LIMIT 1";
											$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );
											$cName = $this->not_null($result['pName']) ? $result['pName'] . ' ' . $result['cName'] : $result['cName'];
											break;
									default:
											$sql = "SELECT categories_name as cName 
															FROM ".TABLE_CATEGORIES_DESCRIPTION." 
															WHERE categories_id='".(int)$single_cID."' 
															AND language_id='".(int)$this->languages_id."' 
															LIMIT 1";
											$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );
											$cName = $result['cName'];
											break;
							}																				
							$cName = $this->strip($cName);
							$this->cache['CATEGORIES'][$full_cPath] = $cName;
							$this->performance['QUERIES']['CATEGORIES'][] = $sql;
							$return = $cName;
							break;																
			} # end switch				
			$cID = $full_cPath;
			return $return;
	} # end function


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites
Version installed

 

2.1d ORIGINAL updated Jack_mcs 23 Nov 2008 on linux/php4/mysql5

 

Corrected the left joins so it will run on mysql5 as previously but on this site it is impossible to turn off the c- even when the admin setting

 

Add cPath to product URLs?

 

is set to false.

 

Believe it connected to this code in seo_classes.php, but hey what do i know.

 

Anyone have any thoughts?

 

Thanks

 

Geoffrey

 

/**
* Function to get the category name. Use evaluated cache, per page cache, or database query in that order of precedent 
* @author Bobby Easland 
* @version 1.1
* @param integer $cID NOTE: passed by reference
* @return string Stripped anchor text
*/		
	function get_category_name(&$cID){
			$full_cPath = $this->get_full_cPath($cID, $single_cID); // full cPath needed for uniformity
			switch(true){
					case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && defined('CATEGORY_NAME_' . $full_cPath)):
							$this->performance['CACHE_QUERY_SAVINGS']++;
							$return = constant('CATEGORY_NAME_' . $full_cPath);
							$this->cache['CATEGORIES'][$full_cPath] = $return;
							break;
					case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && isset($this->cache['CATEGORIES'][$full_cPath])):
							$this->performance['CACHE_QUERY_SAVINGS']++;
							$return = $this->cache['CATEGORIES'][$full_cPath];
							break;
					default:
							$this->performance['NUMBER_QUERIES']++;
							switch(true){
									case ($this->attributes['SEO_ADD_CAT_PARENT'] == 'true'):
											$sql = "SELECT c.categories_id, c.parent_id, cd.categories_name AS cName, cd2.categories_name AS pName
											FROM (".TABLE_CATEGORIES." c
											INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd ON cd.categories_id = '".(int)$single_cID."'
											AND cd.language_id='".(int)$this->languages_id."'
											) LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd2 ON c.parent_id = cd2.categories_id
											AND cd2.language_id = '".(int)$this->languages_id."'
											WHERE c.categories_id = '".(int)$single_cID."'
											LIMIT 1";
											$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );
											$cName = $this->not_null($result['pName']) ? $result['pName'] . ' ' . $result['cName'] : $result['cName'];
											break;
									default:
											$sql = "SELECT categories_name as cName 
															FROM ".TABLE_CATEGORIES_DESCRIPTION." 
															WHERE categories_id='".(int)$single_cID."' 
															AND language_id='".(int)$this->languages_id."' 
															LIMIT 1";
											$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );
											$cName = $result['cName'];
											break;
							}																				
							$cName = $this->strip($cName);
							$this->cache['CATEGORIES'][$full_cPath] = $cName;
							$this->performance['QUERIES']['CATEGORIES'][] = $sql;
							$return = $cName;
							break;																
			} # end switch				
			$cID = $full_cPath;
			return $return;
	} # end function

 

Found this http://forums.oscommerce.com/index.php?s=&...t&p=1365679 where it says

 

"If you are meaning the -c-21 that HAS to be there. "

 

But jailaxmi says

 

 

"This is the second site I install this contribution on, and never had this happen with the first one."

 

So the question is can you get rid of the c-path?

 

Cheers

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

I have a problem, I am getting this error.

 

Warning: main(includes/classes/preventDuplicates.php) [function.main]: failed to open stream: No such file or directory in /nfs/www/WWW_pages/cimmerin/treasurepleasuresextoys.com/includes/application_top.php on line 519

 

Fatal error: main() [function.require]: Failed opening required 'includes/classes/preventDuplicates.php' (include_path='.:/opt/php/lib/php/') in /nfs/www/WWW_pages/cimmerin/treasurepleasuresextoys.com/includes/application_top.php on line 519

 

I looked at my includes/application_top.php and the correct code

 

require_once(DIR_WS_CLASSES . 'preventDuplicates.php');

$preventDuplicates = new preventDuplicates();i

 

 

is at the bottom of the page. This is where this is said to be placed. What is happening?

 

Thanks in advance!!!


Mike Alwood

Share this post


Link to post
Share on other sites

Because this file is not mentioned in the installation instructions but is included in the contribution file I guess you didn't put it in /includes/classes.

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

I found the problem. Thanks!

 

One thing though that is very important. After this contrib some of my products are appearing at the bottom, after the left column.

 

This doesn't work for me. Everything else is working except for that. ?? Any ideas anyone?


Mike Alwood

Share this post


Link to post
Share on other sites

After this contrib some of my products are appearing at the bottom, after the left column.

 

This doesn't work for me. Everything else is working except for that. ?? Any ideas anyone?


Mike Alwood

Share this post


Link to post
Share on other sites

IT seems like everything is working, the only thing that isn't working is the "REVIEWS" page. When I click on the page I get this:

 

Not Found

 

The requested URL /fitted-atlanta-braves-camo-blackwhitegrey-pr-356.html" was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.swaggashop.com Port 80

 

 

I noticed when I hover over the Review link it has this " at the end of the link which I think is causing the problem. Although when I take the " off in the address bar it works perfectly. Any way of editing some code so it doesn't have the " at the end of the link?

 

You can check out what I'm saying by going here -->> http://www.swaggashop.com/fitted-york-yank...-pr-348.html%22 Thanks

Share this post


Link to post
Share on other sites

Stuck on just 1 issue:

 

Navigating to a Category the first time, the URL is correctly generated as http://www.****************/candlelight-c-46.html

 

After navigating below it, then returning, it get generated, incorrectly, as http://www.****************/candlelight-c-46_44_46.html

 

Spent ages on this.

 

Any ideas, anyone?

Share this post


Link to post
Share on other sites

OK... I have the SEO URLs working in local mode... I have only one last question to see if anyone can help me...

 

The Category name is: Iluminação auto

 

I must have something similar to: http://127.0.0.1/loja-pt/iluminacao-auto-c-12.html

 

But i have with strange characters: http://127.0.0.1/loja-pt/iluminação-auto-c-12.html

 

It´s displaying properly on the web page but when i click i have that strange sintax, i know the problem it caused because special characters...

 

Any one can help on this last issue to get this working properly????

 

 

I appretiate any help

 

 

Best Regards

João Carrolo

KarTunes

Share this post


Link to post
Share on other sites

Dear All,

 

I just installed Ultimate SEO URL's 2.6 on a osCommerce 2.2-MS2 webshop.

I followed all the steps which are in the manual...but somehow when I login in the admin section of the webshop I don't have the option to setup the configuration for the SEO URLs

 

I couldn't find at which step they added the option to the admin section...

Can somebody help me out? I'm running a dutch version...Maybe it's somewhere in the language files?

I've got no Idea...

 

Suggestions are more then welcome!

Thnx

Share this post


Link to post
Share on other sites
Well after some coding I've came up with the following code to the manufacturer to product url that will add the category name to the url. So far this is what I have:

 

the SQL:

$sql = "SELECT p.products_id as id, pd.products_name as name, c.categories_id as id, cd.categories_name as cname FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd, ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd, ".TABLE_PRODUCTS_TO_CATEGORIES." ptc WHERE p.products_id=ptc.products_id and c.categories_id=ptc.categories_id and c.categories_id = cd.categories_id and p.products_status='1'";

 

and the below portion:

 

while ($product = $this->DB->FetchArray($product_query)) {

$define = 'define(\'PRODUCT_NAME_' . $product['id'] . '\', \'' .

 

$this->strip($product['cname']) . '/' . $this->strip($product['name']) . '\');';

$prod_cache .= $define . "\n";

eval("$define");

 

The only problem with the code above is it pulls the category as the product id. So in otherwords.. if product 3 is in category 1 it will still display category 3 for product 3. Im not an SQL programmer but I know thats where we need to look at. Maybe do something with the PRODUCTS_TO_CATEGORIES table.

 

If anyone can fix my code above to display the proper category I will release alot of my mods to oscommerce including a completely converted version from tables to a div/css version. Thanks!

 

You guys manage to code massive code segments and fix issues. I think someone here can fix the simple sql statement above.

Share this post


Link to post
Share on other sites
Dear All,

 

I just installed Ultimate SEO URL's 2.6 on a osCommerce 2.2-MS2 webshop.

I followed all the steps which are in the manual...but somehow when I login in the admin section of the webshop I don't have the option to setup the configuration for the SEO URLs

 

I couldn't find at which step they added the option to the admin section...

Can somebody help me out? I'm running a dutch version...Maybe it's somewhere in the language files?

I've got no Idea...

 

Suggestions are more then welcome!

Thnx

 

It should be at the bottom of the Configuration section of the shop admin area.

 

Have you put all the files in the right directories?

Edited by geoffreywalton

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites
It should be at the bottom of the Configuration section of the shop admin area.

 

Normally...yes...but not in this case

This is what I have in the Configuration section:

 

My Store

Minimum Values

Maximum Values

Images

Customer Details

Shipping/Packaging

Product Listing

Stock

Logging

Cache

E-Mail Options

Download

GZip Compression

Sessions

Ideal

 

Any other ideas?

Thnx!

Share this post


Link to post
Share on other sites
which fucking version of this thing I am supposed to install???

there are so many damn versions, can't someone explain which is the one to install??

 

RTFM I would say....

 

How about the latest version?

Share this post


Link to post
Share on other sites
It should be at the bottom of the Configuration section of the shop admin area.

 

Have you put all the files in the right directories?

 

Yes I'm sure I did...

I even removed all the files and SQL stuff and started all over again...still no effect!

If it doesn't work somehow...I've to find another SEO contribution.

 

Thnx anyway...

Share this post


Link to post
Share on other sites
Yes I'm sure I did...

I even removed all the files and SQL stuff and started all over again...still no effect!

If it doesn't work somehow...I've to find another SEO contribution.

 

Thnx anyway...

 

I solved the problems by installing an earlier version. Version 2.1d is installed now...without any problems.

The only thing I still have question about is the url.

 

For instance when I click a product the url is like http://domain/catalog/diesel-polo-p-237.html

The category where the product is in is not generated in the url.

 

When I go to a category....let's say: Kids clothing > Boys > *Brand*

the url becomes like this: http://domain/catalog/-c-21_25.html

 

What I would like to see is something like: http://shop.joujou-kinderkleding.nl/catalo...s-brand123.html

Is that possible?

Thanx in advance!

Share this post


Link to post
Share on other sites

I just installed this and it works GREAT in firefox but in IE I still get the long URLs:

http://anxieties.com/store/cd-4-the-guide-p-38.html?osCsid=fa13efc3143debdf0549fe28a5497a90

 

I just want to see this type of URL:

http://anxieties.com/store/cd-4-the-guide-p-38.html

 

How can I fix that for IE?

Edited by ~Kira

☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×