Jump to content

[solved] Prestashop 1.5.4 CMS pages not showing content after updating


Recommended Posts

Dear all,

 

Yesterday I updated a shop I administer to the latest version of Prestashop (1.5.4.1) and, although there were some slight CSS issues that I've ironed out, there is a major issue with the CMS pages.

 

Basically, the CMS pages load but the content in those CMS pages are missing. This obviously is a MAJOR issue as those CMS pages include T&Cs, delivery info, data privacy and all that that protects the shop against any future issues.

 

Here's an example: http://zeliahorsley....-and-conditions

 

PLEASE PLEASE PLEASE can someone help me this is???

 

Thanks in advance. :)

 

Paul

Link to comment
Share on other sites

Hey Vekia, please see below the coding of my cms.tpl

 

{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 1.4 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if $cms->id != $cgv_id}

{/if}
{if isset($cms) && !isset($category)}
{if !$cms->active}
 <div id="admin-action-cms">
  <p>{l s='This CMS page is not visible to your customers.'}
  <input type="hidden" id="admin-action-cms-id" value="{$cms->id}" />
  <input type="submit" value="{l s='Publish'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad}', 0)"/>  
  <input type="submit" value="{l s='Back'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad}', 1)"/>  
  </p>
  <div class="clear" ></div>
  <p id="admin-action-result"></p>
  </p>
 </div>
{/if}
<div class="rte cms{if $content_only} content_only{/if}">
 {$cms->content}
</div>
{elseif isset($category)}
<div>
 <h1>{$category->name|escape:'htmlall':'UTF-8'}</h1>
 {if isset($sub_category) & !empty($sub_category)}
  <h4>{l s='List of sub categories in '}{$category->name}{l s=':'}</h4>
  <ul class="bullet">
   {foreach from=$sub_category item=subcategory}
 <li>
  <a href="{$link->getCMSCategoryLink($subcategory.id_cms_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
 </li>
   {/foreach}
  </ul>
 {/if}
 {if isset($cms_pages) & !empty($cms_pages)}
 <h4>{l s='List of pages in '}{$category->name}{l s=':'}</h4>
  <ul class="bullet">
   {foreach from=$cms_pages item=cmspages}
 <li>
  <a href="{$link->getCMSLink($cmspages.id_cms, $cmspages.link_rewrite)|escape:'htmlall':'UTF-8'}">{$cmspages.meta_title|escape:'htmlall':'UTF-8'}</a>
 </li>
   {/foreach}
  </ul>
 {/if}
</div>
{else}
{l s='This page does not exist.'}
{/if}

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Hello Vekia,

I have the same problem , I followed all your steps but it still isn't working. 

Is there anything else that i can do? 

Here is my cms.tpl file after removing the print_r

 

DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if ($content_only == 0)}
{include file="$tpl_dir./breadcrumb.tpl"}
{/if}
{if isset($cms) && !isset($cms_category)}
{if !$cms->active}
<br />
<div id="admin-action-cms">
<p>{l s='This CMS page is not visible to your customers.'}
<input type="hidden" id="admin-action-cms-id" value="{$cms->id}" />
<input type="submit" value="{l s='Publish'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad|escape:'htmlall':'UTF-8'}', 0, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
<input type="submit" value="{l s='Back'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad|escape:'htmlall':'UTF-8'}', 1, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
</p>
<div class="clear" ></div>
<p id="admin-action-result"></p>
</p>
</div>
{/if}
<div class="rte{if $content_only} content_only{/if}">
{$cms->content}
</div>
{elseif isset($cms_category)}
<div class="block-cms">
<h1><a href="{if $cms_category->id eq 1}{$base_dir}{else}{$link->getCMSCategoryLink($cms_category->id, $cms_category->link_rewrite)}{/if}">{$cms_category->name|escape:'htmlall':'UTF-8'}</a></h1>
{if isset($sub_category) && !empty($sub_category)}
<p class="title_block">{l s='List of sub categories in %s:' sprintf=$cms_category->name}</p>
<ul class="bullet">
{foreach from=$sub_category item=subcategory}
<li>
<a href="{$link->getCMSCategoryLink($subcategory.id_cms_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
</li>
{/foreach}
</ul>
{/if}
{if isset($cms_pages) && !empty($cms_pages)}
<p class="title_block">{l s='List of pages in %s:' sprintf=$cms_category->name}</p>
<ul class="bullet">
{foreach from=$cms_pages item=cmspages}
<li>
<a href="{$link->getCMSLink($cmspages.id_cms, $cmspages.link_rewrite)|escape:'htmlall':'UTF-8'}">{$cmspages.meta_title|escape:'htmlall':'UTF-8'}</a>
</li>
{/foreach}
</ul>
{/if}
</div>
{else}
<div class="error">
{l s='This page does not exist.'}
</div>
{/if}
Link to comment
Share on other sites

no worries, im asking because it is very important to know your prestashop version.

 

what issue you've got exactly? i've got several questions:

 

1) are you able to define new pages in abck office (preferences > CMS tab)

2) are you able to edit contents of pages that you've got defined? after save, changes appear in back office properly?

3) you use default theme? 

Link to comment
Share on other sites

yes I'm using deafult theme. the site is ( www.relaxcom.ro) 

The backoffice is working properly , I'm creating as many contents as I want . I can save , i can change , do everything I can without errors

But as you can see in the front office in the link . 

All you can see is About us and our stores. 

I tried to create several contents , but with no result

If you click on information , they appear , but I want them to appear in the main Information table.

Link to comment
Share on other sites

Hey Vekia,

 

I can't access the backend and on every frontpage come up "Page does not exist".

 

Can you help please..

 

Thanks

1.5.4

 

i suppose that your issue aren't related to main case in this topic, can you please create new thread with description of your issue?

Link to comment
Share on other sites

  • 1 month later...

Hello Vekia,

 

Can you help me figure out something, my webpage administrator left the country so im kinda on my own. I have updated my prestashop to the 1.5.6.0 version, so far managed to set up everything and it works great with my default theme that is modified to my custom needs, until i wanted to change some CMS pages, then i have noticed that i dont have them in my back office>preferences>cms . I mean when i open my website and navigate to the pages i have all the content there and everything works great, just when i wanted to chage severel text's and links i realized that i dont have those pages in the CMS category so i cant edit them and i have started cheking one by one and realized that im missing 24 pages from CMS. 

I hope you understand what im writing, simpy i have the pages on my website, just i dont have them in my CMS editor to edit them. How can i get them back?

 

Thanks in advance,

Daniel

Link to comment
Share on other sites

  • 1 month later...

Hi, 

I have the exact same problem as the topic starter. Empty CMS pages even though they aren't empty in the back end. I tried adding the debug line. It then show the page content plus some more stuff.

As soon as i remove that line though, the page is empty again. What is the next step after adding the extra debug line to the cms.tpl?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

yes i can confirm, for me it works now.

also cms pages works too:

93HneLs.png

 

Exactly it works and you can open the page, everybody can, but, when i want to EDIT some of these CMS pages i cant becouse i dont have it listed anymore in my admin panel , preferences > CMS , and the page i want to edit is not listed there, i have several pages to be more specific i have 24 pages that are visible to people but not for me to edit them in the preferences > CMS editor

For example i have the page :

http://www.laptopdelovi.rs/en/35_laptop-charger-ac-adapter

 

But in the admin > prefenreces > CMS > the page is not listed so i cant edit it anymore.

Link to comment
Share on other sites

What i want to say that i have in the preferences > CMS i think 18 CMS pages and i can access them and edit them without any problem but im missing 24 pages from there so i could edit them, but the pages are not missing from the Front office or should i say they are not missing from the website, you can navigate and browse on them.

Link to comment
Share on other sites

Damn i keep missing the activity in this thread. Anybody have any idea how to solve my problem?

 

Thanks!

 

edit: it seems that if i remove {$cms|print_r}, all of my cms content is put in html comment tags. I think these are the tags normally meant for showing which module is starting, but it doesnt close properly?

 

http://casadelvinoamsterdam.nl/content/4-Over-ons -> look at the source code.

Edited by suikerklontje (see edit history)
Link to comment
Share on other sites

Ok! I've found a solution! 

https://github.com/PrestaShop/PrestaShop/commit/1ed8a01f5f723c313d92d976bff4dd704aadf33c

 

I guess this is because of the use of a theme not meant for 1.5 :/

Great, but for me i have a different problem, im using the default theme with some modification, and everybody can see the CMS pages only i cant find them in the back office administration to edit these pages and change something on them , and i have some 24 pages like that.

Link to comment
Share on other sites

  • 4 weeks later...

Hi there, I have a CMS problem regarding images. I am using PS 1.5.6.1 and are using it local with easyPHP. If i create a CMS-page and like to put an image on it, I click on insert image and go to "upload image". I upload and the photo is uploaded to the prestashop/img/cms folder (I have looked it is there :-) ). Then in the next screen, I can see the images name and if I click on the small icon beside I can preview the image.  I mark the image and in the information block I can read some facts about the image and that it is readable and writable. I then click on "Select" and in the next page I can read the image address (I beleive it is here the problem is) http://127.0.0.1/C:/linnea/prestashop/img/cms/tyttebaervedtrefot.jpg.  I can not preview the image and if I go further, the image will not be displayed. I have tried to remove http://, it did not help. I also tried with removing http://127.0.0.1/, did not help. So what to do.

I also have a very strange problem on the product page. When adding a new one I could not name it with some letters in the beginning, c for instance. The product then does not show up on the Front-office. I have to work me around this by giving it another name (not starting with c or k ...) and then save it look on it in Front-office and then I can go bac and rename it to its real name. But my big issue at the moment is the image problem.

/palle

Link to comment
Share on other sites

  • 1 month later...

Still unable to edit my CMS page , i have 24 CMS pages that i can see in the Front office, but i cant edit them becouse i cant find them in back office , for example here is one page :

 

http://www.laptopdelovi.rs/sr/35_laptop-charger-ac-adapter

 

and i cant edit it to change the text on it becouse i dont have it in my CMS list in the back office

 

Anyone know how to solve this issue?

Link to comment
Share on other sites

  • 2 weeks later...

I had the same problem as some other users. This topic has [sOLVED] in addition, but I cannot find the solution in this thread. And the last reply before mine is young and also contains the request for a solution. Therefor I add my experience to this thread. Maybe it will help others.

 

My problem: Changes to CMS pages disappear (changes are not saved, even though I try to save them and everything seems to work fine). PrestaShop version 1.5.6.2

 

My findings: I turned on displaying errors in the file ../config/defines.inc.php by changing define('_PS_MODE_DEV_', false) into define('_PS_MODE_DEV_', true).

 

Then I received an error.... PrestaShopDatabaseException: Unknown column 'indexation' in 'field list'. The executed SQL statement was like this:

UPDATE `ps_cms` SET `id_cms` = '1',`id_cms_category` = '1',`position` = '0',`indexation` = '0',`active` = '0' WHERE `id_cms` = 1

 

And indeed, opening MySQL database, looking at table ps_cms there was no field named indexation.

 

My solution: So I added this new field (ALTER TABLE  `ps_cms` ADD  `indexation` INT( 1 ) NOT NULL).

 

After this adjustment all works like a charm.

 

Of course one last action: changing back define('_PS_MODE_DEV_', true) into define('_PS_MODE_DEV_', false) again.

Edited by WalTig (see edit history)
Link to comment
Share on other sites

  • 3 months later...

hello

please share url to your website where you don't see contents.

Hello Vekia, I made a new topic for this and it was solved quickly... Here is the post http://www.prestashop.com/forums/topic/341820-cant-see-my-content-on-cms-pages-solved/?do=findComment&comment=1723568

Hello Vekia, I made a new topic for this and it was solved quickly... Here is the post http://www.prestashop.com/forums/topic/341820-cant-see-my-content-on-cms-pages-solved/?do=findComment&comment=1723568

Oh and thank you anyway!!

Link to comment
Share on other sites

  • 1 month later...

I had the same problem as some other users. This topic has [sOLVED] in addition, but I cannot find the solution in this thread. And the last reply before mine is young and also contains the request for a solution. Therefor I add my experience to this thread. Maybe it will help others.

 

My problem: Changes to CMS pages disappear (changes are not saved, even though I try to save them and everything seems to work fine). PrestaShop version 1.5.6.2

 

My findings: I turned on displaying errors in the file ../config/defines.inc.php by changing define('_PS_MODE_DEV_', false) into define('_PS_MODE_DEV_', true).

 

Then I received an error.... PrestaShopDatabaseException: Unknown column 'indexation' in 'field list'. The executed SQL statement was like this:

UPDATE `ps_cms` SET `id_cms` = '1',`id_cms_category` = '1',`position` = '0',`indexation` = '0',`active` = '0' WHERE `id_cms` = 1

 

And indeed, opening MySQL database, looking at table ps_cms there was no field named indexation.

 

My solution: So I added this new field (ALTER TABLE  `ps_cms` ADD  `indexation` INT( 1 ) NOT NULL).

 

After this adjustment all works like a charm.

 

Of course one last action: changing back define('_PS_MODE_DEV_', true) into define('_PS_MODE_DEV_', false) again.

 

Absolute genious! I have pulled my hair trying to solve this problem.

Thank you a million WalTig!!

Edited by Coloranti (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I use PS 1.6.0.9 and a child of the default theme (copy).

I have that problem of content not showing up on backoffice side. It's like it quickly appears sometimes, but no.

I tried the debug trick but it doesn't work. It's weird because I did not make any changes in that child theme, except css tweaks.

Any idea to make my content appear again ?

 

[edit]

 

Solved : let Prestashop regenerate a clean htaccess ;)

Edited by boogs (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Hi I have the same issues as the person who started this threadand I have followd the steps. My verion is 1.6 . When i pasted this

 

{$cms|print_r}

 

in the cms.tpl, it showed me the cms contents but then i removed it as you said then everything dissapeared again. Is it resolved differently in v1.6? Thanks

Edited by archkenny (see edit history)
Link to comment
Share on other sites

  • 5 weeks later...
  • 3 weeks later...

I am facing the same problem. I upgrade prestashop 1.6.0.9 to the latest version 1.6.0.13 two day ago and having problem. I restore backup at the phpmyadmin the problem still there. I had try all method on this thread but it not help.

 

I cannot access the cms at the back office and it show category cannot be load post-852368-0-95400100-1425367174_thumb.jpg

 

My website all cms page not display and show This page does not exist.   post-852368-0-74883600-1425367223_thumb.jpg

 

Please HELP !!!

Edited by vivianlwy (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  1. HI Vekia, i have just updated to version 1.6.0.14 and i have just  lost cms access both in backend and also in front end. it was working fine in ver 1.6.0.13 after a transfer from one hosting company to another. I have tried the debug and it shows that the cms shop is not visible but when i look at the database it is present and also shows how many characters in the content. I am not sure how to proceed. Your help would be highly appreciated. I dont mind creating the cms pagers from scratch since i have all the filezilla backups but i have no access in back office. 
  2. This is my cms file if i can perhaps also use a debug tool like you have previously used with sucess.
  3. <?php

    /*

    * 2007-2015 PrestaShop

    *

    * NOTICE OF LICENSE

    *

    * This source file is subject to the Open Software License (OSL 3.0)

    * that is bundled with this package in the file LICENSE.txt.

    * It is also available through the world-wide-web at this URL:

    * http://opensource.org/licenses/osl-3.0.php

    * If you did not receive a copy of the license and are unable to

    * obtain it through the world-wide-web, please send an email

    * to [email protected] so we can send you a copy immediately.

    *

    * DISCLAIMER

    *

    * Do not edit or add to this file if you wish to upgrade PrestaShop to newer

    * versions in the future. If you wish to customize PrestaShop for your

    * needs please refer to http://www.prestashop.com for more information.

    *

    *  @author PrestaShop SA <[email protected]>

    *  @copyright  2007-2015 PrestaShop SA

    *  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)

    *  International Registered Trademark & Property of PrestaShop SA

    */

     

    class CmsControllerCore extends FrontController

    {

                    public $php_self = 'cms';

                    public $assignCase;

                    public $cms;

                    public $cms_category;

                    public $ssl = false;

     

                    public function canonicalRedirection($canonicalURL = '')

                    {

                                    if (Tools::getValue('live_edit'))

                                                    return;

                                    if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl)))

                                                    parent::canonicalRedirection($canonicalURL);

                                    elseif (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category)))

                                                    parent::canonicalRedirection($canonicalURL);

                    }

     

                    /**

                     * Initialize cms controller

                     * @see FrontController::init()

                     */

                    public function init()

                    {

                                    if ($id_cms = (int)Tools::getValue('id_cms'))

                                                    $this->cms = new CMS($id_cms, $this->context->language->id, $this->context->shop->id);

                                    elseif ($id_cms_category = (int)Tools::getValue('id_cms_category'))

                                                    $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id, $this->context->shop->id);

     

                                    if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && $id_cms && Validate::isLoadedObject($this->cms)

                                                    && in_array($id_cms, array((int)Configuration::get('PS_CONDITIONS_CMS_ID'), (int)Configuration::get('LEGAL_CMS_ID_REVOCATION'))))

                                                                    $this->ssl = true;

     

                                    parent::init();

     

                                    $this->canonicalRedirection();

     

                                    // assignCase (1 = CMS page, 2 = CMS category)

                                    if (Validate::isLoadedObject($this->cms))

                                    {

                                                    $adtoken = Tools::getAdminToken('AdminCmsContent'.(int)Tab::getIdFromClassName('AdminCmsContent').(int)Tools::getValue('id_employee'));

                                                    if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken)

                                                    {

                                                                    header('HTTP/1.1 404 Not Found');

                                                                    header('Status: 404 Not Found');

                                                    }

                                                    else

                                                                    $this->assignCase = 1;

                                    }

                                    elseif (Validate::isLoadedObject($this->cms_category))

                                                    $this->assignCase = 2;

                                    else

                                    {

                                                    header('HTTP/1.1 404 Not Found');

                                                    header('Status: 404 Not Found');

                                    }

                    }

     

                    public function setMedia()

                    {

                                    parent::setMedia();

     

                                    if ($this->assignCase == 1)

                                                    $this->addJS(_THEME_JS_DIR_.'cms.js');

     

                                    $this->addCSS(_THEME_CSS_DIR_.'cms.css');

                    }

     

                    /**

                     * Assign template vars related to page content

                     * @see FrontController::initContent()

                     */

                    public function initContent()

                    {

                                    parent::initContent();

     

                                    $parent_cat = new CMSCategory(1, $this->context->language->id);

                                    $this->context->smarty->assign('id_current_lang', $this->context->language->id);

                                    $this->context->smarty->assign('home_title', $parent_cat->name);

                                    $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID'));

                                    if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category)

                                                    $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS');

                                    elseif (isset($this->cms_category->meta_title))

                                                    $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS');

                                    if ($this->assignCase == 1)

                                    {

                                                    $this->context->smarty->assign(array(

                                                                    'cms' => $this->cms,

                                                                    'content_only' => (int)Tools::getValue('content_only'),

                                                                    'path' => $path,

                                                                    'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite)

                                                    ));

     

                                                    if ($this->cms->indexation == 0)

                                                                    $this->context->smarty->assign('nobots', true);

                                    }

                                    elseif ($this->assignCase == 2)

                                    {

                                                    $this->context->smarty->assign(array(

                                                                    'category' => $this->cms_category, //for backward compatibility

                                                                    'cms_category' => $this->cms_category,

                                                                    'sub_category' => $this->cms_category->getSubCategories($this->context->language->id),

                                                                    'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id),

                                                                    'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',

                                                                    'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite)

                                                    ));

                                    }

     

                                    $this->setTemplate(_PS_THEME_DIR_.'cms.tpl');

                    }

    }

Link to comment
Share on other sites

 

  1. HI Vekia, i have just updated to version 1.6.0.14 and i have just  lost cms access both in backend and also in front end. it was working fine in ver 1.6.0.13 after a transfer from one hosting company to another. I have tried the debug and it shows that the cms shop is not visible but when i look at the database it is present and also shows how many characters in the content. I am not sure how to proceed. Your help would be highly appreciated. I dont mind creating the cms pagers from scratch since i have all the filezilla backups but i have no access in back office. 
  2. This is my cms file if i can perhaps also use a debug tool like you have previously used with sucess.
  3. <?php

    /*

    * 2007-2015 PrestaShop

    *

    * NOTICE OF LICENSE

    *

    * This source file is subject to the Open Software License (OSL 3.0)

    * that is bundled with this package in the file LICENSE.txt.

    * It is also available through the world-wide-web at this URL:

    * http://opensource.org/licenses/osl-3.0.php

    * If you did not receive a copy of the license and are unable to

    * obtain it through the world-wide-web, please send an email

    * to [email protected] so we can send you a copy immediately.

    *

    * DISCLAIMER

    *

    * Do not edit or add to this file if you wish to upgrade PrestaShop to newer

    * versions in the future. If you wish to customize PrestaShop for your

    * needs please refer to http://www.prestashop.com for more information.

    *

    *  @author PrestaShop SA <[email protected]>

    *  @copyright  2007-2015 PrestaShop SA

    *  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)

    *  International Registered Trademark & Property of PrestaShop SA

    */

     

    class CmsControllerCore extends FrontController

    {

                    public $php_self = 'cms';

                    public $assignCase;

                    public $cms;

                    public $cms_category;

                    public $ssl = false;

     

                    public function canonicalRedirection($canonicalURL = '')

                    {

                                    if (Tools::getValue('live_edit'))

                                                    return;

                                    if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl)))

                                                    parent::canonicalRedirection($canonicalURL);

                                    elseif (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category)))

                                                    parent::canonicalRedirection($canonicalURL);

                    }

     

                    /**

                     * Initialize cms controller

                     * @see FrontController::init()

                     */

                    public function init()

                    {

                                    if ($id_cms = (int)Tools::getValue('id_cms'))

                                                    $this->cms = new CMS($id_cms, $this->context->language->id, $this->context->shop->id);

                                    elseif ($id_cms_category = (int)Tools::getValue('id_cms_category'))

                                                    $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id, $this->context->shop->id);

     

                                    if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && $id_cms && Validate::isLoadedObject($this->cms)

                                                    && in_array($id_cms, array((int)Configuration::get('PS_CONDITIONS_CMS_ID'), (int)Configuration::get('LEGAL_CMS_ID_REVOCATION'))))

                                                                    $this->ssl = true;

     

                                    parent::init();

     

                                    $this->canonicalRedirection();

     

                                    // assignCase (1 = CMS page, 2 = CMS category)

                                    if (Validate::isLoadedObject($this->cms))

                                    {

                                                    $adtoken = Tools::getAdminToken('AdminCmsContent'.(int)Tab::getIdFromClassName('AdminCmsContent').(int)Tools::getValue('id_employee'));

                                                    if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken)

                                                    {

                                                                    header('HTTP/1.1 404 Not Found');

                                                                    header('Status: 404 Not Found');

                                                    }

                                                    else

                                                                    $this->assignCase = 1;

                                    }

                                    elseif (Validate::isLoadedObject($this->cms_category))

                                                    $this->assignCase = 2;

                                    else

                                    {

                                                    header('HTTP/1.1 404 Not Found');

                                                    header('Status: 404 Not Found');

                                    }

                    }

     

                    public function setMedia()

                    {

                                    parent::setMedia();

     

                                    if ($this->assignCase == 1)

                                                    $this->addJS(_THEME_JS_DIR_.'cms.js');

     

                                    $this->addCSS(_THEME_CSS_DIR_.'cms.css');

                    }

     

                    /**

                     * Assign template vars related to page content

                     * @see FrontController::initContent()

                     */

                    public function initContent()

                    {

                                    parent::initContent();

     

                                    $parent_cat = new CMSCategory(1, $this->context->language->id);

                                    $this->context->smarty->assign('id_current_lang', $this->context->language->id);

                                    $this->context->smarty->assign('home_title', $parent_cat->name);

                                    $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID'));

                                    if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category)

                                                    $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS');

                                    elseif (isset($this->cms_category->meta_title))

                                                    $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS');

                                    if ($this->assignCase == 1)

                                    {

                                                    $this->context->smarty->assign(array(

                                                                    'cms' => $this->cms,

                                                                    'content_only' => (int)Tools::getValue('content_only'),

                                                                    'path' => $path,

                                                                    'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite)

                                                    ));

     

                                                    if ($this->cms->indexation == 0)

                                                                    $this->context->smarty->assign('nobots', true);

                                    }

                                    elseif ($this->assignCase == 2)

                                    {

                                                    $this->context->smarty->assign(array(

                                                                    'category' => $this->cms_category, //for backward compatibility

                                                                    'cms_category' => $this->cms_category,

                                                                    'sub_category' => $this->cms_category->getSubCategories($this->context->language->id),

                                                                    'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id),

                                                                    'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',

                                                                    'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite)

                                                    ));

                                    }

     

                                    $this->setTemplate(_PS_THEME_DIR_.'cms.tpl');

                    }

    }

 

Hi Vekia, just an update. I was able to gain access to the back office by uploading a new shop.php in classes now i am looking to see what i can do about the front end. Thank you.

Link to comment
Share on other sites

  • 2 months later...

Hi,

Nothing is working for me. I have the latest version. Everything but the cms page is not working. I go to cms , create a new page , hit submit and get the message , " successful update " , but my page is blank . Nothing there.

I have tried for hours , searched the forum , tried everything, still no luck. What else can i do if my cms doesnt work?

Any easy way to make custom pages?

I erased the old htaccess file and re uploaded a new blank one.

Now i am getting this error.

 

An error occurred while updating an object. cms (Unknown column 'id_shop' in 'field list')

 

Thanks

Edited by fastcloud (see edit history)
Link to comment
Share on other sites

  • 5 months later...
  • 4 weeks later...
  • 1 year later...

Try to copy file attached to this post, copy it to controllers/front/ directory

 

change name to the CmsController.php

 

(make a backup of original CmsController.php file first)

I am facing issue with multi shop PS 1.6.1.11 CMS link block on footer when I click on URL , url seems to be correct but it says doesnt not exist when I check preference cms pages are there but they are empty for that specific shop 

Link to comment
Share on other sites

CMS page publish button is not working prestashop 1.5.6.2. Its works fine if the displayed boolean button is enabled. When Click no that time open page publish button is having that page. I clicked publish button is not working. anyone help me please

Link to comment
Share on other sites

thank you for informations :-)

glad to hear that community solved another problem so quickly :-)

my Cms lang field is showing empty enteris for each page and id shop column was missing I aaded ID shop column but no luck PS 1.6.1.11

 

I made a seprate post as well but no usehttps://www.prestashop.com/forums/topic/598437-empty-cms-page-in-back-front-office-multi-shop-prestashop-16111/

Link to comment
Share on other sites

  • 1 month later...
  • 2 months 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...