'postaldeliv', 'primary' => 'id_postaldeliv', 'fields' => array( 'id_carrier' => array('type' => self::TYPE_INT), 'country' => array('type' => self::TYPE_STRING), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'county' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'range' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'available' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ), ); public function delete() { parent::delete(); Db::getInstance()->delete('postaldeliv_shop', 'id_postaldeliv = '.(int)$this->id); return true; } public function getShops() { $id_shops = Db::getInstance()->executeS('SELECT `id_shop` FROM `'._DB_PREFIX_.'postaldeliv_shop` WHERE `id_postaldeliv` = '.(int)$this->id); $results = array(); foreach ($id_shops as $id_shop) { $results[] = $id_shop['id_shop']; } return $results; } public function saveShops($shop) { Db::getInstance()->delete('postaldeliv_shop', 'id_postaldeliv = '.(int)$this->id); $id_shops = array(); if (Shop::isFeatureActive()) { if (empty($shop) || $shop == 0 || $shop == array(0) || in_array(0, $shop)) { $shop = Shop::getCompleteListOfShopsID(); } foreach ($shop as $id_shop) { $id_shops[] = array('id_postaldeliv' => (int)$this->id, 'id_shop' => (int)$id_shop); } } else { $id_shops[] = array('id_postaldeliv' => (int)$this->id, 'id_shop' => (int)$shop); } Db::getInstance()->insert('postaldeliv_shop', $id_shops); return true; } }