public function add($autodate = true, $null_values = false) { $res = parent::add($autodate, $null_values); if ($res && (int) $this->id_employee > 0) { Db::getInstance()->insert('order_detail_employee', array('id_employee' => (int) $this->id_employee, 'id_order_detail' => (int) $this->id)); } return $res; }
function add($autodate = true, $null_values = false) { parent::add($autodate, $null_values); $order = new Order($this->id_order); if (!empty($order->id_cart)) { $res = Db::getInstance()->executeS('SELECT `delivery_date`, `delivery_time_from`, `delivery_time_to` ' . 'FROM ' . _DB_PREFIX_ . 'cart_product ' . 'WHERE `id_cart` = ' . (int) $order->id_cart . ' AND `id_product` = ' . (int) $this->product_id . ' AND `id_product_attribute` = ' . (int) $this->product_attribute_id . ' AND `id_shop` = ' . (int) $this->id_shop . ' ' . 'LIMIT 1'); if (!empty($res)) { $res = $res[0]; if (!empty($res)) { $res = Db::getInstance()->executeS('UPDATE ' . _DB_PREFIX_ . 'order_detail SET ' . '`delivery_date` = \'' . $res['delivery_date'] . '\', `delivery_time_from` = \'' . $res['delivery_time_from'] . '\', `delivery_time_to` = \'' . $res['delivery_time_to'] . '\' ' . 'WHERE `id_order` = ' . (int) $this->id_order . ' AND `product_id` = ' . (int) $this->product_id . ' AND `product_attribute_id` = ' . (int) $this->product_attribute_id . ' AND `id_shop` = ' . (int) $this->id_shop . ' '); } } } }