Jump to content

Obtenir l'url canonique d'un produit


Recommended Posts

Bonjour,

j'ai un module qui me permet d'ajouter des liens produit suivant / produit précédent sur les pages produit de mon site.
J'obtient mes urls comme ça :
 

if (is_array($cat_products))
			for ($i = 0; $i < sizeof($cat_products); $i++)
			{
				if ($cat_products[$i]['id_product'] == $id_product)
				{
					if ($i > 0)
					{
						$cat_product = new Product($cat_products[$i - 1]['id_product'], false, intval($cookie->id_lang));
						$prevLink = $link->getProductLink($cat_products[$i - 1]['id_product'], $cat_product->link_rewrite, $category->link_rewrite, $cat_product->ean13);
						$prevName = $cat_products[$i - 1]['name'];
					}
					elseif ($loop AND sizeof($cat_products) > 1)
					{
						$cat_product = new Product($cat_products[sizeof($cat_products) - 1]['id_product'], false, intval($cookie->id_lang));
						$prevLink = $link->getProductLink($cat_products[sizeof($cat_products) - 1]['id_product'], $cat_product->link_rewrite, $category->link_rewrite, $cat_product->ean13);
						$prevName = $cat_products[sizeof($cat_products) - 1]['name'];
					}
					
					if ($i < sizeof($cat_products) - 1)
					{
						$cat_product = new Product($cat_products[$i + 1]['id_product'], false, intval($cookie->id_lang));
						$nextLink = $link->getProductLink($cat_products[$i + 1]['id_product'], $cat_product->link_rewrite, $category->link_rewrite, $cat_product->ean13);
						$nextName = $cat_products[$i + 1]['name'];
					}
					elseif ($loop AND sizeof($cat_products) > 1)
					{
						$cat_product = new Product($cat_products[0]['id_product'], false, intval($cookie->id_lang));
						$nextLink = $link->getProductLink($cat_products[0]['id_product'], $cat_product->link_rewrite, $category->link_rewrite, $cat_product->ean13);
						$nextName = $cat_products[0]['name'];
					}
				}
			}

Ca marche bien sauf que j'aimerai obtenir les urls canoniques des produits (question SEO).

Auriez vous une idée de comment procéder ?

Link to comment
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
×
×
  • Create New...