Jump to content

How to... New Page | New Class | New Controller


UriMarti

Recommended Posts

Hello everyone,

 

I have been all day reading tutorials about how to create a new page in Prestashop using my own php Class.

 

All i have found on Internet is about older Prestashop versions and don't talk about create a new Class .php

 

What i exactly need is to create a new page (new-page.tpl) with a classes/NewPage.php

 

I have already created:

 

- new-page.php: [on root folder]

<?php
require(dirname(__FILE__).'/config/config.inc.php');
Controller::getController('NewPageController')->run();

- NewPageController.php: [on controllers/front/ folder]

<?php

	class NewPageControllerCore extends FrontController
	{
		public $php_self = 'newpage';
		public $page_name = 'New Page';
		public function initContent()
		{
			parent::initContent();
			$this->setTemplate(_PS_THEME_DIR_.'new-page.tpl');
		}
	}

- new-page.tpl [on themes/MyTheme/ folder]

 

Here is the problem. It works perfectly, but i need to use my own php file [already creating it].

 

How can i use it? I want it like classes/Product.php functions. But being classes/NewPage.php functions.

 

 

 

Thank you very much for your responses.

 

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