Jump to content
Sign in to follow this  

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.

Share this post

Link to post
Share on other sites

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


 function alternate_hreflang_canonical($parameters) {
$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;


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?

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
Sign in to follow this