You are here:  » Using Merchant longest description for the META description tag

Support Forum



Using Merchant longest description for the META description tag

Submitted by speak2daryl on Tue, 2012-04-03 21:16 in

Hi David,

I have implemented node 2228 to add the product description to the META description tag, the description used for this tag is from the cheapest merchant, my cheapest merchants often provide a really short description (often just two words). I have implemented a mod to override these short descriptions on the product pages with the longest description from the merchants.

Is the any way doing a similar mod to the META description tag to display the longest description from the merchants?

Thanks

Daryl

Submitted by support on Wed, 2012-04-04 08:04

Hello Daryl,

Sure, in place of the suggested modification:

$header["meta"]["description"] = htmlentities($product["products"][0]["description"],ENT_QUOTES,$config_charset);

...have a go with:

$md = "";
foreach($product["products"] as $p)
{
  if (strlen($p["description"]) > strlen($md))
  {
    $md = $p["description"];
  }
}
$header["meta"]["description"] = htmlentities($md,ENT_QUOTES,$config_charset);

Cheers,
David.
--
PriceTapestry.com

Submitted by speak2daryl on Wed, 2012-04-04 10:01

Hi David,

The code works perfectly, your a star!!!

Thanks.

Daryl