Jump to content

Include price in meta title


freeman0
 Share

Recommended Posts

Hello!

 

Anyone has an idea how to append current product price to the <title> tag when viewing a product?

The title tag is set in header.tpl

 

<title>{$meta_title|escape:'htmlall':'UTF-8'}</title>

 

and the product price is calculated much later in product.tpl

 

{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL)}

 

I cannot modify title in product.tpl because it is already set. I also cannot calculate product price in header.tpl.

 

How can I solve this?

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Hello,

 

I am looking for the same thing, I would like the product price to be implemented automatically in the meta title.

 

I think it's a very good thing because once a customer search in Google the price appear with the title which can help a lot for bring the visitor to your website...

Share this post


Link to post
Share on other sites

Yes, that's exactly my idea. But I guess it might not be possible since nobody has posted any hint or solution yet.

I only managed to achieve this using JavaScript, but unfortunately Google doesn't see it :(

Share this post


Link to post
Share on other sites

  • 3 months later...
  • 3 weeks later...
  • 3 years later...

Try:

		<title>{$meta_title|escape:'html':'UTF-8'}{if isset($smarty.get.id_product) && $smarty.get.id_product|intval > 0} - {convertPrice price=Product::getPriceStatic($smarty.get.id_product|intval)}{/if}</title>
  • Like 1

Share this post


Link to post
Share on other sites

  • 3 weeks later...
  • 11 months later...
  • 4 years later...

Hi,

 

This works great! Thank you. I would love to see a modification that instead of the Price a minimum price is displayed based on the quantity discounts. Would this be possible?

PrestaShop 1.6

 

Jacek

 

 

On 10/1/2016 at 7:24 AM, rocky said:

Try:

		<title>{$meta_title|escape:'html':'UTF-8'}{if isset($smarty.get.id_product) && $smarty.get.id_product|intval > 0} - {convertPrice price=Product::getPriceStatic($smarty.get.id_product|intval)}{/if}</title>

 

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More