Jump to content

Créer des pages supplémentaires


Recommended Posts

  • 2 weeks later...

Bonjour,

 

Un petit exemple pour créer par exemple une nouvelle page qui servirait de page contact.

 

Il va falloir dans un premier temps créer un nouveau controller 'contactus', dans override/controller/front/contactus.php:

<?php
/*
* 2007-2014 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-2014 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 ContactusControllerCore extends FrontController
{
	public $php_self = 'contactus';
	public $ssl = true;
	public $hasError = false;

	public function setMedia()
	{
		parent::setMedia();
		$this->addCSS(_THEME_CSS_DIR_.'contactus.css', 'all');
		$this->addJS(_THEME_JS_DIR_.'contactus.js', 'all');
	}

	/**
	 * Initialize auth controller
	 * @see FrontController::init()
	 */
	public function init()
	{
		parent::init();
	}

	/**
	 * Assign template vars related to page content
	 * @see FrontController::initContent()
	 */
	public function initContent()
	{
		parent::initContent();
		// On assigne nos variables à Smarty
		$this->context->smarty->assign(array());
		$this->setTemplate(_PS_THEME_DIR_.'contactus.tpl');
	}
}

Plus qu'à créer les fichier correspondants, à savoir:

(en supposant que vous utilisez le thème par défaut de prestashop 'default-bootstrap')

 

- themes/default-bootstrap/contactus.tpl

- themes/default-bootstrap/css/contactus.tpl

- themes/default-bootstrap/js/contactus.tpl

 

Pour finir, supprimez le fichier: cache/class_index.php

 

Pour accéder à votre page il faudra utiliser une url de ce genre:

www.votresite.com/?controller=contactus

Link to comment
Share on other sites

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