* @copyright 2017 Agence Bondaty and Co * @license single * Agence Bondaty and Co */ class CheckageClass extends ObjectModel { public $id; public $id_shop; public $id_restriction; public $is_tab; public $ids_restrictions; public $hook; public $categories_ids; public $age_restriction; public $format_date; public $show_logo; public $all_restriction; public $best_sales; public $new_products; public $discount; public $manufacturer; public $supplier; public $cms; public $checkage_message; public static $definition = array( 'table' => 'checkage', 'primary' => 'id_checkage', 'multilang' => true, 'fields' => array( 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true), 'id_restriction' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'age_restriction' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'format_date' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'show_logo' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'all_restriction' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'best_sales' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'new_products' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'discount' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'supplier' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'cms' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'checkage_message' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'), ) ); public static function getByIdShop($id_shop) { $sql = 'SELECT `id_checkage` FROM `'._DB_PREFIX_.'checkage` WHERE `id_shop` ='.(int)$id_shop.''; $id = Db::getInstance()->getValue($sql); return new CheckageClass($id); } public function copyFromPost() { foreach ($_POST as $key => $value) { if (key_exists($key, $this) && $key != 'id_'.$this->table) { $this->{$key} = Tools::getValue($key); } } if (count($this->fieldsValidateLang)) { $languages = Language::getLanguages(false); foreach ($languages as $language) { foreach ($this->fieldsValidateLang as $field => $validation) { if (Tools::getIsset($field.'_'.(int)$language['id_lang'])) { $this->{$field}[(int)$language['id_lang']] = Tools::getValue($field.'_'.(int)$language['id_lang']); } } } } } }