Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Update models/ExampleData.php #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion models/ExampleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,22 @@ class ExampleData extends ObjectModel
'lorem' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 64),
),
);
}

/*
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/';


}

}