josecar Posted November 21, 2012 Share Posted November 21, 2012 so Prestashop automatically adds shop name to meta title, wich I dont want. With the controllers thing, i am very confused as of where and how fix that, thanx for your help Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2012 Share Posted November 21, 2012 so Prestashop automatically adds shop name to meta title, wich I dont want. With the controllers thing, i am very confused as of where and how fix that, thanx for your help you must edit Meta class, you can find there something like: $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); you must delete the: Configuration::get('PS_SHOP_NAME'); from each meta_title value it's better to override this class, than edit default file Link to comment Share on other sites More sharing options...
josecar Posted November 21, 2012 Author Share Posted November 21, 2012 ok, if i get it, I go to /override/classes/Meta.php and copy there the relevant code from /classes from /classes/Meta.php: public static function getHomeMetas($id_lang, $page_name) { $metas = Meta::getMetaByPage($page_name, $id_lang); $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title'].' - '.Configuration::get('PS_SHOP_NAME') : Configuration::get('PS_SHOP_NAME'); $ret['meta_description'] = (isset($metas['description']) && $metas['description']) ? $metas['description'] : ''; $ret['meta_keywords'] = (isset($metas['keywords']) && $metas['keywords']) ? $metas['keywords'] : ''; return $ret; } so in line 4 of the above snippet i just leave this: $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title']; is this correct? Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2012 Share Posted November 21, 2012 is this correct? in this case it's better to use code below: $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title']:''; I tested it and it works well, hope it helps you I will write step-by-step tutorial about that for other users. Can i mark this topic as solved? please reply if it works. Link to comment Share on other sites More sharing options...
josecar Posted November 21, 2012 Author Share Posted November 21, 2012 not yet, i'm quite noob at this php with classes I tried this: copy pasted code inside 'original' Metacore class, then searched from all lines that appended shop name and deleted it. Maybe i made an error, but this didnt work. Should I try just dropping your line in the now emptied again class class 'Meta extends MetaCore' in overrides? Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2012 Share Posted November 21, 2012 if you dont want to edit main class, you must override it. So - you must open override/classes/Meta.php file and paste new function, that you want to override. here is an example that correspond to this case: <?php class Meta extends MetaCore { public static function getHomeMetas($id_lang, $page_name) { $metas = Meta::getMetaByPage($page_name, $id_lang); $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title'] : ''; $ret['meta_description'] = (isset($metas['description']) && $metas['description']) ? $metas['description'] : ''; $ret['meta_keywords'] = (isset($metas['keywords']) && $metas['keywords']) ? $metas['keywords'] : ''; return $ret; } } Link to comment Share on other sites More sharing options...
josecar Posted November 21, 2012 Author Share Posted November 21, 2012 great thanks, vekia, got it with gethomemetas. however, i am clueless as to how to strip just ps_shop name in this line in getcategorymetas() in line 30 of meta.php: $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); as you see, im quite noob at this, i really appreciate your help Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2012 Share Posted November 21, 2012 code below should works $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : ''); Link to comment Share on other sites More sharing options...
josecar Posted November 21, 2012 Author Share Posted November 21, 2012 yes it does. thats what i tried first, but it seems I stripped too much somewhere. thanks for your help, vekia. as soon as I complete all relevant funcions i'll post here a big fat SOLVED Link to comment Share on other sites More sharing options...
White Lion Posted April 9, 2013 Share Posted April 9, 2013 Thanks dear Vekia. your answer is very useful. Link to comment Share on other sites More sharing options...
customUK Posted August 17, 2013 Share Posted August 17, 2013 My version (1.5) doesn't have this file available. I followed this option instead... http://mypresta.eu/en/art/developer/remove-shop-name-from-title.html Link to comment Share on other sites More sharing options...
vekia Posted August 17, 2013 Share Posted August 17, 2013 My version (1.5) doesn't have this file available. I followed this option instead... http://mypresta.eu/e...from-title.html can you show please your header.tpl file contents? you can paste here only <head></head> section thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts