Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ULTIMATE Seo Urls 5 - by FWR Media


Recommended Posts

protected $dependencies = array( 'cPath' => array( 'marker' => '-c-',

'query' => "SELECT cd2.categories_name AS pName, cd.categories_name AS cName FROM :TABLE_CATEGORIES c LEFT JOIN :TABLE_CATEGORIES_DESCRIPTION cd2 ON c.parent_id = cd2.categories_id AND c.parent_id = cd2.categories_id AND cd2.language_id = :languages_id, :TABLE_CATEGORIES_DESCRIPTION cd WHERE c.categories_id = cd.categories_id AND c.categories_id = :cid AND cd.language_id = :languages_id",

 

 

page_modules/index.php

 

 

There is a big problem with this query. If a client try to restore an old cart he get an mysql error

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND cd.language_id = 1' at line 1

 

SELECT cd2.categories_name AS pName, cd.categories_name AS cName FROM categories c LEFT JOIN categories_description cd2 ON c.parent_id = cd2.categories_id AND c.parent_id = cd2.categories_id AND cd2.language_id = 1, categories_description cd WHERE c.categories_id = cd.categories_id AND c.categories_id = AND cd.language_id = 1

 

 

 

I guess somewhere should by a cast conversion to int to categories id ? You can test if you can enter in a client account . Take table CUSTOMERS_BASKET pick an customers id with an old cart change his password and login and go to shopping cart.

 

Also there error came if a product from cart restore is out of stock now.

Edited by zipicip
Link to comment
Share on other sites

protected $dependencies = array( 'cPath' => array( 'marker' => '-c-',

'query' => "SELECT cd2.categories_name AS pName, cd.categories_name AS cName FROM :TABLE_CATEGORIES c LEFT JOIN :TABLE_CATEGORIES_DESCRIPTION cd2 ON c.parent_id = cd2.categories_id AND c.parent_id = cd2.categories_id AND cd2.language_id = :languages_id, :TABLE_CATEGORIES_DESCRIPTION cd WHERE c.categories_id = cd.categories_id AND c.categories_id = :cid AND cd.language_id = :languages_id",

 

 

page_modules/index.php

 

 

There is a big problem with this query. If a client try to restore an old cart he get an mysql error

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND cd.language_id = 1' at line 1

 

SELECT cd2.categories_name AS pName, cd.categories_name AS cName FROM categories c LEFT JOIN categories_description cd2 ON c.parent_id = cd2.categories_id AND c.parent_id = cd2.categories_id AND cd2.language_id = 1, categories_description cd WHERE c.categories_id = cd.categories_id AND c.categories_id = AND cd.language_id = 1

 

 

 

I guess somewhere should by a cast conversion to int to categories id ? You can test if you can enter in a client account . Take table CUSTOMERS_BASKET pick an customers id with an old cart change his password and login and go to shopping cart.

 

Also there error came if a product from cart restore is out of stock now.

You will get a MySQL query syntax error number 1064 when you incorrectly use a reserved word in your query such as "when" or "order" and that word (AS) in your code is a reserved word.

 

MySQL 4 has additional reserved words that you cannot use and the full list of them is at http://www.mysql.com/doc/en/Reserved_words.html.

Link to comment
Share on other sites

You will get a MySQL query syntax error number 1064 when you incorrectly use a reserved word in your query such as "when" or "order" and that word (AS) in your code is a reserved word.

 

MySQL 4 has additional reserved words that you cannot use and the full list of them is at http://www.mysql.com/doc/en/Reserved_words.html.

 

 

 

SELECT cd2.categories_name AS pName, cd.categories_name AS cName FROM categories c LEFT JOIN categories_description cd2 ON c.parent_id = cd2.categories_id AND c.parent_id = cd2.categories_id AND cd2.language_id = 1, categories_description cd WHERE c.categories_id = cd.categories_id AND c.categories_id = AND cd.language_id = 1

 

 

the category id is missing so something is transmitted wrong in that class when trying to restore shopping cart.

Link to comment
Share on other sites

I guess somewhere should by a cast conversion to int to categories id ? You can test if you can enter in a client account . Take table CUSTOMERS_BASKET pick an customers id with an old cart change his password and login and go to shopping cart.

 

Also there error came if a product from cart restore is out of stock now.

 

There is no problem with the query and @badbo certainly no problem with "reserved words".

 

The problem is that cPath is being passed into tep_href_link as a null value ( '' or 3_ ), this shouldn't happen.

 

cPath should always be an integer or a number of integers separated by underscore.

 

I obviously didn't forsee this happening but having looked at this there should be a change to one of the methods.

 

includes/modules/ultimate_seo_urls5/abstracts/page_modules.php

 

Find function stripPathToLastNumber() on lines 306 - 314

 

Change the complete function to ..

 

protected function stripPathToLastNumber( $path ) {
 	if ( is_numeric( $path ) ) {
   	return (int)$path;
 	} elseif ( false !== strpos( $path, '_' ) ) {
   	$split = explode( '_', $path );
   	return (int)array_pop( $split );
 	}
 	trigger_error( __CLASS__ . '::' . __FUNCTION__ . ': Incorrect path value of ' . $path . ' presented', E_USER_WARNING );
}

 

I'm afraid that this forum now breaks the indentation so the above function requires the indentation re added.

Edited by FWR Media
Link to comment
Share on other sites

Thanks man.

 

That resolves the problem.

 

I guess cast is very important. If u make an update to this contribution try to add cast to every products id, path, manufactures id, categories id. Thanks.

Edited by zipicip
Link to comment
Share on other sites

Thanks man.

 

That resolves the problem.

 

I guess cast is very important. If u make an update to this contribution try to add cast to every products id, path, manufactures id, categories id. Thanks.

 

I don't have to "remember" to type cast as I always do, in this case it should have been a "known type" but I hadn't forseen cPath being passed in internally as a null value.

Edited by FWR Media
Link to comment
Share on other sites

I don't have to "remember" to type cast as I always do, in this case it should have been a "known type" but I hadn't forseen cPath being passed in internally as a null value.

 

 

Ok. I also discovered this

 

Mon Jan 17 16:40:22 2011] [error] [client 80.239.242.78] PHP Fatal error: Call to a member function store() on a non-object in **/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78, referer: ***advanced_search_result.php****

 

I can't reproduce exactly what is causing this. Can u help pls.

 

Or how can I help debugging this.

Edited by zipicip
Link to comment
Share on other sites

Ok. I also discovered this

 

Mon Jan 17 16:40:22 2011] [error] [client 80.239.242.78] PHP Fatal error: Call to a member function store() on a non-object in **/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78, referer: ***advanced_search_result.php****

 

I can't reproduce exactly what is causing this. Can u help pls.

 

Or how can I help debugging this.

 

Odd, how many of these do you have?

 

The below is not a fix but may provide me the info I need.

 

includes/modules/ultimate_seo_urls5/main/usu5.php

 

Lines 76 - 78

 

Find ..

public function __destruct() {
 	if ( defined( 'USU5_ENABLED' ) && ( USU5_ENABLED == 'true' ) ) {
   	$this->getVar( 'cache' )->store( $this->getVar( 'registry' )->store() );

 

Change to ..

 

	public function __destruct() {
 	if ( defined( 'USU5_ENABLED' ) && ( USU5_ENABLED == 'true' ) ) {
   	$cache = $this->getVar( 'cache' );
   	$registry = $this->getVar( 'registry' );
   	$store = true;
   	if ( false === ( ( $cache instanceof iCache_System ) && ( $registry instanceof Data_Registry ) ) ) {
     	$store = false;
     	$error = 'Cache or registry cannot be retrieved: ' . PHP_EOL . PHP_EOL . print_r( $this, true );
     	trigger_error( $error, E_USER_WARNING );
   	}
   	( false !== $store ) ? $cache->store( $registry->store() ) : null;

Link to comment
Share on other sites

It really makes no difference whatsoever in my opinion.

 

Having said that a new URI module is in early beta testing ..

 

Seo urls without the -c-52 / -p-37 etc.

 

They look like ..

 

/hardware.htm

/software.htm

/dvd-movies.htm

/gadgets.htm

/simulation-sierra-swat-close-quarters-battle.htm

/simulation-sierra-swat-close-quarters-battle.htm

/action-warner-the-matrix.htm

 

 

Hey Robert,

 

Any chance I can get into the beta testing?

 

Thanks

Link to comment
Share on other sites

Hey Robert,

 

Any chance I can get into the beta testing?

 

Thanks

 

Sorry I didn't reply sooner spoofy.

 

I have put this on hold .. categories/products work perfectly but there are some other issues .. e.g. taking a fresh osCommerce install: -

 

E.g product id 19

 

www.mysite.com/theres-something-about-mary.htm has a one to one relationship with the product which is fine.

 

Trouble is ..

 

www.mysite.com/theres-something-about-mary.htm also points to the product review of this product and this is a conflict.

 

It's not a huge issue .. the product is king so the review link could be ..

 

www.mysite.com/review-theres-something-about-mary.htm

 

i just don't have the time atm.

Edited by FWR Media
Link to comment
Share on other sites

Sorry I didn't reply sooner spoofy.

 

I have put this on hold .. categories/products work perfectly but there are some other issues .. e.g. taking a fresh osCommerce install: -

 

E.g product id 19

 

www.mysite.com/theres-something-about-mary.htm has a one to one relationship with the product which is fine.

 

Trouble is ..

 

www.mysite.com/theres-something-about-mary.htm also points to the product review of this product and this is a conflict.

 

It's not a huge issue .. the product is king so the review link could be ..

 

www.mysite.com/review-theres-something-about-mary.htm

 

i just don't have the time atm.

 

I understand. I am getting ready to launch some stores and figured it's better to launch on better urls from now on instead of changing them later on. Is it possible to get a copy of what you have so far and maybe I can try to figure out how to get around working on it.

 

Just something else to put it out there. I am using your usu5 and instead of using products name, i have a seperate column called url slug and in the admin panel, it checks to ensure that there are no duplicates of same url slug.

Link to comment
Share on other sites

Just something else to put it out there. I am using your usu5 and instead of using products name, i have a seperate column called url slug and in the admin panel, it checks to ensure that there are no duplicates of same url slug.

 

Well it's not necessary .. the whole point of the marker .. -p- .. and the integer is that it has a one to one relationship with a product.

 

my-great-product-p-32.html is not the same url as my-great-product-p-31.html

Link to comment
Share on other sites

Well it's not necessary .. the whole point of the marker .. -p- .. and the integer is that it has a one to one relationship with a product.

 

my-great-product-p-32.html is not the same url as my-great-product-p-31.html

 

 

Right. I understand that the code is based on the p- (product id) rather than name or url slug in my case but for my project, I need to have unique url slug for every product. I was just giving an idea for your module which you mentioned has no p- or c-

 

Anyhow, back to my original request. Any chance I can get a copy of it and give it a shot please

 

Thanks

Link to comment
Share on other sites

Rober I have been doing lots of testing and can find nothing but this.

Date / Time: 12-01-2011 21:04:39

Error Type: [E_STRICT] Non-static method KissMT_Modules::stripStopWords() cannot be called statically, assuming $this from compatible context KissMT_Module

On line 134

File includes/modules/kiss_meta_tags/abstracts/kiss_modules.php

 

Bo

Link to comment
Share on other sites

Rober I have been doing lots of testing and can find nothing but this.

Date / Time: 12-01-2011 21:04:39

Error Type: [E_STRICT] Non-static method KissMT_Modules::stripStopWords() cannot be called statically, assuming $this from compatible context KissMT_Module

On line 134

File includes/modules/kiss_meta_tags/abstracts/kiss_modules.php

 

Bo

Sorry Robert I will stick this in the Kiss forum

Link to comment
Share on other sites

Right. I understand that the code is based on the p- (product id) rather than name or url slug in my case but for my project, I need to have unique url slug for every product. I was just giving an idea for your module which you mentioned has no p- or c-

 

Anyhow, back to my original request. Any chance I can get a copy of it and give it a shot please

 

Thanks

 

Send me a PM with your email address.

 

You can try it out if you wish but it is very raw and untested, also on the agreement that you post back your findings in the development topic please.

Link to comment
Share on other sites

Send me a PM with your email address.

 

You can try it out if you wish but it is very raw and untested, also on the agreement that you post back your findings in the development topic please.

 

 

Done. Sent you a pm with my email address. I have added watch topic for development thread and will post there

Link to comment
Share on other sites

There is no problem with the query and @badbo certainly no problem with "reserved words".

 

The problem is that cPath is being passed into tep_href_link as a null value ( '' or 3_ ), this shouldn't happen.

 

cPath should always be an integer or a number of integers separated by underscore.

 

I obviously didn't forsee this happening but having looked at this there should be a change to one of the methods.

 

includes/modules/ultimate_seo_urls5/abstracts/page_modules.php

 

Find function stripPathToLastNumber() on lines 306 - 314

 

Change the complete function to ..

 

protected function stripPathToLastNumber( $path ) {
 	if ( is_numeric( $path ) ) {
   	return (int)$path;
 	} elseif ( false !== strpos( $path, '_' ) ) {
   	$split = explode( '_', $path );
   	return (int)array_pop( $split );
 	}
 	trigger_error( __CLASS__ . '::' . __FUNCTION__ . ': Incorrect path value of ' . $path . ' presented', E_USER_WARNING );
}

 

I'm afraid that this forum now breaks the indentation so the above function requires the indentation re added.

 

 

But here you don't treat null case.

 

First you ask if is_numeric( $path) so no

After you ask if contain _ so no

And for null you only trigger an error when it should return (int)$path (which is 0 so sql will not return an error)

 

 

protected function stripPathToLastNumber( $path ) {
 	if ( is_numeric( $path ) ) {
   	return (int)$path;
 	} elseif ( false !== strpos( $path, '_' ) ) {
   	$split = explode( '_', $path );
   	return (int)array_pop( $split );
 	}else{
          return 0; //so no query error
       }
 	trigger_error( __CLASS__ . '::' . __FUNCTION__ . ': Incorrect path value of ' . $path . ' presented', E_USER_WARNING );
}

Edited by zipicip
Link to comment
Share on other sites

But here you don't treat null case.

 

First you ask if is_numeric( $path) so no

After you ask if contain _ so no

And for null you only trigger an error when it should return (int)$path (which is 0 so sql will not return an error)

 

No what I wrote is correct. Either it is an integer or it has underscores or it needs to generate an error as it is incorrect and the site has issues that need to be addressed, that's what errors are for.

Edited by FWR Media
Link to comment
Share on other sites

Hi again Robert,

 

this is my configuration:

 

Enable SEO URLs 5? true

Enable the cache? true

Enable multi language support? true

Output W3C valid URLs? true

Select your chosen cache system? file

Set the number of days to store the cache. 7

Choose the uri format rewrite

Choose how your product link text is made up p

Filter Short Words 2

Add category parent to beginning of category uris? true

Remove all non-alphanumeric characters? true

Add cPath to product URLs? false

Enter special character conversions. (Better to use the file based character conversions)

Turn performance reporting on true/false. false

Turn variable reporting on true/false. false

Force www.mysite.com/ when www.mysite.com/index.php false

Reset USU5 Cache

 

 

My problem is with the seo url languages.

English (predefined)

Deusch

Espanol

 

 

Going to the main landing page is ok. Example:

 

www. mypage .com

 

the I change the language clicking on the flag icon and it goes right to:

 

www. mypage .com/index.php/de

 

but then if I click on any category or product ( for example link to: http://www. mypage . com/de/bugs-life-p-8.html)

it gets a broken link 404. not found.

 

Other extrange thing. When modifing the .htaccess witch the rewrite rules i cannot enter again in the administration page; entering the loging and password the page says that the password is incorrect. If I delete the .htaccess archive I can enter again.

 

php 5.2.17

Edited by bhbilbao
Link to comment
Share on other sites

Other extrange thing. When modifing the .htaccess witch the rewrite rules i cannot enter again in the administration page; entering the loging and password the page says that the password is incorrect. If I delete the .htaccess archive I can enter again.

 

php 5.2.17

 

I could be wrong but it seems like you are getting a little confused with the .htaccess file.

 

Does it all work correctly if you select the standard urls?

 

The .htaccess to be changed is the catalog/.htaccess and not the catalog/admin/.htaccess

Edited by FWR Media
Link to comment
Share on other sites

Yes changing the URI format to standard the language seo works fine, for example:

http://www. myweb. com/product_info.php/en/bugs-life-p-8

 

it loads right.

 

The .htaccess is the main archive in catalog folder.

 

Im trying replacing:

 

 

# If you are getting errors you may need to comment this out like ..
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
# ErrorDocument 404 http://www. myweb .com/sitemap.php
ErrorDocument 404 /sitemap.php
 RewriteEngine On
rewritecond %{http_host} ^myweb .com [nc]
rewriterule ^(.*)$ http://www. myweb .com/$1 [r=301,nc]

 RewriteBase / 

 RewriteRule ^([a-z0-9/-]+)-p-([0-9]+).html$ product_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9/-]+)-c-([0-9_]+).html$ index.php [NC,L,QSA]
...

 

to

 

 

# If you are getting errors you may need to comment this out like ..
Options +FollowSymLinks
# Options +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
# ErrorDocument 404 http://www. myweb .com/sitemap.php
ErrorDocument 404 /sitemap.php
 RewriteEngine On
# rewritecond %{http_host} ^myweb .com [nc]
# rewriterule ^(.*)$ http://www. myweb .com/$1 [r=301,nc]

 RewriteBase / 

 RewriteRule ^([a-z0-9/-]+)-p-([0-9]+).html$ product_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9/-]+)-c-([0-9_]+).html$ index.php [NC,L,QSA]
...

Edited by bhbilbao
Link to comment
Share on other sites

Yes changing the .htaccess file it works fine.

 

Now it works fine. The other problem was the "Bug film", in german it has a "ß" character (Das Große Krabbeln) that gives error and it goes to sitemap. That can solve myself with the mods.

 

My worry is changing to:

Options +FollowSymLinks

# Options +SymLinksIfOwnerMatch

 

I readed that is not secure.

 

what do you think??

Link to comment
Share on other sites

Yes changing the .htaccess file it works fine.

 

Now it works fine. The other problem was the "Bug film", in german it has a "ß" character (Das Große Krabbeln) that gives error and it goes to sitemap. That can solve myself with the mods.

 

My worry is changing to:

Options +FollowSymLinks

# Options +SymLinksIfOwnerMatch

 

I readed that is not secure.

 

what do you think??

 

I don't understand the point.

 

USU5 PRO uses

 

Options +SymLinksIfOwnerMatch

 

not

 

Options +FollowSymLinks ( do not change to this )

 

If it only works with Options +FollowSymLinks then ask your host why as it is insecure.

Edited by FWR Media
Link to comment
Share on other sites

Possible Trouble in usu5.php

 

When checking validation via validator.w3.org - it complained of the use of '&' in links on the page. A few were found in other locations, but the "more information" link which uses redirect.php kept giving trouble.

 

I found that I had to do the following:

    public function hrefLink( $page, $parameters, $connection, $add_session_id, $search_engine_safe ) {
    // Badly coded shops often pass in odd characters
    // $parameters = str_replace( array( '&', 'amp;' ), array( '&', '', ), $parameters ); 

 

Note that the str_replace line is commented out, once I did that the & got passed as & and not '&'

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...