_devis_id; } public function get_total() { return $this->_total; } public function get_customer_id() { return $this->_customer_id; } public function get_customer_name() { return $this->_customer_name; } public function get_customer_company() { return $this->_customer_company; } public function get_customer_street_adress() { return $this->_customer_street_adress; } public function get_customer_city() { return $this->_customer_city; } public function get_customer_postcode() { return $this->_customers_postcode; } public function get_customer_state() { return $this->_customer_state; } public function get_customer_country() { return $this->_customer_country; } public function get_customer_telephone() { return $this->_customers_telephone; } public function get_customer_email_adress() { return $this->_customers_email_adress; } public function get_customer_adress_format_id() { return $this->_customers_adress_format_id; } public function get_delivery_name() { return $this->_delivery_name; } public function get_delivery_company() { return $this->_delivery_company; } public function get_delivery_street_adress() { return $this->_delivery_street_adress; } public function get_delivery_city() { return $this->_delivery_city; } public function get_delivery_postcode() { return $this->_delivery_postcode; } public function get_delivery_state() { return $this->_delivery_state; } public function get_delivery_country() { return $this->_delivery_country; } public function get_delivery_address_format_id() { return $this->_delivery_address_format_id; } public function get_validity_date() { return $this->_validity_date; } public function get_shipping_cost() { return $this->_shipping_cost; } public function get_devis_status() { return $this->_devis_status; } public function get_comment() { return $this->_comment; } public function set_devis_id($id) { return $this->_devis_id= $id; } public function set_customer_id($id) { return $this->_customer_id=$id; } public function set_customer_name($name) { return $this->_customer_name=$name; } public function set_customer_company($company) { return $this->_customer_company=$company; } public function set_customer_street_adress($adress) { return $this->_customer_street_adress=$adress; } public function set_customer_city($city) { return $this->_customer_city=$city; } public function set_customer_postcode($postcode) { return $this->_customers_postcode=$postcode; } public function set_customer_state($state) { return $this->_customer_state=$state; } public function set_customer_country($country) { return $this->_customer_country = $country; } public function set_customer_telephone($phone) { return $this->_customers_telephone=$phone; } public function set_customer_email_adress($email) { return $this->_customers_email_adress=$email; } public function set_customer_adress_format_id($adress_format_id) { return $this->_customers_adress_format_id=$adress_format_id; } public function set_delivery_name($name) { return $this->_delivery_name=$name; } public function set_delivery_company($company) { return $this->_delivery_company=$company; } public function set_delivery_street_adress($adress) { return $this->_delivery_street_adress=$adress; } public function set_delivery_city($city) { return $this->_delivery_city=$city; } public function set_delivery_postcode($postcode) { return $this->_delivery_postcode=$postcode; } public function set_delivery_state($state) { return $this->_delivery_state=$state; } public function set_delivery_country($country) { return $this->_delivery_country=$country; } public function set_delivery_address_format_id($adress_format_id) { return $this->_delivery_address_format_id=$adress_format_id; } public function set_validity_date($date) { return $this->_validity_date=$date; } public function set_shipping_cost($cost) { return $this->_shipping_cost=$cost; } public function set_devis_status($statut) { return $this->_devis_status=$statut; } public function set_comment($comment) { return $this->_comment=$comment; } public function add_product($product) { return $this->_products[]=$product; } public function get_product() { return $this->_products; } public function set_total($total) { return $this->_total=$total; } public function insert_devis(){ $query = array( 'customers_name'=>$this->_customer_name, 'customers_id '=>$this->_customer_id, 'customers_street_address'=>$this->_customer_street_adress, 'customers_city'=>$this->_customer_city, 'customers_postcode'=>$this->_customers_postcode, 'customers_state'=>$this->_customers_state, 'customers_country'=>$this->_customer_country, 'customers_telephone'=>$this->_customers_telephone, 'customers_email_address'=>$this->_customers_email_adress, 'delivery_name'=>$this->_delivery_name, 'delivery_street_address'=>$this->_delivery_street_adress, 'delivery_city'=>$this->_delivery_city, 'delivery_postcode'=>$this->_delivery_postcode, 'delivery_state'=>$this->_delivery_state, 'delivery_country'=>$this->_delivery_country, 'delivery_address_format_id'=>$this->_delivery_address_format_id, 'validity_date'=>$this->_validity_date, 'shipping_cost'=>$this->_shipping_cost, 'devis_status'=>$this->_devis_status, 'comment'=>$this->_comment, 'customers_company'=>$this->_customer_company, 'customers_company_shipping'=>$this->_delivery_company, 'total'=>$this->_total ); tep_db_perform('devis', $query); $id_devis =tep_db_insert_id(); foreach ($this->_products as $key => $value) { $product_query = array( 'devis_id' => $id_devis, 'products_model'=>$this->_products[$key]->get_model(), 'products_name'=>$this->_products[$key]->get_name(), 'products_price'=>$this->_products[$key]->get_price(), 'products_quantity'=>$this->_products[$key]->get_qty(), 'products_tax'=>$this->_products[$key]->get_tax_rate(), 'final_price'=>$this->_products[$key]->get_qty()*$this->_products[$key]->get_price() ); tep_db_perform('devis_products', $product_query); } } public function update_devis($id) { $query = array( 'devis_id'=>(int)$id, 'customers_name'=>$this->_customer_name, 'customers_id '=>$this->_customer_id, 'customers_street_address'=>$this->_customer_street_adress, 'customers_city'=>$this->_customer_city, 'customers_postcode'=>$this->_customers_postcode, 'customers_state'=>$this->_customers_state, 'customers_country'=>$this->_customer_country, 'customers_telephone'=>$this->_customers_telephone, 'customers_email_address'=>$this->_customers_email_adress, 'delivery_name'=>$this->_delivery_name, 'delivery_street_address'=>$this->_delivery_street_adress, 'delivery_city'=>$this->_delivery_city, 'delivery_postcode'=>$this->_delivery_postcode, 'delivery_state'=>$this->_delivery_state, 'delivery_country'=>$this->_delivery_country, 'delivery_address_format_id'=>$this->_delivery_address_format_id, 'validity_date'=>$this->_validity_date, 'shipping_cost'=>$this->_shipping_cost, 'devis_status'=>$this->_devis_status, 'comment'=>$this->_comment, 'customers_company'=>$this->_customer_company, 'customers_company_shipping'=>$this->_delivery_company, 'total'=>$this->_total ); tep_db_perform('devis', $query,'update','devis_id ="'.(int)$id.'"'); $delete_product = tep_db_query('DELETE from devis_products WHERE devis_id="'.(int)$id.'"'); foreach ($this->_products as $key => $value) { $product_query = array( 'devis_id' => (int)$id, 'products_model'=>$this->_products[$key]->get_model(), 'products_name'=>$this->_products[$key]->get_name(), 'products_price'=>$this->_products[$key]->get_price(), 'products_quantity'=>$this->_products[$key]->get_qty(), 'products_tax'=>$this->_products[$key]->get_tax_rate(), 'final_price'=>$this->_products[$key]->get_qty()*$this->_products[$key]->get_price() ); tep_db_perform('devis_products', $product_query); } } } ?>