Jump to content

Recommended Posts

Bonjour la communauté,

 

Voici quelques jours que je tente de créer une page sur Prestashop 1.6 Après avoir tenté plusieurs solutions et tuto j'obtiens toujours le même problème.

 

"Fatal error: Class 'ShopController' not found in ..../site/classes/controller/Controller.php on line 135"

 

Voici la technique utilisée:

 

 

1. Création du fichier "ShopController.php" dans controllers/front/

 

<?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 ShopControllerCore extends FrontController
{
  
public $php_self = 'shop';


  public function initContent()
  {
  
   parent::initContent();
   $this->setTemplate(_PS_THEME_DIR_.'shop.tpl');
  }
}

2. Création du fichier "shop.php" à la racine du site.

 

<?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
*/


require_once(dirname(__FILE__).'/config/config.inc.php');
Controller::getController('ShopController')->run();

 

3. Création du fichier "shop.tpl" dans mon thème.

{** 2007-2014 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-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}


<h1>Affiche toi !!!</h1>

4. Url > SEO & URL

 

seo.png

 

 

5. Je tape l'url "http://localhost:8888/fr/shop"

 

 

6. L'erreur apparait "Fatal error: Class 'ShopController' not found in /Volumes/Print-Web with style/Web With Style/Website 2014/llm-mecasport_v3/site/classes/controller/Controller.php on line 135"

 

 

Merci d'avance pour votre aide

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

Bonjour,

 

Non les cms est trop limité. J'aurais besoin de créer une page ( plusieurs ) reconnue par prestashop pour les traductions et ou je pourrais y intégrer une mise en page totalement différente du site ( en gardant néanmoins le header et le footer )

Link to comment
Share on other sites

Pourquoi n'as tu pas pensé à crée un module ? et créer les contrôleurs frontal dont tu as besoin est un tpl pour chaque contrôleur ? et gérer les urls comme tu l'as fait avant via seo & urls

 

-- edit --

 

Essaie de supprimer le fichier "class_index.php" dans le dossier cache

 

J'ai suivi ce que tu as fais et je n'ai eu aucun problème avec, 

 

j'ai essayé le fichier shop.php avec les 2 instructions (en commentant et décommentant ) 

//Tools::displayFileAsDeprecated();

//Tools::redirect('index.php?controller=shop'.((count($_GET) || count($_POST)) ? '&'.http_build_query(array_merge($_GET, $_POST), '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');

Controller::getController('ShopController')->run();

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

Enfaite je suis développeur front-end et donc j'ai quelques difficultés dès qu'il s'agit de créer des modules et compagnie..

 

Cependant si je n'ai pas le choix je le ferais mais si on pouvait modifier quelques lignes dans mon code et faire tourner cette page je ne dirais pas non  :)

 

Merci pour ta réponse.

Link to comment
Share on other sites

Bonsoir, 

 

J'aimerais pouvoir créer plusieurs pages statique de même type avec le header, footer etc...un peu comme ma page index.

 

J'ai créer des pages CMS mais le problème c'est que je voudrais changer les URL pour utiliser des redirection htaccess (je ne veux pas d'id dans l'url mais mettre des liens statique qui eux redirigeront vers les bonnes pages en dur dans le htaccess).

 

Quelqu'un pourrait-il m'aider ?

 

J'ai un livrable à rendre dans quelques jours et je suis encore nouveau sur prestashop...

Link to comment
Share on other sites

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