Jump to content
FWR Media

ULTIMATE Seo Urls 5 - by FWR Media

Recommended Posts

Sorry to bump but still head scratching on this one...

 

 

 

Normally when a keyword containing a space is posted in a form the space is replaced by a plus symbol e.g blue car becomes blue+car in the url, just like for the normal site keyword search tool.

 

I am using a modified version of the keyword search tool.

 

If I send my code to index.php with the SEO urls turned on the space is removed and no plus is added e.g. bluecar

 

If I send my form to any other random page i.e. contact_us.php I get the normal blue+car

 

Can anyone suggest where I should look in the SEO urls code to stop the replacement of white space for index.php?

 

I know it's almost 3 years past (slightly late) but I just faced this same issue and while I this was the only post that I could find with no answer, I looked for the solution and found the place to correct it - hope someone else can benefit from this.

 

Basically, I added a custom discount code implementation into my product_info.php and the spaces in error_message where being removed and this "The promotion code you have entered is not valid. The code may have already been expired." was being changed to this "Thepromotioncodeyouhaveenteredisnotvalid.Thecodemayhavealreadybeenexpired.".

 

To make it short find the function: (possibly in store/includes/modules/ultimate_seo_urls5/includes/usu_general_functions.php)

 

  function usu_cleanse( $value ) {
    return preg_replace( '@[^a-z0-9_]@i', '', $value );
  }
 
change it to:
 
  function usu_cleanse( $value ) {
    // replace the spaces with + signs
    $value = preg_replace( ' ', '+', $value );
    return preg_replace( '@[^a-z0-9_]@i', '', $value );
  }
Edited by hiorti

Share this post


Link to post
Share on other sites

Any idea why I might find a cache file with the name:

 

"1_index_manufacturers_id_243Fsort3D4actgacdCAEYACoUMTA1NTU3MTUyOTgyNzM1NDUyNzEyHDAwMjJhMzdjMmVhZTBhNzI6Y29tOmVuOlVTOkwusgAFQjCNF6xHLbJF9lRbY36cOH5hX1yctcOA.cache"

 

I've seen similar strings reported when a site has been hacked, but I can't find any evidence pointing to that.  Why would this even exist?

Edited by Supertex

Share this post


Link to post
Share on other sites

Hello expert,

 

Any one came across error  - Fatal error: Call to a member function store() on a non-object in /home/XXXX/public_html/XXXX.com/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78

 

The site was working fine until yesterday. This morning we are getting error and not able to display any page.

Share this post


Link to post
Share on other sites

I have a similar error:
 

PHP Fatal error:  Call to a member function retrieveDependencies() on a non-object in /home/xxxx/public_html/includes/modules/ultimate_seo_urls5/uri_modules/standard.php on line 84
 
Here is the code it is showing the error for:
 
    public function isValidUri() {
      $dependencies = Usu_Main::i()->getVar( 'page_modules', substr( Usu_Main::i()->getVar( 'filename' ), 0, -4 ) )->retrieveDependencies();
      $validated = false;
      foreach ( $dependencies as $dep => $dummy ) {

Imatch777,
 
Here is my code for that page (line 76-86). If it helps.
 
    public function __destruct() {
      if ( defined( 'USU5_ENABLED' ) && ( USU5_ENABLED == 'true' ) ) {
        $this->getVar( 'cache' )->store( $this->getVar( 'registry' )->store() );
        if ( defined( 'USU5_OUPUT_PERFORMANCE' ) && ( USU5_OUPUT_PERFORMANCE == 'true' ) ) {
          performance();
        }
        if ( defined( 'USU5_DEBUG_OUPUT_VARS' ) && ( USU5_DEBUG_OUPUT_VARS == 'true' ) ) {
          usu5_show_vars( $this->vars );
        }
      } 
    } // end destructor

Share this post


Link to post
Share on other sites

Thanks queenzukie,

 

I have exact same code in file still issue. I feel more configuration setting causing some issues, may cache.

 

I'm waiting, what others experience?

 

P

Share this post


Link to post
Share on other sites

When things stop working overnight, may be talk with your hosting company...what cache system are you using? Try switching it to file a good chance that was a php/mysql upgrade last night...

 

 

Hello expert,

 

Any one came across error  - Fatal error: Call to a member function store() on a non-object in /home/XXXX/public_html/XXXX.com/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78

 

The site was working fine until yesterday. This morning we are getting error and not able to display any page.

Share this post


Link to post
Share on other sites

Different error, have you tried using another rewriting method? I still think you have  a setup issue...

 

 

 

I have a similar error:
 

PHP Fatal error:  Call to a member function retrieveDependencies() on a non-object in /home/xxxx/public_html/includes/modules/ultimate_seo_urls5/uri_modules/standard.php on line 84
 
Here is the code it is showing the error for:
 
    public function isValidUri() {
      $dependencies = Usu_Main::i()->getVar( 'page_modules', substr( Usu_Main::i()->getVar( 'filename' ), 0, -4 ) )->retrieveDependencies();
      $validated = false;
      foreach ( $dependencies as $dep => $dummy ) {

Imatch777,
 
Here is my code for that page (line 76-86). If it helps.
 
    public function __destruct() {
      if ( defined( 'USU5_ENABLED' ) && ( USU5_ENABLED == 'true' ) ) {
        $this->getVar( 'cache' )->store( $this->getVar( 'registry' )->store() );
        if ( defined( 'USU5_OUPUT_PERFORMANCE' ) && ( USU5_OUPUT_PERFORMANCE == 'true' ) ) {
          performance();
        }
        if ( defined( 'USU5_DEBUG_OUPUT_VARS' ) && ( USU5_DEBUG_OUPUT_VARS == 'true' ) ) {
          usu5_show_vars( $this->vars );
        }
      } 
    } // end destructor

 

Share this post


Link to post
Share on other sites

First I'd like to point out that errors should never be displayed on a live site and should be written to a log.  Second, it's very helpful to have a test server running on your local machine so you can use something like xdebug with an IDE such as Netbeans so you can output a stacktrace with clickable links.  When an error pops up on screen you can click the link and it opens the page to the line in your IDE where the error occuring.  The page that actually fails is not always where the error is occuring thus the stack trace being handy.  Netbeans and xdebug are free.

 

I found these errors occuring in my log when an incorrect link is being called. 

PHP Warning:  Invalid argument supplied for foreach() in /home/xxxxxxx/public_html/includes/modules/ultimate_seo_urls5/page_modules/index.php on line 114
PHP Fatal error:  Call to a member function store() on a non-object in /home/xxxxxxx/public_html/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78

 

There are some lines where false is being strictly compared, ie "===" and it's failing.  By changing it to a looser comarison, ie "==" it seems to solve the errors.  This is probably not the best way to solve this since strict comparison is better than loose, so you can try this at your own risk.

Changing on the lines below.

     if ( false ===

to

     if ( false ==

ultimate_seo_urls5\main\usu5.php around line 160

and

ultimate_seo_urls5\page_modules\index.php around line 110

and

ultimate_seo_urls5\page_modules\product_info.php aroundline 98

      if ( false === $text_array ) {

to

      if ( false == $text_array ) {

 

In the case of "ultimate_seo_urls5\page_modules\index.php" where it should return false it's failing the false comparison and failingf on the foreach on line 114.  This shows in the strack trace.

Edited by John W

I'm not really a dog.

Share this post


Link to post
Share on other sites

I was still getting

Call to a member function store() on a non-object in /home/xxxxxxx/public_html/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78

So, I changed line 77 to

      if ( is_object('cache') && defined( 'USU5_ENABLED' ) && ( USU5_ENABLED == 'true' ) ) {

I think this solved the error.  Otherwise it assumes if  USU5_ENABLED is true that cache is enabled. 

Edited by John W

I'm not really a dog.

Share this post


Link to post
Share on other sites

Hello @@John W,

 

Thanks a lot. Your fixes work for me perfect.

Share this post


Link to post
Share on other sites

I see another potential problem in the contribution but I haven't investigated its effect thoroughly.  The function "utf8_encode" is being used which is only supposed to be used with ISO-8859-1 and not UTF-8, which is what current versions are using as standard.  Below is a quote from the php online manual found at http://php.net/utf8_encode

 

"Please note that utf8_encode only converts a string encoded in ISO-8859-1 to UTF-8. A more appropriate name for it would be "iso88591_to_utf8". If your text is not encoded in  ISO-8859-1, you do not need this function. If your text is already in UTF-8, you do not need this function. In fact, applying this function to text that is not encoded in ISO-8859-1 will most likely simply garble that text."


I'm not really a dog.

Share this post


Link to post
Share on other sites

hello usu5 support,

 

Ultimate Seo Urls 5 by FWR

is this recommended for bootstrap.

 

could someone post what a seo url is supposed to look like so i can check it with what is coming up with mine. like this??

 

site.com/prodcut-9404-digital-cellphone-7005p-2121.html

 

thanks.

Edited by zpupster

Share this post


Link to post
Share on other sites

@@zpupster yes this will work with bootstrap, you only need to make one change from the instructions in application_top.php, it's documented here on the forum.

Edited by Hotclutch

Share this post


Link to post
Share on other sites

Hello, I'm trying to install this addon on a 2.3.4 BT, but I couldnt find the following to replace:

 

in includes/functions/general.php my function read like this:

// Redirect to another page or site
  function tep_redirect($url) {
    if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) { 
      tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
    }

    if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
      if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)) == HTTP_SERVER . DIR_WS_HTTP_CATALOG) { // NONSSL url
        $url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)); // Change it to SSL
      }
    }

    if ( strpos($url, '&') !== false ) {
      $url = str_replace('&', '&', $url);
    }

    header('Location: ' . $url);

    tep_exit();
  }

and in includes/application_top.php my function read like this:

// set php_self in the local scope
  $req = parse_url($HTTP_SERVER_VARS['SCRIPT_NAME']);
  $PHP_SELF = substr($req['path'], ($request_type == 'NONSSL') ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));

  if ($request_type == 'NONSSL') {
    define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
  } else {
    define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
  }

in includes/modules/product_listing.php my function read like this:

tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']);

Share this post


Link to post
Share on other sites

Hello @@Psytanium,

 

 

in includes/functions/general.php my function read like this:

Just replace your complete tep_redirect function, but keep this part of your original function:

    if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
      if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)) == HTTP_SERVER . DIR_WS_HTTP_CATALOG) { // NONSSL url
        $url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)); // Change it to SSL
      }
    }

This has been updated I believe in 2.3.4 and is not updated in the SEO URL5 instructions.

 

 


and in includes/application_top.php my function read like this:

// set php_self in the local scope
  $req = parse_url($HTTP_SERVER_VARS['SCRIPT_NAME']);
  $PHP_SELF = substr($req['path'], ($request_type == 'NONSSL') ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));

  if ($request_type == 'NONSSL') {
    define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
  } else {
    define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
  }

 

Its the same, has been updated in osc2.3.4, just use this for reference.

 

 

in includes/modules/product_listing.php my function read like this:

tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']);

 

Find:

    $prod_list_contents .= '       <div class="col-xs-6 text-right">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'cPath')) . 'action=buy_now&products_id=' . $listing['products_id']), NULL, NULL, 'btn-success btn-sm') . '</div>';

Replace with:

    $prod_list_contents .= '       <div class="col-xs-6 text-right">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id']), NULL, NULL, 'btn-success btn-sm') . '</div>';

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

I've suddenly started getting a few errors show up in Webmaster Tools regarding a Dec 31, 1969 date.  When I look at the XML file, the last entry of sitemapCategories, is:


  -<url>

     <loc>http://www.mysite.com/index.php?cPath=_</loc>

     <lastmod>1969-12-31</lastmod>

     <changefreq>weekly</changefreq>

     <priority>0.5</priority>

  </url>

</urlset>

All of the preceeding entries show correct, SEO-friendly links.  Any idea why it's running into this at the end of the XML construct?  Webmaster tools also shows the error coming from the sitemapIndex.xml, but I believe that's due to the reference in the index to sitemapCategories.  It looks like it gets to the end of the categories list, and finds no remaining category, so of course no date, and the above entry is the result.

Share this post


Link to post
Share on other sites

@@Supertex, the error should stem from your Google XML Sitemap SEO...start from there to troubleshoot...I use a different XML sitemap with FWR's USU5 so I don't know for sure...
also, I would post a question in that XML sitemap SEO thread for sure...

 

 

I've suddenly started getting a few errors show up in Webmaster Tools regarding a Dec 31, 1969 date.  When I look at the XML file, the last entry of sitemapCategories, is:


  -<url>

     <loc>http://www.mysite.com/index.php?cPath=_</loc>

     <lastmod>1969-12-31</lastmod>

     <changefreq>weekly</changefreq>

     <priority>0.5</priority>

  </url>

</urlset>

All of the preceeding entries show correct, SEO-friendly links.  Any idea why it's running into this at the end of the XML construct?  Webmaster tools also shows the error coming from the sitemapIndex.xml, but I believe that's due to the reference in the index to sitemapCategories.  It looks like it gets to the end of the categories list, and finds no remaining category, so of course no date, and the above entry is the result.

Share this post


Link to post
Share on other sites

Actually, I'm not using the Google XML Sitemap SEO anymore (it doesn't create friendly urls), but instead just using the one that comes with USU5 Pro.  I call the mysite.com/usu5_sitemap/index.php in a browser, daily.  Bearing that in mind, you still think this has something to do with Google XML?

Share this post


Link to post
Share on other sites

I'm using the same sitemap generator and it's not a problem I see. That looks like it could be a default date that's being inserted instead of a current date.  Are you able to check this in your database with phpmyadmin or the like?  You could also make a small change to the item or category and see if it changes.   It lists categories and products with the oldest change last.

 

Is the url it lists correct?  I'm assuming you've modified what your showing.


I'm not really a dog.

Share this post


Link to post
Share on other sites

Well, I've figured out the cause, but not what to do to fix it.

 

Here's the deal:  I have several categories that are not active...as in no products yet.  I did not want my human-readable sitemap to show them.  So, I added a "categories_status" column to the categories table and added a 'where' clause into the queries of the human-readable sitemap files - problem solved.  I only recently became aware that the XML sitemaps were causing these hidden categories to be indexed by Google, so I added the same 'where' clause to the usu5_sitemaps/index.php.  The problem appeared immediately after this.  So it appears that this alone has caused the issue, but I don't understand why, or how to fix it.  Here's the categories section of the usu5_sitemaps/index.php file:

  function categoriesFullScan(){
    $sql = "SELECT categories_id, parent_id, date_added, last_modified FROM " . TABLE_CATEGORIES . " WHERE categories_status > 0 GROUP BY categories_id ORDER BY date_added ASC, last_modified ASC";
    return tep_db_query($sql);
  }

  function buildCategoriesCache() {
    $result = categoriesFullScan();
    while ( $row = tep_db_fetch_array( $result ) ) {
      $categories[$row['categories_id']] = array( 'id'       => $row['categories_id'],
                                                  'parent'   => $row['parent_id'],
                                                  'path'     => '', 
                                                  'last_mod' => ( strtotime( $row['last_modified'] ) > strtotime( $row['date_added'] ) ) ? $row['last_modified'] : $row['date_added'] );
    }
    tep_db_free_result($result); // Housekeeping

    foreach ( $categories as $cat_id => $key ) {
      if ( $key['parent'] != '0' ) {
        ( isset( $categories[$key['parent']]['children'] ) && ( $categories[$key['parent']]['children'] !== null ) ) ? null : $categories[$key['parent']]['children'] = '';
        $categories[$key['parent']]['children'] .= $key['id'] . ',';
      } else {
        $categories[$key['id']]['path'] .= $key['id'];
      }
    }

    foreach ( $categories as $cat_id => $key ) {
      $fullcatpath = '';
      if( $key['parent'] != '0' ) {
        $fullcatpath = setCpath( $categories, $key['id'] );
        $categories[$key['id']]['path'] = $fullcatpath;
      }
    }
    return $categories;
  }

"WHERE categories_status > 0" is what I added to hide the appropriate categories from the XML sitemap.  When I remove that text, the sitemap no longer produces the errant entry.  Also, the errant entry is a ghost - it's not a category at all:

<loc>http://www.mysite.com/index.php?cPath=_</loc>

And I've checked the DB...all of my categories have a 'real' date, both for created and for modified, which is neither here nor there, as the entry isn't actually a category.  And the time stamp is 'Unix epoch' time, so yes, it's a default that's being used because it can't find an actual date for created or modified.  I could understand this if there were two different queries, and row counts didn't match, but from what I can tell here (and I'm no expert, mind you) the 'FullScan' is the only query in use.  What have I missed here? 

Edited by Supertex

Share this post


Link to post
Share on other sites

@@Supertex, good that you had resolved the issue, and you kinda lost me in how you did it. Now, I too use a "category_status" column...two comments:

 

1) I apply the status only for the menu/nav categories tree class, and I let both the regular sitemap and xml sitemap to show the "inactive" status categories. I want my "inactive" categories remain indexed and being crawled.

 

2) In the categories tree class should a parent node being inactive I would stop the "tree-walk" so it may eliminate the issue you had... 

Share this post


Link to post
Share on other sites

Dears,


rewrites aren't supported on Windows servers. These rewrites for Linux mod_rewrite module. would you please help to provide the rewrites for Windows 'URL Rewrite' asap?


 


we hosting support IIS URL Rewrite Module , Plesk for Windows 11.5.30  Microsoft IIS 7.5  now


 


Thanks & Best Regards,


Sunrise99


Share this post


Link to post
Share on other sites
@zpupster yes this will work with bootstrap, you only need to make one change from the instructions in application_top.php, it's documented here on the forum.

 

 

I'm having trouble locating this tidbit of information. Can someone please help me out?

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

×