androidstore Posted September 1, 2012 Share Posted September 1, 2012 Hello I've been searching for 2 hours but I couldnt find any solution to this problem: When I go to next page in category then title name stays same - its ok - but next to the title name is number of current page in parentheses. It looks like this: default page title name = "Mobile devices" page 2 title name = "Mobile devices (2)" page 3 title name "Mobile devices (3)" and so on.. This way it looks like (2) or (3) undread messages or so.. How do I get rid of this paging in title name? Or can I atleast somewhere rename title to "Mobile devices - page 2" ? Thanks for any help! Regards, Michal Link to comment Share on other sites More sharing options...
androidstore Posted September 20, 2012 Author Share Posted September 20, 2012 anyone please? Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 11, 2013 Share Posted November 11, 2013 I'd like a solution for this as well. What file(s) determines the meta title for categories? Link to comment Share on other sites More sharing options...
vekia Posted November 11, 2013 Share Posted November 11, 2013 I'd like a solution for this as well. What file(s) determines the meta title for categories? classes/Meta.php you've got there definition of meta tags for all pages in prestashop store. Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 11, 2013 Share Posted November 11, 2013 Thanks vekia. At what code and line do we have to remove/edit to remove/change the (2) for example? Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 13, 2013 Share Posted November 13, 2013 Any idea? Link to comment Share on other sites More sharing options...
vekia Posted November 13, 2013 Share Posted November 13, 2013 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'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); if (!empty($title)) $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); return Meta::completeMetaTags($row, $row['name']); } return Meta::getHomeMetas($id_lang, $page_name); } Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 13, 2013 Share Posted November 13, 2013 Will this work or how should it look? // Paginate title if (!empty($row['meta_title'])) $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? : '').' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].(!empty($page_number) ? : '').' - '.Configuration::get('PS_SHOP_NAME'); if (!empty($title)) $row['meta_title'] = $title.(!empty($page_number) ? : '').' - '.Configuration::get('PS_SHOP_NAME'); Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 18, 2013 Share Posted November 18, 2013 Do you know vekia? Link to comment Share on other sites More sharing options...
vekia Posted November 18, 2013 Share Posted November 18, 2013 sorry, i missed your reply here use this: (!empty($page_number) ? : '':'') this is shorthand if Link to comment Share on other sites More sharing options...
Ciseur Posted November 19, 2013 Share Posted November 19, 2013 (edited) sorry, i missed your reply here use this: (!empty($page_number) ? : '':'') this is shorthand if So you make a if for having the same result whatever the result of your condition is ? Not very good. Better removing this shorthand if and just let this (same result, better code) : If you want to remove page number in the title (which is not really recommended for SEO reasons and for your users) : // Paginate title if (!empty($row['meta_title'])) $row['meta_title'] = $title.$row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].' - '.Configuration::get('PS_SHOP_NAME'); if (!empty($title)) $row['meta_title'] = $title.' - '.Configuration::get('PS_SHOP_NAME'); If you want to have a "- page N -" in your <title>, use : // Paginate title if (!empty($row['meta_title'])) $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' - page '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].(!empty($page_number) ? ' - page '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); if (!empty($title)) $row['meta_title'] = $title.(!empty($page_number) ? ' - page '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); This last code block answer the androidstore question and is based on the getCategoryMetas function submited above. Please test this code before using it on a production environment. And of course overload the original class, don't edit the Prestashop Core. Hope this helps anyone, Best regard, Ciseur Edited November 19, 2013 by Ciseur (see edit history) Link to comment Share on other sites More sharing options...
MGLimhamn Posted November 19, 2013 Share Posted November 19, 2013 Thanks for both of your replies. I don't think most users find "iPads (2), iPads (12)" etc, very clear. It doesn't indicate that it's the current page you're on. A problem I came to think of if you're gonna add text to the title is multi-language. Can you make the title multilingual? Link to comment Share on other sites More sharing options...
Ciseur Posted November 19, 2013 Share Posted November 19, 2013 If you want to translate the "page" string to localize your <title>, use $this->l() function // Paginate title if (!empty($row['meta_title'])) $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' - '.$this->l('page').' '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].(!empty($page_number) ? ' - '.$this->l('page').' '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); if (!empty($title)) $row['meta_title'] = $title.(!empty($page_number) ? ' - '.$this->l('page').' '.$page_number : '').' - '.Configuration::get('PS_SHOP_NAME'); Hope, it's clear and it helps.Best regards, Ciseur 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