Jump to content

[SOLVED] Adding CMS content within another page


futurewebs

Recommended Posts

Hello,

 

I need to add the content of one of my CMS pages into my Product Description pages (product.tpl). Can anyone give me an advice how can I do this?

 

I think I need to edit ProductController.php but I am not sure what code I have to add and where?

 

Any help is much appreciated.

Link to comment
Share on other sites

in this case you need to modify productController.php file located in controllers/front/ directory

 

there is a code:


$this->context->smarty->assign(array(
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
...
...
...
...

use this:

$cmspage = new CMS(4);
$this->context->smarty->assign(array(
'cmspage' => $cmspage,
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
...
...
...

 

then in product.tpl page you can use $cmspage object

$cmspage = new CMS(4); - you can define own page id, here you can see 4, you can use any other you want

Link to comment
Share on other sites

Hi Vekia,

 

Thanks for your help!

 

I ended up using something very similar to what you mentioned, I added:

 

$cmspage = new CMS(15, $this->context->language->id);

 

And used the following in my product.tpl file:

 

{$cmspage->content}

 

Really appreciated your help with this!

Link to comment
Share on other sites

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...