You are here:  » Price in Product Title

Support Forum



Price in Product Title

Submitted by lunen on Fri, 2011-06-03 14:35 in

Hi David,

I'd like to add the product price to the title so the meta title will look like Product Name - Price - Site Name.
Here's the code I tried inside the /html/header.php file:

<title><?php if (isset($header["title"]) && $header["title"]) {echo $header["title"]." - " .$config_currencyHTML.$product["price"]. " - " .$config_title; } else {echo $config_title; }  ?></title>

that doesn't work, so I guess I'm using the wrong price variable or maybe I need to declare it on the /html/header.php file?

Any Ideas?

Submitted by support on Fri, 2011-06-03 14:49

Hi Lunen,

Rather than edit the header file, you can set the $header["title"] required in products.php itself.

In that file, the product page title is created by this code at line 64:

      $header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);

...so for the title you're after, have a go with:

      $header["title"] = htmlentities($q,ENT_QUOTES,$config_charset)." - ".$config_currencyHTML.$product["products"][0]["price"]." - ".$config_title;

Hope this helps!

Cheers,
David.
--
PriceTapestry.com