Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Canonical hreflang - ULTIMATE Seo Urls 5 by FWR Media


Recommended Posts

hi, I'm using osCommerce 2.2 with ULTIMATE Seo Urls 5 by FWR Media, it's working perfectly.

 

But i want to write in the header the alternate canonical tags like:

link rel="alternate" hreflang="fr"...
link rel="alternate" hreflang="en" ...

with the differents languages urls, this tags are not included in the KissMT Dynamic SEO Meta & Canonical Header Tags.

 

Anybody konws the code for write this tags? Because I write this, but doesnt work:

echo '<link rel="alternate" hreflang="fr" href="'.tep_href_link( FILENAME_PRODUCT_INFO, 'products_id='.(int)$HTTP_GET_VARS['products_id'].'&language=fr').'" />';
echo '<link rel="alternate" hreflang="en" href="'.tep_href_link( FILENAME_PRODUCT_INFO, 'products_id='.(int)$HTTP_GET_VARS['products_id'].'&language=en').'" />';

 

thanks, I think that is not necessary install any contribution... with ULTIMATE Seo Urls 5 by FWR Media it's ok, but i dont kown the code to write...

 

thanks a lot.

Link to comment
Share on other sites

  • 1 month later...

I have almost the solution, but I need a last effort, i write this in the header:

 

 function alternate_hreflang_canonical($parameters) {
 if ( defined( 'USU5_MULTI_LANGUAGE_SEO_SUPPORT' ) && USU5_MULTI_LANGUAGE_SEO_SUPPORT == 'true' ) {
$languages_query = tep_db_query( "select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order" );
$current_language = '';
$languages_array = array();
while ( $languages = tep_db_fetch_array( $languages_query ) ) {
  $languages_id = $languages['languages_id'];
  $language = $languages['directory'];
  Usu_Main::i()->initiate( array(), $languages_id, $language, true );
  $return .= '<link rel="alternate" hreflang="'.$languages['code'].'" href="'.tep_href_link( FILENAME_PRODUCT_INFO, "products_id=".(int)$parameters, 'NONSSL', false ).'" />
';  
}  
}
echo $return;
}
alternate_hreflang_canonical($HTTP_GET_VARS["products_id"]);

 

But this write correctly the URL, but no the name of the product in the url:

<link rel="alternate" hreflang="es" href="http://www.myweb.com/spanish-p-842.html" />
<link rel="alternate" hreflang="pt" href="http://www.myweb.com/pt/spanish-p-842.html" />
<link rel="alternate" hreflang="fr" href="http://www.myweb.com/fr/spanish-p-842.html" />
<link rel="alternate" hreflang="en" href="http://www.myweb.com/en/spanish-p-842.html" />

 

I need write this,but does not work the script...

<link rel="alternate" hreflang="es" href="http://www.myweb.com/spanish-name-product-p-842.html" />
<link rel="alternate" hreflang="pt" href="http://www.myweb.com/pt/portugues-name-product-p-842.html" />
<link rel="alternate" hreflang="fr" href="http://www.myweb.com/fr/frances-name-product-p-842.html" />
<link rel="alternate" hreflang="en" href="http://www.myweb.com/en/english-name-product-p-842.html" />

 

 

Any help please?

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