From 195fc2a0937dc403319068d9f68bb8f7a0e10dd6 Mon Sep 17 00:00:00 2001 From: Varindien Date: Tue, 19 Feb 2013 11:08:18 +0100 Subject: [PATCH] Update models/ExampleData.php Surcharge constructeur pour prise en compte de l'upload d'image au niveau du controlleur --- models/ExampleData.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/models/ExampleData.php b/models/ExampleData.php index 38471ba..e22db25 100644 --- a/models/ExampleData.php +++ b/models/ExampleData.php @@ -18,4 +18,22 @@ class ExampleData extends ObjectModel 'lorem' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 64), ), ); -} \ No newline at end of file + + /* + Si besoin d'upload d'image + On surcharge le constructeur afin de pouvoir bénéficier de l'upload d'image dans le controller + @TODO : verifier s'il est possible d'uploader directemetn dans un dossier du module en utilisant + fieldImageSettings dan le controler, par défaut le chemin part de _PS_IMG_DIR_ dans la fonction qui gère l'upload. + + + */ + public function __construct($id_category = null, $id_lang = null, $id_shop = null) + { + parent::__construct($id_category, $id_lang, $id_shop); + $this->id_image = ($this->id && file_exists(_PS_IMG_DIR_.'example/'.(int)$this->id.'.jpg')) ? (int)$this->id : false; + $this->image_dir = _PS_IMG_DIR_.'example/'; + + + } + +}