megamulti Posted February 20, 2013 Share Posted February 20, 2013 I want to change the position of the shop name title displayed in the browser on the left location above.For example, When I fill in shop name "My Shop name" and go to SEO and URL and edit for example Authentication, then the result will be:Authentication - My Shop nameBut I want it to turn:My Shop name - Authentication.So that every browser title begins with My Shop name, instead of begining with the SEO name given.Many thanks in advance Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted February 20, 2013 Share Posted February 20, 2013 Hi, just override Meta::getHomeMates: /** * Get meta tags for a given page * * @since 1.5.0 * @param int $id_lang * @param string $page_name * @return array Meta tags */ 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; } with this: /** * Get meta tags for a given page * * @since 1.5.0 * @param int $id_lang * @param string $page_name * @return array Meta tags */ public static function getHomeMetas($id_lang, $page_name) { $metas = Meta::getMetaByPage($page_name, $id_lang); $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? Configuration::get('PS_SHOP_NAME').' - '.$metas['title'] : 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; } Regards Link to comment Share on other sites More sharing options...
JaivyDaam Posted September 27, 2013 Share Posted September 27, 2013 Hello all, This is not working for my prestashop 1.5.5 for some reason the shopname dissapears from the title completely. I have all the caching off and force compilation on. I have no idea what i am doing wrong:( Thank you in advance! Jaivy Link to comment Share on other sites More sharing options...
vekia Posted September 27, 2013 Share Posted September 27, 2013 can you share url to your store? i will inspect the code Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted September 27, 2013 Share Posted September 27, 2013 (edited) i really did it practically 1.5.5 demo $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? Configuration::get('PS_SHOP_NAME').' - '.$metas['title'] : Configuration::get('PS_SHOP_NAME'); Edited September 28, 2013 by Jiten rash (see edit history) 1 Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted September 28, 2013 Share Posted September 28, 2013 hello replace ur meta.php with this its done see here Meta.php Link to comment Share on other sites More sharing options...
JaivyDaam Posted September 30, 2013 Share Posted September 30, 2013 Thank you for the responses! I finally managed to do it Now i am going to do it for my categories and products as well since it doesn't do it all together. Ill upload the file as soon as i am done. vekia: This is my shop, beware tho, it's dutch and i sell 50 shades of grey kind of products Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 hello thank you for confirmation that everything works for you as you expected im going to mark this topic as [solved] and also to check your website thanks for url! with regards, Milos Link to comment Share on other sites More sharing options...
JaivyDaam Posted September 30, 2013 Share Posted September 30, 2013 Ok i think i spoke to soon. The meta title in the products and category didn't add it at all, i forgot i have entered the shopname by hand. But still no automatic shopname. public static function getCategoryMetas($id_category, $id_lang, $page_name, $title = '') { if (!empty($title)) $title = ' - '.$title; $page_number = (int)Tools::getValue('p'); $sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description` FROM `'._DB_PREFIX_.'category_lang` cl WHERE cl.`id_lang` = '.(int)$id_lang.' AND cl.`id_category` = '.(int)$id_category.Shop::addSqlRestrictionOnLang('cl'); if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) { if (empty($row['meta_description'])) $row['meta_description'] = strip_tags($row['description']); // Paginate title if (!empty($row['meta_title'])) $row['meta_title'] = Configuration::get('PS_SHOP_NAME') .' - '.$title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : ''); else $row['meta_title'] = Configuration::get('PS_SHOP_NAME') .' - '.$row['name'].(!empty($page_number) ? ' ('.$page_number.')' : ''); if (!empty($title)) $row['meta_title'] = Configuration::get('PS_SHOP_NAME') .' - '.$title.(!empty($page_number) ? ' ('.$page_number.')' : ''); return Meta::completeMetaTags($row, $row['name']); } i have no idea what i am doing wrong:( in my php noobish opinion this should work right? Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 Jiten attached own meta file above, have you tried it? Link to comment Share on other sites More sharing options...
JaivyDaam Posted September 30, 2013 Share Posted September 30, 2013 Yes sir i have, tho this changes only the homepage meta title and not the category or product meta title Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now