Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ULTIMATE Seo Urls 5 - by FWR Media


Recommended Posts

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

Link to comment
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?

Link to comment
Share on other sites

  • 3 weeks later...

 

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
Link to comment
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?

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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"?

Link to comment
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
Link to comment
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...

Link to comment
Share on other sites

  • 2 weeks later...

hi i need clarifications on seo urls module which i bought http://www.magneticone.com/store/osCommerce.Modules/Power.SEO.URLs.for.osCommerce...osCommerce.module

 

and i have uploaded this module o my server when i logged in to admin it shows fatal error ( as incompactiable file) on the file m1_seourls.adminbox.php on line 0.

how to solve this?

Link to comment
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://www.oscommerce.com/forums/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 :)

Link to comment
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?

Link to comment
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.

Link to comment
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://www.oscommerce.com/forums/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 :)

Link to comment
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.

Link to comment
Share on other sites

Yes I'm learning about those singleton classes. USU 5 has hard to follow code for me and these are beyond my little knowledge for now. But it seems, when being called by the FWR_Language_Selection above, main class will try to initialize again, thus not founding the $page value. Maybe that FWR_Language_Selection class has to be a singleton class too? I'll try to dig on it.

 

 

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

 

Link to comment
Share on other sites

@@clustersolutions thanks for your help. I've also foun that, when using multilanguage support and force "www.mysite.com" together, every language on index page is redirected to standard 404 error (not USU error). ie. www.mysite.com/en reslolves to 404 error. If I remove the force option (ie. www.mysite.com/index.php/en) it resolves fine. Does this happen to you, too?

Edited by piernas
Link to comment
Share on other sites

  • 2 weeks later...

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