Post by lovac24 » Thu Aug 18, 2011 5:07 am

Hallo,

how i can add a suffix to the <title> tag on product pages. so that the text appears only withingthe <title> tags in the <head> of product pages but not in the actual product titles themselves.

Thank You

TECHNODISCOUNT24 - BUY WITH ALERTPAY AND MONEYBOOKERS
Free Shipping Worldwide and Cheapest Prices
Buy Gadgets on the best Alertpay Shop


New member

Posts

Joined
Wed Mar 31, 2010 5:59 pm

Post by uksitebuilder » Thu Aug 18, 2011 5:17 am

Will the suffix be the same for all product pages or different for each product ?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Sat Aug 20, 2011 10:10 am

I would like to know where/how to add text to the browser title, but not the product itself too. the same to each page is fine..

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by uksitebuilder » Sat Aug 20, 2011 3:25 pm

open: catalog/view/theme/default/template/common/header.tpl

find:

Code: Select all

<title><?php echo $title; ?></title>
replace with:

Code: Select all

<title><?php echo $title . (isset($this->request->get['route'])&&$this->request->get['route']!='product/product'?' - WHATEVER YOU WANT'); ?></title>
OR If you just want to append the site name:

replace with:

Code: Select all

<title><?php echo $title . (isset($this->request->get['route'])&&$this->request->get['route']!='common/home'&&$this->request->get['route']!='product/product'?' - ' . $this->config->get('config_name'):''); ?></title>

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by lovac24 » Sat Aug 20, 2011 5:36 pm

uksitebuilder wrote:Will the suffix be the same for all product pages or different for each product ?
I want to make it different for every product. So please can you tell me where to change it? Thank You

TECHNODISCOUNT24 - BUY WITH ALERTPAY AND MONEYBOOKERS
Free Shipping Worldwide and Cheapest Prices
Buy Gadgets on the best Alertpay Shop


New member

Posts

Joined
Wed Mar 31, 2010 5:59 pm

Post by uksitebuilder » Sat Aug 20, 2011 9:18 pm

Do you use the 'Location' field in your edit product screen for anything ?

If not you could put the unique text in there.

Then we just need to append it to the title on the product page.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Sun Aug 21, 2011 6:53 am

When I replace the code below, the homepage's browser title shows "Notice: Undefined index: route in..."
and nothing changes on the product pages.

Code: Select all

<title><?php echo $title; if($this->request->get['route']!='product/product'){ echo ' - WHATEVER YOU WANT'; } ?></title>
And nothing happens (no errors either) when I change it to the one below.

Code: Select all

<title><?php echo $title . (isset($this->request->get['route'])&&$this->request->get['route']!='common/home'&&$this->request->get['route']!='product/product'?' - ' . $this->config->get('config_name'):''); ?></title>

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by uksitebuilder » Sun Aug 21, 2011 2:32 pm

OK, I changed one code block, but forgot the other, apologies, I have amended my code above.

You asked, for the title to be appended if not on the product page, or did I misunderstand your question ?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Mon Aug 22, 2011 3:16 am

Yes, I wanted to add some extra text to the title (the one on the web browser), but not to the product title on the webpage. I wanted to use the first code you gave. Tried it again and the site doesn't load. It's a blank page this time.

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by uksitebuilder » Mon Aug 22, 2011 3:26 am

ahh ok, not sure why you are getting a blank page.

So if I have this correct, you want to append a phrase to the META title on all pages including the product page (the browser page title). I misunderstood before and thought you meant all pages apart from the product pages.

If so, then, try this code. I have actually just done the same for my sites by appending the site name to the title, but you can use any phrase.

find:

Code: Select all

<title><?php echo $title; ?></title>
replace with:

Code: Select all

<title><?php echo $title . ' - WHATEVER YOU WANT'; ?></title>

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Mon Aug 22, 2011 9:58 am

aha yes, i want to append a phrase to the meta title of the product pages. Thanks! It works. How do I exclude the homepage from getting appended?

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by uksitebuilder » Mon Aug 22, 2011 2:50 pm

Code: Select all

<title><?php echo $title . (isset($this->request->get['route'])&&$this->request->get['route']!='common/home'?' - WHATEVER YOU WANT':''); ?></title>

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Mon Aug 22, 2011 5:04 pm

ohh, am I getting a blank page because the seo_url.php was edited?

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by uksitebuilder » Mon Aug 22, 2011 5:19 pm

do you get a blank page without the code change above ?

are there any errors in your admin error log ?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hellogoodbye » Tue Aug 23, 2011 4:23 am

Just tried the code again and it works. My bad, I must have left out the

Code: Select all

':''
while editing my keyword. Thank you for ur help!

New member

Posts

Joined
Wed May 04, 2011 6:33 am

Post by lovac24 » Wed Aug 24, 2011 8:43 pm

uksitebuilder wrote:Do you use the 'Location' field in your edit product screen for anything ?

If not you could put the unique text in there.

Then we just need to append it to the title on the product page.
I am not using the location field and i leave it always blank.

TECHNODISCOUNT24 - BUY WITH ALERTPAY AND MONEYBOOKERS
Free Shipping Worldwide and Cheapest Prices
Buy Gadgets on the best Alertpay Shop


New member

Posts

Joined
Wed Mar 31, 2010 5:59 pm
Who is online

Users browsing this forum: No registered users and 121 guests