Here you can see how you can add html and text on various places of your template.
Presta is very good written e-commerce platform and class overwriing is piece of cake. So, here is the code:
1. Create a file under {presta_dir}/override/classes and name it Tools.php.
2. Copy and paste that code in the new file:
/**
* Tools override class
*/
class Tools extends ToolsCore{
public static function getPage($link_rewrite = null){
global $cookie;
$page = Db::getInstance()->getRow("SELECT * FROM "._DB_PREFIX_."cms_lang WHERE id_lang='".(int)($cookie->id_lang)."' AND link_rewrite LIKE '".$link_rewrite."'");
return $page['content'];
}
}
Note: if you already have this file just copy only the function and place it inside the Tools class.
3. That’s it 🙂 Go and create a new CMS page under Prestashop Admin (Tools->CMS). Add a nice “friendly url” and put your your text in the body.
4. How to use the function in the template: Go to your template file files and insert the following code:
Don’t forget to delete the cache.
Conclusion: The code is not 100% MVC, but it’s working straight away. As benefit your texts will be multilingual, and especially when you need to put them on places where there is no hooks, This would save a lot of time and effort.
Hope this helps.
I can’t get it to work. Can someone help me?
Delete “;” – it should work 😉
PrestaShop templates are built specifically for the platform. Also to that, one could also have an special theme developed for a entirely personalized and specific store.
Good post!
Nice post!
Do not works with: PS v1.5.6.0
Here it is define the process of adding text blocks in Prestashop template..
similar solution http://blog.goldenapp.eu/en/prestashop-cms-page-content-template-file-tpl
gooood!!!
Your job is good
I can’t get it to work. Can someone help me?