'chcrea_image_type', 'primary' => 'id_image_type', 'multilang' => false, 'fields' => array( 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'width' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'height' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'id_shop' =>array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ), ); public function __construct($id = null, $id_lang = null, $id_shop = null) { parent::__construct($id, $id_lang, $id_shop); } public function update($null_values = false) { if(!parent::update($null_values)) return false; return true; } public function add($autodate = true, $null_values = false) { $this->id_shop = (int)Context::getContext()->shop->id; if(!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this)) return false; return true; } public static function GetAllImageTypes($prefix = null) { $id_shop = (int)Context::getContext()->shop->id; $sql = 'SELECT * FROM `'._DB_PREFIX_.'chcrea_image_type` '; $sql .= ' WHERE id_shop = '.(int)$id_shop; if ( $prefix != null ) { $sql .= ' AND `name` like "%'.$prefix.'%"'; } $queryexec = Db::getInstance()->executeS($sql); if(isset($queryexec) && !empty($queryexec)){ return $queryexec; }else{ $sql2 = 'SELECT * FROM `'._DB_PREFIX_.'chcrea_image_type` '; $sql2 .= ' WHERE 1'; $queryexec2 = Db::getInstance()->executeS($sql2); return $queryexec2; } } }