kdmonk1 Posted September 10, 2016 Share Posted September 10, 2016 Team, I am looking for code that will allow me to add the manufacturer name to the Product Page Title. Can I get some assistance? Meta.php (completeMetaTags function) if (empty($meta_tags['meta_title'])) { $meta_tags['meta_title'] = $default_value.' - '.Configuration::get('PS_SHOP_NAME'); } Would need to add the manufacturer name to meta title, ie: "Manufacturer Name - Skirt - Shop Name" Link to comment Share on other sites More sharing options...
Denver Prophit Jr. Posted September 10, 2016 Share Posted September 10, 2016 You really should not insert MFG name into the meta data. IF your theme has microdata, display MFG name onto the page and mark that up under product schema. Consult with a developer for hire. Link to comment Share on other sites More sharing options...
kdmonk1 Posted September 13, 2016 Author Share Posted September 13, 2016 Thanks Denver for the advice. I am not going the route of hiring a developer at this time. I would like to do this on my own. Can you provide details on how to do this or is there anyone out in the forum that can provide an alternate solution? Link to comment Share on other sites More sharing options...
Denver Prophit Jr. Posted September 13, 2016 Share Posted September 13, 2016 A proficient developer would take merely a few minutes to add in the correct smarty variables to your theme. Why are you expecting developers to solve your problems without compensation? Link to comment Share on other sites More sharing options...
kdmonk1 Posted September 13, 2016 Author Share Posted September 13, 2016 Denver, having to pay a developer for a change that someone has already implemented is not what I am looking for. My goal is to make the change myself, which gives me the opportunity to learn how the code works and helps me pass this information on to someone with the same question. I understand where you are coming from in regards to compensation since I am a Java Developer. If no one can answer the question, maybe a call to a developer specialized in this field would be needed in my case. Link to comment Share on other sites More sharing options...
rocky Posted September 15, 2016 Share Posted September 15, 2016 Create override/classes/Meta.php with the following code: <?php class Meta extends MetaCore { public static function getProductMetas($id_product, $id_lang, $page_name) { $sql = 'SELECT pl.`name`, pl.`meta_title`, pl.`meta_description`, pl.`meta_keywords`, pl.`description_short`, m.`name` as manufacturer_name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`'.Shop::addSqlRestrictionOnLang('pl').') '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) WHERE pl.id_lang = '.(int)$id_lang.' AND pl.id_product = '.(int)$id_product.' AND product_shop.active = 1'; if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) { if (empty($row['meta_description'])) { $row['meta_description'] = strip_tags($row['description_short']); } return Meta::completeMetaTags($row, ($row['manufacturer_name'] ? $row['manufacturer_name'].' ' : '').$row['name']); } return Meta::getHomeMetas($id_lang, $page_name); } } Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override. 1 Link to comment Share on other sites More sharing options...
kdmonk1 Posted September 15, 2016 Author Share Posted September 15, 2016 Thanks rocky, I made the change in the override class and I am not seeing any changes happen, but when I make the change in the classes/Meta.php it works. For testing, I copied the entire Meta.php code into the override/classes folder and it still does not work. Then I saw your last comment about deleting the cache/class_index.php. Another comment: (https://www.prestashop.com/forums/topic/238197-solved-overrides-not-working-anymore-in-154/) After deleting the file it works now! Thank you rocky for your help and I hope this question helps someone in the future! 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