Jump to content
FWR Media

ULTIMATE Seo Urls 5 - by FWR Media

Recommended Posts

@@greasemonkey

 

Hi Scott

I though we continue our discussion regarding SEO URL here in the FWR topic. I don't want to clutter up your modify BS topic.

I just installed this USU by FWR on a clean 2015.3.6 BS shop running on a XAMPP php 5.5.19 server.

 

1.) There is a part in the install missing regarding the rewrite rules for htaccess

But thanks to clustersolutions github I could copy& paste it from there.

 

2.) the install seems a bit more tedious then the Chemo version but only a tiny bit.

 

3.) what is the difference anyway between those 2? Besides that this one here (FWR) is not really supported.

 

4.) Reading through this topic I saw that some had trouble regarding the cache. I can't confirm that....since I don't test in a real server environment with many products.

 

I myself gonna stick with Chemo's version since Jack_mcs supports that version and it didn't let me down so far on my current non-BS shop.

FWR's version includes a sitemap feature which i didn't test.

Anyway, which ever version you choose (FWR or Chemo) both seem to run fine on a php 5.5.19 server.

Edited by Tsimi

Share this post


Link to post
Share on other sites

I have SEO URLs working properly for standard configuration, however, when I try to enable Header Tags as SEO name I get an error on the first page load.  

 

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /home/idp2/idp2.didyoube.com/includes/classes/seo.class.php on line 152
 

Then, all my products lose the SEO friendliness, instead just using the product id, e.g. "-p-28.html"

 

I have header tags installed, so I wondered what was going on.  Admittedly, I am not very familiar with how this module functions, but, a cursory glance turned up something (which may be nothing)

 

In function generate_products_cache line 2015 is this:

                $sqlCmd = $this->attributes['USE_SEO_HEADER_TAGS'] == 'true' ? 'IF(pd.products_head_title_tag_url !="",pd.products_head_title_tag_url,pd.products_name) as name' : 'pd.products_name as name';
 
In my version of header tags, there is no products_head_title_tag_url in products_description.  Rather, there is a products_seo_title.  I changed all the products_head_tag_url references to products_seo_title and things seem to be working.
 
Have I hack-created a frankenstein here by forcing two modules that weren't supposed to go together?  Am I working with the wrong version of the header tags module?

Share this post


Link to post
Share on other sites

I have this installed and it seems to be working correctly except that the product name in the tab is wrong.

like for "brown paint can" that I'm viewing on the product page reads "blue paint can" in the tab...

how can I fix this?

Share this post


Link to post
Share on other sites

Dear FWR,

 

I am having the folling error when I run cron of usu5_sitemaps/index.php:

 

PHP Fatal error: Call to a member function retrieveDependencies() on a non-object in /....l/includes/modules/ultimate_seo_urls5/uri_modules/rewrite.php on line 84

 

 

I get the same error in connection with PayPal Express

How can I fix this?

Share this post


Link to post
Share on other sites

Has anybody experienced a 404 error when a shopfeed website linking to your product images?

 

Everything works well on my site the only problem I experience is when SEO URL5 is turned on the expectation seems to direct images to the image folder instead of the actual image location ie images/original/prod_123/****.png etc)

 

Any thoughts to rectify this.... Thanks

Share this post


Link to post
Share on other sites

SEO urls by chemo

i added this rule for product_info.php?product_id

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

using this rule when no attributes are setted the url works fine.

https://www.XXXXXXXXXXX.com/product-digital-p-168.html?osCsid=Xxxxxxxxxxx

but product contains attributes the url are not rewrited why?

my browser url shows like :

https://www.xxxxxxxx.com/product_info.php?products_id=543{1}168&osCsid=xxxxxxx"

how to sovlve this?

Share this post


Link to post
Share on other sites

 

Hello,

 

I'm hoping someone could help.  Simply trying to modify the code to use a new column I created in the products description table to build the Url's instead of using the product name.

 

New column name in products_description table

products_seo_url

 

withing the file: product_info.php

catalog\includes\modules\ultimate_seo_urls5\page_modules > product_info.php

 

I modified the query to pull this new column instead of product_name.  However, when i update the code i receive a different error below.

 

Catchable fatal error: Argument 1 passed to aPage_Modules::linkText() must be an array, null given, called in includes/modules/ultimate_seo_urls5/page_modules/product_info.php on line 170 and defined in includes/modules/ultimate_seo_urls5/abstracts/page_modules.php on line 338
 
I then navigate to the page_modules.php file and I don't see anywhere I can modify anything to make this work with the new column.
 
Any thoughts of getting this simple adjustment to work?

 

 

I found a fix for this error:

In all product page modules (product_info.php, product_reviews.php and product_reviews_info.php)

Find:

      $result = Usu_Main::i()->query( $this->query );
      $text_array = tep_db_fetch_array( $result );

Add below:

      if ($text_array == null) {
      	return false;
      }
Edited by raiwa

Share this post


Link to post
Share on other sites

@@clustersolutions I've just installed this contrib with help from your github. Now I'm facing the problem of getting an Unable to determine the page link warning on index page.

 

Have you experienced this?

Share this post


Link to post
Share on other sites

@@piernas, check your caching method. Use file caching only for now. The MySQLite will need to be updated...I was trying to find time to update the MySQL error, but I think PDO is coming out so may be I will wait until then or may be get an intermediate fix in between...

 

if that's not it...it could be something else...what version of OSC your running?

Share this post


Link to post
Share on other sites

If you use cron to setup the feed there is a bug for now but it should not be related to your image error...try using php -q googlefeeder.php to see if all is well...the bug isn't a big issue for me for now as I am fiddling around with the feed/PLA products group so I run it manually everyday anyway...

 

For your error, it is probably resided in your image addon or in the .htaccess file...usu5 doesn't do any rewrite with images...try flipping the order of the entire block of usu5 .htaccess codes in the .htaccess file and also see if the problem goes away...

 

read up on this may help...look at the last|L flag...

 

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteflags

 

 

 

Has anybody experienced a 404 error when a shopfeed website linking to your product images?

 

Everything works well on my site the only problem I experience is when SEO URL5 is turned on the expectation seems to direct images to the image folder instead of the actual image location ie images/original/prod_123/****.png etc)

 

Any thoughts to rectify this.... Thanks

Share this post


Link to post
Share on other sites

@@piernas, check your caching method. Use file caching only for now. The MySQLite will need to be updated...I was trying to find time to update the MySQL error, but I think PDO is coming out so may be I will wait until then or may be get an intermediate fix in between...

 

if that's not it...it could be something else...what version of OSC your running?

 

I'm using latest oscommerce bootstrap 2334 from github, on a new blank install (test site). I use file cache as I found sqlite was not working.

On the production site (oscommerce 2.2) it has been working for years (mysql and file system created problems back then so I've been using sqlite on this one).

For now it's running on a subdomain and SSL isn't enabled, so maybe the problem resides there but it should work without SSL I think.

 

The error shows only in the root of the site (with or without /index.php). I've tried it on a local windows server and it happens there, too... It's strange nobody else has mentioned it yet.

Share this post


Link to post
Share on other sites

yeah, that doesn't make sense. I would focus on the "subdomain?" To me subdomain is sub.abc.com and not www.abc.com/sub/...check your server's behavior...file caching doesn't work in your prod system? that's strange....

Share this post


Link to post
Share on other sites

@@clustersolutions I had, if I remember well, some problems with file cache repeating title for a product on every others, but it was years ago and I can't remember exactly what it was. I changed to MySQLite cache and the problem dissapeared.

 

Yes I installed under bootstrap.domain.com and also on localhost/bootstrap; both methods went wrong.

 

Do you have a test site setup? If yes do you have SSL enabled or disabled? I fear that can be the problem. I should need to put my production site under maintenance and swap the files and I can't do it until this weekend.

 

About MySQLite, I've read problems but I'm not sure if it is a problem with new php versions or with newest oscommerce. It seems to work ok on my production server at first (php 5.3) but I didn't try it in depth.

Share this post


Link to post
Share on other sites

@@piernas, I don't think it has anything to do with SSL. I don't use SSL on my dev site, and when my site went live with SSL. It just worked...

 

It is impossible to pinpoint the issue based on the error you had provided. I would start from the source of the error and back track to see where the issue lies.

 

w/ mysqlite...it was caused by the 2.3 db connection update...depending on how your error reporting is setup the warning may or may not appear on your screen.

 

I still think it's a setup issue...your configure.php and .htaccess both say "bootstrap.domain.com"?

Share this post


Link to post
Share on other sites

@@clustersolutions I've double checked configure.php and it's correct. It fails with HT seo enabled or disabled, with or without cache and with or without SSL. Checked the addon install and it seems  It's well done... I don't have a clue on wwhat's happening. I will start again so it might be a silly semi-colon somewhere!

 

Other strange thing is, after a few clicks on other links and then clicking home the page displays well (w00t) it's driving me mad...

 

I'll post what happens if I ever get it working fine :wacko:

Edited by piernas

Share this post


Link to post
Share on other sites

Well...reminds me of the days or nights in the VAX lab trying to find that freakin' comma...

 

@@piernas...I don't know if I follow what you are talking about regarding the error a screen shot may help...you can pm me the link to the site I would check it out...

 

you clear your browser cache? so it isn't usu5 failing then...also, HT SEO shouldn't cause error with usu5, I don't know which version of the HT SEO you are using...I used all of them I think I ended up just using Burt's reloaded version as I usually pick add-ons based on the coding style...I should check out FWR's version as I like his way of KiSS...

Share this post


Link to post
Share on other sites

Love random errors... didn't work for days and today it's working, not a comma changed.

 

@@clustersolutions I'll PM the link. Still didn't install any HT module, I meant Ultimate SEO. Please let me know if you see the error now :)

Share this post


Link to post
Share on other sites

@@piernas, looks fine to me...may be your reset the cache? I bet you the problem won't come back...I hope...

 

U may want to remove the index.php at / page...or redirect the index.php index.html to /...I thought there was a setting in USU5 for that...

Share this post


Link to post
Share on other sites

@@clustersolutions I've finally found what was causing the Unable to determine the page link. I was using the code for language selection from here http://forums.oscommerce.com/topic/336702-ultimate-seo-urls-5-by-fwr-media/?p=1573463, slightly modified to show a language icon on header and a hreflang meta tag in the code. I made two modules one for each task (one for header and the other for header tags) and I've found If you call FWR_Language_Selection class twice in the same page it will throw the error and second call will fail.

 

I'll try to isolate the problem so both modules can work together. I tried to destroy the class instance after using it on the first module but it makes no difference. I think $page will not be passed second time but I'm not sure. If someone has a clue on why it will fail please tell me :)

Share this post


Link to post
Share on other sites

This is my modified version of the class. I added one more argument ($type) to return a button set or a <meta> set:

<?php

  class FWR_Language_Selection {

    protected $page;
    protected $mode;
    protected $get;
    protected $lng;
    protected $language;
    protected $root_path;
    protected $language_image_width = '64';
    protected $language_image_height = '64';
    protected $session_started;
    protected $language_code_array = array();
    
    
    public function __construct( navigationHistory $navigation, $language, $lng = false, $session_started = false, $type ='button' ) {
      $navigation_data = array_pop( $navigation->path );
      $this->page = $navigation_data['page'];
      $this->mode = $navigation_data['mode'];
      $this->get =  $navigation_data['get'];
      $this->setLanguage( $lng );
      $this->language = $language;
      $this->root_path = realpath( dirname( __FILE__ ) . '/../../' ) . '/';
      $this->session_started = $session_started;
      $this->type = $type;
    }
    
    public function __toString() {
      if ($this->type == "button") {
	    return $this->getLanguageSelectionHtml();
	  } elseif ($this->type == "hreflink") {
	    return $this->get_hreflang();
	  }
    }
    
    protected function setLanguage( $lng ) {
      if ( ( false === $lng ) || ( !$lng instanceof language ) ) {
        include_once DIR_WS_CLASSES . 'language.php';
        $this->lng = new language();
        $this->setLanguageArray();
        return $this->lng;
      }
      $this->lng = $lng;
      $this->setLanguageArray();
    }
    
    protected function setLanguageArray() {
      foreach ( $this->lng->catalog_languages as $code => $unused ) {
        $this->language_code_array[] = $code;
      }
    }
    protected function get_hreflang() {
      foreach ( $this->lng->catalog_languages as $code => $data ) {
        if ( $data['directory'] == $this->language ) continue;
          $hlink = $this->buildLink( $current = false, $default = ( $code === DEFAULT_LANGUAGE ), $code );
	      $output = '<link rel="alternate" hreflang="' . $code . '" href="' . $hlink .'" />';
	  }
      return $output;
	}
    protected function getLanguageSelectionHtml() {
      foreach ( $this->lng->catalog_languages as $code => $data ) {
        $language_image_path = DIR_WS_INCLUDES . 'languages/' . $data['directory'] . '/images/icon_round.png';
        if ( $data['directory'] == $this->language ) continue;
    // This should be moved to the language files:
       if ($data['name'] =="English"||$data['name'] =="German") {
         $prepos =" in ";
       }else{
         $prepos =" en ";
       }

       $output .= '<div class="col-xs-1 col-fixed">';
       $output .= '<div class="text-center col-fixed"><a href="' . $this->buildLink( $current = false, $default = ( $code === DEFAULT_LANGUAGE ), $code ) . '" title="' . tep_output_string_protected( $data['name'] ) . '">' . tep_image( $language_image_path, $data['name'], $this->language_image_width, $this->language_image_height,'','false') . '</a></div>';
       $output .= '<div class="caption text-center col-fixed"><a href="' . $this->buildLink( $current = false, $default = ( $code === DEFAULT_LANGUAGE ), $code ) . '" title="' . tep_output_string_protected( $data['name'] ) . '" class="headerNavigation" >' . STORE_NAME . $prepos .  tep_output_string_protected( $data['name'] ) . '</a></div>';
       $output .= '</div>';
	}
      return $output;
    }
    
    protected function buildLink( $current = false, $default = false, $code ) {
      if ( false === $this->session_started ) {
        return  $this->multiLanguage( tep_href_link( FILENAME_DEFAULT, '', 'NONSSL' ), $current, $default, $code );
      }
      return $this->multiLanguage( tep_href_link( $this->page, $this->getQuery(), $this->mode ), $current, $default, $code );
	  
    }
    
    protected function getQuery() {
      if ( tep_not_null( $this->get ) ) {
        if ( array_key_exists( tep_session_name(), $this->get ) ) {
          unset( $this->get[tep_session_name()] );
        }
        return http_build_query( $this->get );
      }
      return '';
    }
    
    protected function removeQueryString( $target ) {
      if ( false === strpos( $target, '?' ) ) {
        return $target;
      }
      return substr( $target, 0, strpos( $target, '?' ) );
    }
    
    protected function removeLanguageMarkers( $target, $cookie_path ) {
      $return = preg_replace( '@' . $cookie_path . '(' . implode( '|', $this->language_code_array ) . ')/@', $cookie_path, $target );
      $return = preg_replace( '@' . $this->page . '/(' . implode( '|', $this->language_code_array ) . ')@', $this->page, $return );
      return $return;
    }
    
    protected function multiLanguage( $link, $current, $default, $code ) {
      $server = ( $this->mode == 'NONSSL' ) ? HTTP_SERVER : HTTPS_SERVER;
      $cookie_path = ( $this->mode == 'NONSSL' ) ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH;
      $server = $server . $cookie_path;
      $link = $this->removeLanguageMarkers( $link, $cookie_path );
      if ( false !== $default ) {
        $no_querystring = $this->removeQueryString( $link );
        // Is the page FILENAME_DEFAULT and after the querystring is removed is FILENAME_DEFAULT the ending characters of the URL, if so we chop it off leaving just the domain
        if ( ( $this->page == FILENAME_DEFAULT ) && ( substr( $no_querystring, ( strlen( $no_querystring ) - strlen( $this->page ) ), strlen( $no_querystring ) ) == $this->page ) ) {
          return str_replace( $this->page, '', $link ); 
        } 
        return $link;
      }
      // If the .php filename is present in the link
      if ( false !== strpos( $link, $this->page ) ) {
        return str_replace( $this-> page, $this->page . '/' . $code, $link );
      }
      return str_replace( $server, $server . $code . '/', $link );
    }

  }

I'm calling it this way:

// code for header module:
// Returns a button on a <div>
$data = new FWR_language_selection( $navigation, $language, ( isset( $lng ) && ( $lng instanceof language ) ) ? $lng : false, $session_started , 'hreflink');

[...]

// code for header_tags module:
// Returns a <meta>
$data = new FWR_language_selection( $navigation, $language, ( isset( $lng ) && ( $lng instanceof language ) ) ? $lng : false, $session_started , 'button');

The second time I use it will throw the error. May it be a problem related to instancing the same class twice? It's beyond my knowledge. Any help?

Share this post


Link to post
Share on other sites

I tried searching for a fix for this but was unable to find it. Anyone know?

 

 

PHP Fatal error:  Call to a member function retrieveDependencies() on a non-object in /home/xxx/public_html/includes/modules/ultimate_seo_urls5/uri_modules/standard.php on line 84

 

 

Line 83-94 is this:

    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 ) {
        // osC experimental urls
        if ( false !== strpos( Usu_Main::i()->getVar( 'request_uri' ), $dep . '/' ) ) {
          return false;
        }
      }
      if ( false !== strpos( Usu_Main::i()->getVar( 'request_uri' ), '.html' ) ) { // Standard seo url does not have .html
        return false;
      }

Thank you in advance for your help.

Share this post


Link to post
Share on other sites

@@piernas...ah...I have to digest what you are saying...but b4 that...you can't have multiple instances of the USU5 class as it is a singleton class...basically, when you re-declare it it would just check for its existence and reuse it...signleton instance works perfectly in this application...

 

 

@@clustersolutions I've finally found what was causing the Unable to determine the page link. I was using the code for language selection from here http://forums.oscommerce.com/topic/336702-ultimate-seo-urls-5-by-fwr-media/?p=1573463, slightly modified to show a language icon on header and a hreflang meta tag in the code. I made two modules one for each task (one for header and the other for header tags) and I've found If you call FWR_Language_Selection class twice in the same page it will throw the error and second call will fail.

 

I'll try to isolate the problem so both modules can work together. I tried to destroy the class instance after using it on the first module but it makes no difference. I think $page will not be passed second time but I'm not sure. If someone has a clue on why it will fail please tell me :)

Share this post


Link to post
Share on other sites

Your first setup? If so...go through the setup instruction again...

 

I tried searching for a fix for this but was unable to find it. Anyone know?

 

 

Line 83-94 is this:

    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 ) {
        // osC experimental urls
        if ( false !== strpos( Usu_Main::i()->getVar( 'request_uri' ), $dep . '/' ) ) {
          return false;
        }
      }
      if ( false !== strpos( Usu_Main::i()->getVar( 'request_uri' ), '.html' ) ) { // Standard seo url does not have .html
        return false;
      }

Thank you in advance for your help.

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

×