Jump to content

kmb

Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Activity
    Developer

kmb's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Bonjour tout le monde, Je suis en train de développer des modules pour prestashop et j'utilise les override pour étendre les classes du coeur de prestashop. Cependant, parfois quand j'essaie d'installer un module j'obtiens des erreurs PHP dans le fichier généré dans le dossier override de prestashop. Quand je regarde a l'intérieur du dit fichier, je me rends compte que le code est complètement cassé. Voici un exemple: Ceci est le fichier que j'ai créé dans le dossier 'override/classes/' de mon module <?php class Customer extends CustomerCore { /** @var int Object avatar number */ public $avatar_num; public function __construct( $id = null ) { self::$definition[ 'fields' ][ 'avatar_num' ] = array( 'type' => self::TYPE_INT ); parent::__construct( $id ); } public function getGenderName() { $genders = Gender::getGenders(); foreach ( $genders as $gender ) { if( $gender->id == $this->id_gender ) { return $gender->name; } } } public function getChildren() { $sql = 'SELECT * FROM `'._DB_PREFIX_.'customer_child` WHERE `customer_id` = \''.(int)$this->id.'\' ORDER BY `id` ASC'; return Db::getInstance()->ExecuteS( $sql ); } /** * Retrieve customers displayName (aka firstanme lastname) * * @static * @param $id * @return array */ public static function getCustomersDisplayNameById($id) { $sql = 'SELECT CONCAT( `firstname` , \' \', `lastname` ) AS displayName FROM `'._DB_PREFIX_.'customer` WHERE `id_customer` = \''.pSQL($id).'\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); return Db::getInstance()->getValue($sql); } } Et voici ce que j'obtiens dans le dossier 'override/classes' du dossier override de prestashop. <?php class Customer extends CustomerCore { /** @var int Object avatar number */ } } } /** * Retrieve customers displayName (aka firstanme lastname) * * @static * @param $id * @return array } } Quelqu'un comprend ici ce qui peut causer ce type de rendu ? Merci d'avance pour votre aide !
  2. Hello everyone, I'm currently developping modules for prestashop and I use override to extend core classes. But sometimes, when I try to install a module that has overrides, I get PHP errors in the file that is located in the "override" folder of prestashop. When I look in this file I see that the code it contains is totally messed up. Here's an example: This is the file in the folder 'override/controllers/front' of my module <?php class Customer extends CustomerCore { /** @var int Object avatar number */ public $avatar_num; public function __construct( $id = null ) { self::$definition[ 'fields' ][ 'avatar_num' ] = array( 'type' => self::TYPE_INT ); parent::__construct( $id ); } public function getGenderName() { $genders = Gender::getGenders(); foreach ( $genders as $gender ) { if( $gender->id == $this->id_gender ) { return $gender->name; } } } public function getChildren() { $sql = 'SELECT * FROM `'._DB_PREFIX_.'customer_child` WHERE `customer_id` = \''.(int)$this->id.'\' ORDER BY `id` ASC'; return Db::getInstance()->ExecuteS( $sql ); } /** * Retrieve customers displayName (aka firstanme lastname) * * @static * @param $id * @return array */ public static function getCustomersDisplayNameById($id) { $sql = 'SELECT CONCAT( `firstname` , \' \', `lastname` ) AS displayName FROM `'._DB_PREFIX_.'customer` WHERE `id_customer` = \''.pSQL($id).'\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); return Db::getInstance()->getValue($sql); } } And then, this is what I get in the folder 'override/controllers/front' of prestashop. class Customer extends CustomerCore { /** @var int Object avatar number */ } } } /** * Retrieve customers displayName (aka firstanme lastname) * * @static * @param $id * @return array } } Do you see anything wrong in my code ? Thank you in advance for your help !
×
×
  • Create New...