Unfortunately, there is no built-in Prestashop function to change the template on one page only. Let’s clarify the process of removing columns on CMS page. We are going to change one appearance (1) into another (2).
For this purpose we need to override the method displayFooter() of controller CmsControllerCore (for removing the right column). Override function first appeared in Prestashop 1.4 and allows to override the functionality without modifying the system core, i.e. no further problems will arise during the upgrade to the new version.
Let’s create CMSController file in /override/controllers/ folder with the following content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
class CmsController extends CmsControllerCore { public function displayFooter() { if (!self::$initialized) $this->init(); self::$smarty->assign(array( 'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => self::$cart)), 'HOOK_FOOTER' => Module::hookExec('footer'), 'content_only' => (int)(Tools::getValue('content_only')))); self::$smarty->display(_PS_THEME_DIR_.'footer_cms.tpl'); //live edit if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) { self::$smarty->assign(array('ad' => $ad, 'live_edit' => true)); self::$smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl'); } else Tools::displayError(); } } |
We overrode the displayFooter () function and changed the template in which the right column was defined, without touching the system core. Now we create the final template with the file / themes / prestashop / footer_cms.tpl:
1 |
{if !$content_only} |
{/if}
The standard footer.tpl looks this way:
1 |
if !$content_only} |
{/if}
By now there should be no right column on CMS page, but the page looks somewhat boring, so it would be nice to extend the content. Play with your CSS:
1 2 3 4 5 6 7 8 9 10 |
#center_column { margin: 0 0 30px; overflow: visible; width: 556px; } #page .rte { background: none repeat scroll 0 0 transparent; overflow: visible; width: 770px; } |
With this being done, we’ve changed the width of the content and our site looks much better.To delete the left column on your website, you repeat these steps, overriding displayHeader() instead of displayFooter() of controller CmsControllerCore.
mahendra,
Our support team can help you with that. You can contact them at [email protected]
Hi Alex, could u pls tell me how to hide/disable all other modules except username & password on the sign in page … while in mobile view.
Karam,
To delete empty spaces you need to edit css. Unfortunately, the final version of this module has not been issued because the developers found this module unpromising.
will this method work for 1.5.4, i have hided the right column but it still reserving the space m i need this space
Paul Hart,
You mean using the module соlumn_mаnаger for custome pages?
Hardik,
Sorry, but I do not understand your question. How is it related to the article? If this is a general question, which is not related to the topic of article, then please, provide more details about the issue.
Hi Alex,
This is what I am looking to achieve and I think that I understand the script.
How do I assign this to each page, ie one page with both left and right columns and one page with just left column.
I am presuming I should cut and paste this code into new pages and upload new pages via ftp. Can you be more specific what pages I should copy, change and which folder to add them into?
Or
Can I pay you for a quick chat?
Regards
Paul
how to add our own menu in back-office using Prestashop 1.5??
Okay ! I’ll tried your module shortly. Thank you very much. I’m grateful to you who give your time to develop free modules. It’s very useful for guys like me !
I’ll follow your blog too !
Yida,
The described method concerns the 1.4.x version. Follow our blog – we’ll post how to remove columns in the 1.5.x version shortly. Do not waste time though and try our new Column Manager free module for 1.5.x now – it’s still being tested, however, you can download it already
Hi !
Thanks for this tip (sorry for my pitiful english).
So I tried your method, but now I have a question : “Which part of the code selects the page where the right column is not appearing?”
Because it didn’t work with my prestashop 1.5.3.1.
I modified my CMSController file, next I created a footer_cms.tpl file but it didn’t changed anything. Did I missed something ?
I hope you could help me even if your post has been posted a long time ago. =/
It is necessary to change the following files:
footer.tpl
grid_prestashop.css
footer.tpl:
Delete\comment the following lines:
It would be as well useful to call
{$HOOK_RIGHT_COLUMN}
in the right column at least; otherwise this hook modules will be removedgrid_prestashop.css:
Increase the width of the central column:
For example: http://belvg.info/demo/prestashop/storelocator/index.php?controller=stores
I want to remove right column… I changed the footer and right column disappeared in 1.5.1.0 but now unable to increase the width of central column.. at http://blog.belvg.com/removing-columns-from-one-cms-page-in-prestashop.html I am unable to understand method for 1.5.1.0
How to do this in 1.5.1.0 I am tried a lot but unable to do that