Christiaan_01 Posted September 1, 2015 Share Posted September 1, 2015 (edited) Hi, I couldn't find what I was looking for in the search. I want to know how to add a variable to the meta description of categories. For instance to add {SHOP} in the meta description, so that the shop name will appear. I know how to add a variable to the regular category description: if (isset($this->category)){ $this->category->description=str_replace("{SHOP}",configuration::get('PS_SHOP_NAME'),"{$this->category->description}"); } But this doesn't work when I do it for the meta description. Does anyone know how to do it? It's useful if you want to mention your store name in the Meta description when you're using multistore. Thanks, Christiaan Edited September 1, 2015 by Christiaan_01 (see edit history) Link to comment Share on other sites More sharing options...
Christiaan_01 Posted September 1, 2015 Author Share Posted September 1, 2015 Got it solved. Find the file frontcontroller.php on line 290 delete this code $this->context->smarty->assign(Meta::getMetaTags($this->context->language->id, $page_name) and paste this piece of code // Start Custom: Replace {SHOP} // Original: // $this->context->smarty->assign(Meta::getMetaTags($this->context->language->id, $page_name)); $temp_metas = Meta::getMetaTags($this->context->language->id, $page_name); if ($temp_metas != null) { foreach ($temp_metas as $meta_key => $meta_value) { $temp_metas[$meta_key] = str_replace("{SHOP}", configuration::get('PS_SHOP_NAME'), $meta_value); } $this->context->smarty->assign($temp_metas); } else { $this->context->smarty->assign(Meta::getMetaTags($this->context->language->id, $page_name)); } // End Custom 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