Jump to content

How to get manufacturer name in Meta Title of manufacturer' products list page?


Recommended Posts

You would no doubt have to edit your header.tpl template file. However I just tried this by changing the line:

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



to

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


or

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



The first should display the manufactor's name, the second tried to put the breadcrumb line in the title. However both failed to work. I suspect the header is loaded and parsed before the breadcrumb or manufacturer's name is known.

Unless someone else knows a clever way to make this work, then I suspect some hacks to the PHP are needed.

sorry
Andrew

Link to comment
Share on other sites

oh, I bet javascript could do it, in fact it can. This is a bit of a hack, but in manufacturer.tpl place the following code

[removed]
   document.title = "{$manufacturer->name|escape:'htmlall':'UTF-8'}";
[removed]



Edit: it seems my opening and closing javascript tags were removed. They should look like the ones here: http://snippets.dzone.com/posts/show/2617

This will use javascript to change the page's title.

enjoy
Andrew

Link to comment
Share on other sites

I have changed in header.tpl

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


to

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


and in manufacturer.tpl inserted code which U told (on picture). Pages with any manufacturers became empty, and title didn't change :-S

1735_xaPdGsKxq4fcj7c85Tx5_t

Link to comment
Share on other sites

I think there was a bit of a misunderstanding... The first way I suggested would be the best way, but it doesn't work. So there is no need to change header.tpl.

With the second way I see you copied and pasted the site I linked to, but you didn't need to copy everything on that site. You'll notice my code

document.title = "{$manufacturer->name|escape:'htmlall':'UTF-8'}";


didn't have

function changeTitle(title) { ... }



with it. You should remove that it hopefully it will work.

Andrew

Link to comment
Share on other sites

  • 1 month later...

So,
nobody knows how to change Meta Title in page with product list of the manufacturer (e.g. Sony) from those which set in
Back Office --> Preferences --> Appearance
(e.g. "Myshop.com - best shop in the world")

to
"Myshop.com - Sony"
or
"Sony - Myshop.com" ?

Link to comment
Share on other sites

  • 1 month later...

Nothing new here? I also need that desperatly! The title-Tag should contain the manufacturer's name and the meta-description the manufacturer's description!

Google Webmaster-Tools is reporting problems because I have dozens of pages with the same title-tag!

Link to comment
Share on other sites

Welll hmmm,

Something like this should work in Tools.php in method getMetaTags

/* Products specifics meta tags */
if ($id_product = Tools::getValue('id_product'))
{
  $row = Db::getInstance()->getRow('
  SELECT pl.`name`, `meta_title`, `meta_description`, `meta_keywords`, m.`name` `manufacturer_name`
  FROM `'._DB_PREFIX_.'product_lang` pl
  LEFT JOIN `'._DB_PREFIX_.'manufacturer_` m ON (m.id_manufacturer = pl.id_product)
  WHERE id_lang = '.intval($id_lang).' AND id_product = '.intval($id_product));
  if ($row)
     return self::completeMetaTags(self::completeMetaTags($row, $row['name'].' - '.$row['manufacturer_name']));
}



Not tested no warranty !

FYI metas are being created in core not in theme !!!

Regards

Link to comment
Share on other sites

Hi Gregory,

thank you - I've edited Tool.php but that is not working as it should...

<title>Product - Manufacturer - 1st Category - Sitename is what I need for single product-pages,
<title>Manufacturer - Sitename for the manufacturers and
<title>1st Category - 2nd Category - ... - Sitename</title> for category-pages

It's so important, see attatched image!

I think I'll start a new topic for all this SEO-related stuff, we've also need the meta-tags diplayed right when set for a manufacturer!

3108_7DKVo9MRs0guXpVr9b94_t

Link to comment
Share on other sites

×
×
  • Create New...