Jump to content

create a custom page without CMS


spc
 Share

Recommended Posts

Hello 
I follow this tutorials: https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/

First i create a file called custom-page.php and upload it to /root
code:

<?php

  include(dirname(__FILE__).'/config/config.inc.php');
  Tools::displayFileAsDeprecated();

  include(dirname(__FILE__).'/header.php');

  $smarty->display(_PS_THEME_DIR_.'custom-page.tpl');

  include(dirname(__FILE__).'/footer.php');

later i create a file called: CustomPageController.php an upload it to /controllers/front/
code: 

<?php

  class CustomPageControllerCore extends FrontController
  {
    public $php_self = 'custom-page';
    public $ssl = true;

    public function init(){
      parent::init();
    }
    
    public function initContent()
    {
        parent::initContent();

        $this->setTemplate('custom-page');
    }
}

the last file i create i name it custom-page.tpl and upload it to themes/templates/custom-page.tpl
my code:

{extends file='page.tpl'}

<div>

<h1>Sök och hitta A-mått</h1>

<p>
Alla A-mått är vägledande mått. <br />
Var uppmärksam på ändrat A-mått när du ändrar totalvikten på husvagnen. Vi rekommenderar alltid att du dubbelkollar måtten hos din återförsäljare.<br /><br />
{widget name="pm_advancedsearch4" id_search_engine="2"}</p>
</div>

I reset cache and check the page.

I go to page/index.php?controller=custom-page but i only get 404 error.
what have i done wrong. using ps 1.7.6.0

Share this post


Link to post
Share on other sites

I manage to fix it my self..

change my custom-page.tpl:

{extends file='page.tpl'}

{block name='page_title'}
  {l s='Sök och hitta A-mått' d='Shop.Theme'}
{/block}    

{block name='page_content'}
<p>
Alla A-mått är vägledande mått. <br />
Var uppmärksam på ändrat A-mått när du ändrar totalvikten på husvagnen. Vi rekommenderar alltid att du dubbelkollar måtten hos din återförsäljare.<br /><br />
{widget name="pm_advancedsearch4" id_search_engine="2"}</p>
{/block}

 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More