Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ULTIMATE Seo Urls 5 - by FWR Media


Recommended Posts

Wow that is huge I'm not surprised you are getting slow downs, yes you may want to run with the cache off. I am doing some work at the moment re: caching for larger shops if you fancy emailing me the tables for ..

 

categories

categories_description

products

products_attributes

products_description

products_to_categories

 

It would be a great help in me organising a better solution for larger shops.

 

Have you tried memcached btw?

 

Here is a good start for using memcache on a windows server:

http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/

Link to comment
Share on other sites

I just renamed the cache folder... I presume that's OK, am I?

Andybird

Nop, I get this error, of course...

Warning: file_put_contents(xxxxxincludes/modules/ultimate_seo_urls5\cache\1_usucache.cache) [function.file-put-contents]: failed to open stream: No such file or directory in xxxx\includes\modules\ultimate_seo_urls5\classes\Usu_Cache_FileSystem.php on line 35

Link to comment
Share on other sites

Nop, I get this error, of course...

Warning: file_put_contents(xxxxxincludes/modules/ultimate_seo_urls5\cache\1_usucache.cache) [function.file-put-contents]: failed to open stream: No such file or directory in xxxx\includes\modules\ultimate_seo_urls5\classes\Usu_Cache_FileSystem.php on line 35

I set SEO_URLS_CACHE_RESET to true in the database but the cache is still generated...

Andybird

Edited by Andybird
Link to comment
Share on other sites

Well why don't you try it (when changing stuff turn the cache off then reset it after).

 

includes/modules/ultimate_seo_urls5/abstracts/aDataMap.php

 

Find ..

 

"@[!#\$%&'\"()\*\+,\-\./:;<=>\?\@\[\]\^_`\{|\}~]+@";

 

change to ..

 

"@[!#\$%&'\"()\*\+,\./:;<=>\?\@\[\]\^_`\{|\}~]+@";

 

Added \’… to the string, which gives this:

"@[!#\$%&'\"()\*\+,\./:;<=>\?\@\[\]\^_`\{|\}~]+@"\’…;

Link to comment
Share on other sites

Added \’… to the string, which gives this:

"@[!#\$%&'\"()\*\+,\./:;<=>\?\@\[\]\^_`\{|\}~]+@"\’…;

 

that pattern is now incorrect.

Link to comment
Share on other sites

Hi Robert,

 

I apologize in advance if this turns out to be a really dumb questions. I just realized that the headertags tables from the older version are still there but when I look in your installer file, I don't see anything regarding those. Can I delete them or should I keep them?

 

headertags

headertags_default

headertags_silo

 

Thanks

Link to comment
Share on other sites

Hi Robert,

 

I apologize in advance if this turns out to be a really dumb questions. I just realized that the headertags tables from the older version are still there but when I look in your installer file, I don't see anything regarding those. Can I delete them or should I keep them?

 

 

 

Thanks

 

Those are nothing to do with seo urls either old or new .. they are related to the header tags or header tags seo contribution .. are you using it?

 

As an aside .. if you are looking for a really exciting new meta tags contribution then see KissMT soon to be released .. you are welcome to try it if you post in the thread.

 

Let me know about the "headertags tables" I wouldn't like to advise you to delete anything until I knew what you have installed.

Link to comment
Share on other sites

Those are nothing to do with seo urls either old or new .. they are related to the header tags or header tags seo contribution .. are you using it?

 

As an aside .. if you are looking for a really exciting new meta tags contribution then see KissMT soon to be released .. you are welcome to try it if you post in the thread.

 

Let me know about the "headertags tables" I wouldn't like to advise you to delete anything until I knew what you have installed.

 

 

Having a major DUH moment here. You have my complete apologies. I got all confused with the reply notifications I got, I think. 3 different topics with SEO in the subject line and ooopps... my brain skipped a step. Yes you are right, it's the Heather Tags SEO contribution.

 

Thanks again

Link to comment
Share on other sites

Hello,

 

Many thanks for this wonderful module. It's very usefull.

 

I am trying to do a custom module so that the information pages module that comes with Creload will work with SEO URLs.

 

Here is a copy of the code I am using. This code is based on the Usu_Article_Info.php and the template provide in the SEO URLs module package.

 

<?php

class Usu_Pages extends aDataMap {

 const MARKER = '-page-';  // Could for example be -c- or -l- etc.
 const DEPENDENCY = 'pID'; // _GET key like e.g. cPath or lPath etc.
 const FILENAME = 'pages.php'; // The filename define of the file where this code will be actioned, this MUST NOT be a define
 public $dependency = self::DEPENDENCY;
 public $dependency_tags = array( self::MARKER => self::FILENAME ); // key value pair of tag (like e.g. -c-) => filename ( e.g. FILENAME_DEFAULT )
 private $page_relations = array( self::FILENAME => 1 ); // Page relation for this module ( e.g. FILENAME_DEFAULT or FILENAME_LINKS )
 private $markers = array( self::MARKER => self::DEPENDENCY ); // Markers as key value pair like -c- => cPath or perhaps -l- => lPath
 private $base_query; // Template query with placeholders ( :placeholder ) waiting for real values
 private $query; // The final query which will be $base_query but with the placeholders replaced with real values
 private $pages_title; // property populated in the acquire() method, there may be multiples of these, rename in line with the query results
 private $dependency_value; // Dependency value, so if the dependency was cPath and cPath = 27 then this value would be 27
 private $installed = false; // Unless it is a core module $installed should only be true if the contribution is installed ( e.g. articles or links manager etc )

 public function __construct(){
   $this->base_query = "SELECT pages_title FROM pages_description WHERE pages_id=':pID'  AND language_id=':languages_id'  LIMIT 1";
   usu::$registry->merge( 'seo_pages', $this->page_relations );
   usu::$registry->merge( 'markers', $this->markers );
   usu::$registry->addPageDependency( array( self::FILENAME => self::DEPENDENCY ));
   $this->installed = true; // pages Hardcoded to true in this instance - see above comment.
 }

 protected function acquire( $base_path, $full_path ) {
   $this->dependency_value = $full_path; // Full path perhaps with underscores
   $placeholders = array( ':pID', ':languages_id' );
   $values = array( (int)$base_path, (int)usu::$languages_id  ); // pages These values will replace the placeholders above in $this->base_query
   $this->query = str_replace( $placeholders, $values, $this->base_query ); // Replace the placeholders with actual values
   $result = usu::query( $this->query ); // Action the query
   $this->query = null; // Unset the query for future usage
   $row = tep_db_fetch_array( $result ); // Return the array of data ( or false if there are no results )
   tep_db_free_result( $result ); // Housekeeping
   if ( false === $row ) {
     return false; // No results for the query so abort
   }
   $this->pages_title = $this->linkText( $row['pages_title'] );

   if ( false === isset( usu::$registry->{self::DEPENDENCY} ) ) {
     usu::$registry->{self::DEPENDENCY} = array();
   }
   usu::$registry->attach( self::DEPENDENCY, $this->dependency_value, $this->getProperties() );
 } // End method

  protected function getProperties() {
    $properties = get_object_vars( $this ); // $properties becomes an array of all properties within this class
    unset( $properties['page_relations'] ); // Get rid of this key as it is not needed in the registry
    return $properties;  
  } // End method

  private function get_full_path( $path ) {
    return $path;
  } // End method

  private function get_parents() {
  } // End method

  public function buildLink( $page, $valuepair, &$url, &$added_qs, $parameters ) {
    if ( ( $valuepair[0] != self::DEPENDENCY ) || ( false === array_key_exists( 1, $valuepair ) )
                                               || ( false === $this->installed )
                                               || !tep_not_null( $valuepair[1] ) ) {
      return false; // Either this module is not installed or the value pair does not meet our requirements so abort
    }
    $base_path = $valuepair[1]; // well it might be a single top level item
    if ( false !== strpos( $valuepair[1], '_' ) ) { // It is a path with parents? ( has underscores )
      $base_path = ltrim( strrchr( $valuepair[1], '_' ), '_' ); // Grab the base path which is the number at the end of a path with parents ( e.g. 2_23_37_52 = 52 ) 
    }
    // Sanity check - if the $base_path is not numeric then we dump it
    if ( false === is_numeric( $base_path ) ) {
      trigger_error( __CLASS__ . ' Incorrect ' . self::DEPENDENCY . ' presented: ' . $valuepair[1], E_USER_WARNING );
      return false;
    }
    // Get a full path with underscores from the database
    $full_path = $this->get_full_path( $base_path );
    // If this item is not already in the registry we use the acquire() method to query for the data
    if ( !isset( usu::$registry->vars[self::DEPENDENCY][$full_path] ) ) {
      if ( false === $this->acquire( $base_path, $full_path ) ) {
        return false; // Looks like an invalid request so dump it
      }
    } else {
      usu::$performance['queries_saved']++; // Already in the registry so we saved one query
    }
    $reg_item = array();
    $reg_item = usu::$registry->vars[$valuepair[0]][$full_path];

    $link_text = $reg_item['pages_title']; // the property added in the acquire function this would have been set in the acquire method like $this->pages_name


    switch( true ){
      case $page == self::FILENAME:
        $url = $this->linkCreate( self::FILENAME, $link_text, self::MARKER, $full_path );
        break;
      default:
        $added_qs[filter_var( $valuepair[0], FILTER_SANITIZE_STRING )] = usu::cleanse( $valuepair[1] );
        break;
    } # end switch
  }
}  
?>

 

Information pages are normally accessed through these kind of URLs http://www.mysite.com/pages.php?pID=1 but whenever I access a page I get a "Page not found" message and there are no query in the debugging information. Can anyone give me a clue about what's wrong here?

 

Thanks

Vincent

Link to comment
Share on other sites

Hello,

 

Many thanks for this wonderful module. It's very usefull.

 

I am trying to do a custom module so that the information pages module that comes with Creload will work with SEO URLs.

 

Here is a copy of the code I am using. This code is based on the Usu_Article_Info.php and the template provide in the SEO URLs module package.

 

<?php

class Usu_Pages extends aDataMap {

 const MARKER = '-page-';  // Could for example be -c- or -l- etc.
 const DEPENDENCY = 'pID'; // _GET key like e.g. cPath or lPath etc.
 const FILENAME = 'pages.php'; // The filename define of the file where this code will be actioned, this MUST NOT be a define
 public $dependency = self::DEPENDENCY;
 public $dependency_tags = array( self::MARKER => self::FILENAME ); // key value pair of tag (like e.g. -c-) => filename ( e.g. FILENAME_DEFAULT )
 private $page_relations = array( self::FILENAME => 1 ); // Page relation for this module ( e.g. FILENAME_DEFAULT or FILENAME_LINKS )
 private $markers = array( self::MARKER => self::DEPENDENCY ); // Markers as key value pair like -c- => cPath or perhaps -l- => lPath
 private $base_query; // Template query with placeholders ( :placeholder ) waiting for real values
 private $query; // The final query which will be $base_query but with the placeholders replaced with real values
 private $pages_title; // property populated in the acquire() method, there may be multiples of these, rename in line with the query results
 private $dependency_value; // Dependency value, so if the dependency was cPath and cPath = 27 then this value would be 27
 private $installed = false; // Unless it is a core module $installed should only be true if the contribution is installed ( e.g. articles or links manager etc )

 public function __construct(){
   $this->base_query = "SELECT pages_title FROM pages_description WHERE pages_id=':pID'  AND language_id=':languages_id'  LIMIT 1";
   usu::$registry->merge( 'seo_pages', $this->page_relations );
   usu::$registry->merge( 'markers', $this->markers );
   usu::$registry->addPageDependency( array( self::FILENAME => self::DEPENDENCY ));
   $this->installed = true; // pages Hardcoded to true in this instance - see above comment.
 }

 protected function acquire( $base_path, $full_path ) {
   $this->dependency_value = $full_path; // Full path perhaps with underscores
   $placeholders = array( ':pID', ':languages_id' );
   $values = array( (int)$base_path, (int)usu::$languages_id  ); // pages These values will replace the placeholders above in $this->base_query
   $this->query = str_replace( $placeholders, $values, $this->base_query ); // Replace the placeholders with actual values
   $result = usu::query( $this->query ); // Action the query
   $this->query = null; // Unset the query for future usage
   $row = tep_db_fetch_array( $result ); // Return the array of data ( or false if there are no results )
   tep_db_free_result( $result ); // Housekeeping
   if ( false === $row ) {
     return false; // No results for the query so abort
   }
   $this->pages_title = $this->linkText( $row['pages_title'] );

   if ( false === isset( usu::$registry->{self::DEPENDENCY} ) ) {
     usu::$registry->{self::DEPENDENCY} = array();
   }
   usu::$registry->attach( self::DEPENDENCY, $this->dependency_value, $this->getProperties() );
 } // End method

  protected function getProperties() {
    $properties = get_object_vars( $this ); // $properties becomes an array of all properties within this class
    unset( $properties['page_relations'] ); // Get rid of this key as it is not needed in the registry
    return $properties;  
  } // End method

  private function get_full_path( $path ) {
    return $path;
  } // End method

  private function get_parents() {
  } // End method

  public function buildLink( $page, $valuepair, &$url, &$added_qs, $parameters ) {
    if ( ( $valuepair[0] != self::DEPENDENCY ) || ( false === array_key_exists( 1, $valuepair ) )
                                               || ( false === $this->installed )
                                               || !tep_not_null( $valuepair[1] ) ) {
      return false; // Either this module is not installed or the value pair does not meet our requirements so abort
    }
    $base_path = $valuepair[1]; // well it might be a single top level item
    if ( false !== strpos( $valuepair[1], '_' ) ) { // It is a path with parents? ( has underscores )
      $base_path = ltrim( strrchr( $valuepair[1], '_' ), '_' ); // Grab the base path which is the number at the end of a path with parents ( e.g. 2_23_37_52 = 52 ) 
    }
    // Sanity check - if the $base_path is not numeric then we dump it
    if ( false === is_numeric( $base_path ) ) {
      trigger_error( __CLASS__ . ' Incorrect ' . self::DEPENDENCY . ' presented: ' . $valuepair[1], E_USER_WARNING );
      return false;
    }
    // Get a full path with underscores from the database
    $full_path = $this->get_full_path( $base_path );
    // If this item is not already in the registry we use the acquire() method to query for the data
    if ( !isset( usu::$registry->vars[self::DEPENDENCY][$full_path] ) ) {
      if ( false === $this->acquire( $base_path, $full_path ) ) {
        return false; // Looks like an invalid request so dump it
      }
    } else {
      usu::$performance['queries_saved']++; // Already in the registry so we saved one query
    }
    $reg_item = array();
    $reg_item = usu::$registry->vars[$valuepair[0]][$full_path];

    $link_text = $reg_item['pages_title']; // the property added in the acquire function this would have been set in the acquire method like $this->pages_name


    switch( true ){
      case $page == self::FILENAME:
        $url = $this->linkCreate( self::FILENAME, $link_text, self::MARKER, $full_path );
        break;
      default:
        $added_qs[filter_var( $valuepair[0], FILTER_SANITIZE_STRING )] = usu::cleanse( $valuepair[1] );
        break;
    } # end switch
  }
}  
?>

 

Information pages are normally accessed through these kind of URLs http://www.mysite.com/pages.php?pID=1 but whenever I access a page I get a "Page not found" message and there are no query in the debugging information. Can anyone give me a clue about what's wrong here?

 

Thanks

Vincent

 

No immediate problem springs to mind, in fact it looks like you did a good job there :thumbsup:

 

First thing ..

 

Don't use the marker -pages- pages is a real word and could get you into trouble .. use -pg- instead.

 

Second thing have you made the addition to .htaccess? if the seo marker was -pg- .htaccess would need ..

 # CRE Pages contribution
 RewriteRule ^(.*)-pg-([0-9]+).html$ pages.php?pID=$2&%{QUERY_STRING}

 

Finally the code in the constructor should be surrounded by an if statement like in Usu_Articles perhaps using TABLE_PAGES_DESCRIPTION otherwise users would get an error if the module is not installed.

Edited by FWR Media
Link to comment
Share on other sites

Hey Robert,

 

Thanks for the quick answer on this. I have applied your suggestions to my custom module and the .htaccess file. I've even restarted apache but I still get a "Page not found" message (given by notfound_404.php) when I access http://www.mysite.com/pages.php?pID=1.

I've turned the debugging reporting ON and I notice there are no query in the debugging info. Could that be a lead into the cause of this issue? Any light you get provide on this will be greatly appreciated.

 

Vince

Link to comment
Share on other sites

Hey Robert,

 

Thanks for the quick answer on this. I have applied your suggestions to my custom module and the .htaccess file. I've even restarted apache but I still get a "Page not found" message (given by notfound_404.php) when I access http://www.mysite.com/pages.php?pID=1.

I've turned the debugging reporting ON and I notice there are no query in the debugging info. Could that be a lead into the cause of this issue? Any light you get provide on this will be greatly appreciated.

 

Vince

 

Vince pID is used by Usu_PopUpImage.php so it is actually erroring out but your error reporting settings are hiding it.

Link to comment
Share on other sites

Hi, I recently upgraded from version 2 to this new version 5 and have a few questions. I have an odd problem that started after I installed version 5. The ajax attribute manager stopped working after we installed version 5. We have another site that we have not upgraded and it works fine. What could cause this to happen?

 

Thank You.

Link to comment
Share on other sites

Hi, I recently upgraded from version 2 to this new version 5 and have a few questions. I have an odd problem that started after I installed version 5. The ajax attribute manager stopped working after we installed version 5. We have another site that we have not upgraded and it works fine. What could cause this to happen?

 

Thank You.

 

Are you using the standard uris or the rewrite uris?

Link to comment
Share on other sites

The admin end of osCommerce is not affected by USU 5 at all, so it can have no affect on ajax attributes.

Edited by FWR Media
Link to comment
Share on other sites

Dear Robert,

 

I hope i am not repeating a question, but at least i spend an hour trying to find it in the forum .. and i didn't find an exact match to what i am having trouble with.

 

1st Your instructions where very clear and so i installed everything .. it when looking on the homepage everything looked OK. However when i click any link i always get redirected back to the homepage. What could be causing this? What did i miss?

 

Here is some more info on my setup: (the OScommerce is a fresh install with no other contributions yet)

Using Linux, PHP 5.2.11

Having the .htaccess modified as per your instructions

 

You can view the site here: www.giftsofeurope.com (since it is not live to public simple login is required: user coming password: soon)

 

Here are my settings in the admin interface:

Enable SEO URLs 5? true

Add cPath to product URLs? true

Add category parent to beginning of URLs? true

Filter Short Words 1

Output W3C valid URLs? true

Choose URL Rewrite Type rewrite

Enter special character conversions. (Better to use the file based character conversions.See extras/character_conversion_pack/instructions.txt)

Remove all non-alphanumeric characters? true

Set the number of days to store the cache. 7

Reset SEO URLs Cache

Turn debug reporting on true/false. false

Select caching system. FileSystem

 

Thanks in advance for your reply and help!!

 

Dave

Link to comment
Share on other sites

Dear Robert,

 

I hope i am not repeating a question, but at least i spend an hour trying to find it in the forum .. and i didn't find an exact match to what i am having trouble with.

 

1st Your instructions where very clear and so i installed everything .. it when looking on the homepage everything looked OK. However when i click any link i always get redirected back to the homepage. What could be causing this? What did i miss?

 

Here is some more info on my setup: (the OScommerce is a fresh install with no other contributions yet)

Using Linux, PHP 5.2.11

Having the .htaccess modified as per your instructions

 

You can view the site here: www.giftsofeurope.com (since it is not live to public simple login is required: user coming password: soon)

 

Here are my settings in the admin interface:

Enable SEO URLs 5? true

Add cPath to product URLs? true

Add category parent to beginning of URLs? true

Filter Short Words 1

Output W3C valid URLs? true

Choose URL Rewrite Type rewrite

Enter special character conversions. (Better to use the file based character conversions.See extras/character_conversion_pack/instructions.txt)

Remove all non-alphanumeric characters? true

Set the number of days to store the cache. 7

Reset SEO URLs Cache

Turn debug reporting on true/false. false

Select caching system. FileSystem

 

Thanks in advance for your reply and help!!

 

Dave

 

You have a redirect in place redirecting www.giftsofeurope.com to www.giftsofeurope.com/index.php, this is also redirecting the seo urls to index.php.

Link to comment
Share on other sites

Hi all,

 

Currently i using mysql 4.1.21, I wonder can I still use the Ultimate SEO URLS 5? thanks

 

Fabby

 

The MySQL version isn't important by PHP must be 5.2+

Link to comment
Share on other sites

You have a redirect in place redirecting www.giftsofeurope.com to www.giftsofeurope.com/index.php, this is also redirecting the seo urls to index.php.

 

I do not have a redirect in place .. i have just put off #Enable SEO URLs 5?# in the Admin and the links work fine again, so the redirect must be coming from your addon, no?

 

Another thing i noticed, i have this feature turned on: Add cPath to product URLs? But it doesnt seem to be working correctly, what part of your code do i have the check for this? Perhaps this is causing the redirects back to the homepage?

 

Kind regards,

 

Dave

Edited by djoosten
Link to comment
Share on other sites

I do not have a redirect in place .. i have just put off #Enable SEO URLs 5?# in the Admin and the links work fine again, so the redirect must be coming from your addon, no?

 

No there is no such redirect code in USU5.

 

So with USU5 off, what happens when you visit http://giftsofeurope.com does the address change to http://giftsofeurope.com/index.php?

 

Another thing i noticed, i have this feature turned on: Add cPath to product URLs? But it doesnt seem to be working correctly, what part of your code do i have the check for this? Perhaps this is causing the redirects back to the homepage?

 

You don't need to check any code, access a product via the category menu and the link will have a cPath appended.

Link to comment
Share on other sites

Hi,

 

Sorry if this has been asked before; I couldn't find the answer.

 

How do I remove the database entries made by the two installer files?

* catalog/installer.php

* catalog/installer_class.php

 

It appears that to make Header Tags SEO work properly, I have to use Ultimate SEO Urls 2.1d instead of

v5. Or can I keep whatever database modifications were made during this install?

 

Thanks for your help,

 

Nick

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...