* @copyright 2010-2022 Webkul IN * @license https://store.webkul.com/license.html */ class CartCustomerGuestDetailCore extends ObjectModel { public $id_customer_guest_detail; public $id_cart; public $id_gender; public $firstname; public $lastname; public $email; public $phone; public $date_add; public $date_upd; public static $definition = array( 'table' => 'cart_customer_guest_detail', 'primary' => 'id_customer_guest_detail', 'fields' => array( 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), 'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 128), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ), ); public static function getCartCustomerGuest($id_cart) { return Db::getInstance()->getValue(' SELECT `id_customer_guest_detail` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` WHERE `id_cart` = '.(int)$id_cart ); } public static function getCustomerGuestDetail($id_customer_guest_detail) { return Db::getInstance()->getRow(' SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail ); } public function validateGuestInfo() { $isValid = true; if (!trim($this->firstname) || !Validate::isName($this->firstname)) { $isValid = false; } if (!trim($this->lastname) || !Validate::isName($this->lastname)) { $isValid = false; } if (!trim($this->email) || !Validate::isEmail($this->email)) { $isValid = false; } if (!trim($this->phone) || !Validate::isPhoneNumber($this->phone)) { $isValid = false; } return $isValid; } }