goosedesign Posted June 1, 2014 Share Posted June 1, 2014 I don't know if this is the right place to put this, but it's worth a shot. There are many situations where I find limitations in the basic Prestashop software could be overcome by including a CMS page inside another template. One example is the contact form template, which on most sites really needs much more information than a single line of text before the form. In a V1.3 site I was able to figure out how to do this, but in subsequent versions it no longer works and seems to be very difficult to achieve. It would be fantastic if there was some sort of global variable that could be used to easily pull the content of any given CMS page in to any template. Or maybe somebody knows how to do this in V1.5? Link to comment Share on other sites More sharing options...
PSfever.com Posted June 1, 2014 Share Posted June 1, 2014 Hi, this should not be hard at all - it depends on where do you want to use the content of that CMS page. Tell me where you want this feature to be implemented, I'll tell you what to edit Link to comment Share on other sites More sharing options...
vekia Posted June 1, 2014 Share Posted June 1, 2014 in my opinion it will be much eaiser if you will add there {l s='text'} code (to contact.tpl) and then - translate it with localization > translations tools no core changes = no problems Link to comment Share on other sites More sharing options...
goosedesign Posted June 2, 2014 Author Share Posted June 2, 2014 Thanks Vekia, that's ideal for small quantities of text, but I'm talking about a situation where you want the full features of the editor, probably quite a large body of text, and the ability for an administrator to easily edit it. The contact form template is a classic example, and the one that's plaguing me right now. If I can create a CMS page called "contact" and call it in the contact template, just before the form, we can include all kinds of information including address, telephone numbers, hours of operation, even images if necessary. If anything needs to change, it's a simple matter for the site admin to edit a CMS page. PSFever.com, I would love to know how to call a predefined CMS page in the contact form template in PS 1.5. Link to comment Share on other sites More sharing options...
CartExpert.net Posted June 3, 2014 Share Posted June 3, 2014 Hi. You can override your ContacController and create within a new object for the CMS, using the ID of the CMS page you want to insert. You then assign the object to the template and you display it's content wherever you want. Regards.Robin.The CartExpert Team 1 Link to comment Share on other sites More sharing options...
goosedesign Posted June 3, 2014 Author Share Posted June 3, 2014 Thanks Robin. I'm a designer who just dabbles in PHP and that process is just a bit beyond me. I managed it somehow in a previous version by copying and pasting code, but I fear I would need to really understand what I'm doing these days! Link to comment Share on other sites More sharing options...
CartExpert.net Posted June 3, 2014 Share Posted June 3, 2014 Hi. Here's how to override a controller: http://www.cartexpert.net/prestashop-tips-and-tricks/15-prestashop-tips-for-april-2014 You should override the initContent() method. You will create the object there: $cms = new CMS([CMS_ID], $this->context->language->id); $this->context->smarty->assign('cms ', $cms ); parent::initContent(); Then you process $cms in contact-form.tpl Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
goosedesign Posted June 11, 2014 Author Share Posted June 11, 2014 Hi Robin Thanks so much for that. But I get the error: "Notice: Undefined index: cms…" and "Notice: Trying to get property of non-object…". What have I done wrong? 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