Jump to content



- - - - -

Canonical hreflang - ULTIMATE Seo Urls 5 by FWR Media


  • Please log in to reply
1 reply to this topic

#1   alfredor

alfredor
  • Members
  • 6 posts
  • Real Name:Alfredo

Posted 07 May 2012 - 01:53 PM

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.

#2   alfredor

alfredor
  • Members
  • 6 posts
  • Real Name:Alfredo

Posted 12 June 2012 - 04:48 PM

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?