Jump to content

Feature request - CMS content in non CMS template


goosedesign

Recommended Posts

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

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

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

  • Like 1
Link to comment
Share on other sites

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

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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...