i have website in opencart order id jumping up. means if person has order on website , order id 49 order id of next order should 50 shown 51 or 52. when check in database table oc_order shown same order missing order no.
class modelcheckoutorder extends model { public function addorder($data) { $this->db->query("insert `" . db_prefix . "order` set invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', emp_name = '" . $this->db->escape($data['emp_name']) . "', emp_id = '" . $this->db->escape($data['emp_id']) . "', email = '" . $this->db->escape($data['email']) . "', mobile_no = '" . $this->db->escape($data['mobile_no']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_emp_name = '" . $this->db->escape($data['payment_emp_name']) . "', payment_emp_id = '" . $this->db->escape($data['payment_emp_id']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_emp_name = '" . $this->db->escape($data['shipping_emp_name']) . "', shipping_emp_id = '" . $this->db->escape($data['shipping_emp_id']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = now(), date_modified = now()"); $this->db->query("insert " . db_prefix . "order_history set order_id = '" . (int)$order_id . "', order_status_id = '" . (int)$order_status_id . "', notify = '1', comment = '" . $this->db->escape(($comment && $notify) ? $comment : '') . "', date_added = now()"); $order_product_query = $this->db->query("select * " . db_prefix . "order_product order_id = '" . (int)$order_id . "'"); foreach ($order_product_query->rows $order_product) { $this->db->query("update " . db_prefix . "product set quantity = (quantity - " . (int)$order_product['quantity'] . ") product_id = '" . (int)$order_product['product_id'] . "' , subtract = '1'"); $order_option_query = $this->db->query("select * " . db_prefix . "order_option order_id = '" . (int)$order_id . "' , order_product_id = '" . (int)$order_product['order_product_id'] . "'"); foreach ($order_option_query->rows $option) { $this->db->query("update " . db_prefix . "product_option_value set quantity = (quantity - " . (int)$order_product['quantity'] . ") product_option_value_id = '" . (int)$option['product_option_value_id'] . "' , subtract = '1'"); } }
this because there difference between see in database , see in orders admin page. , difference due fact opencart stores called missing order id, , happens example 1 fills details , mistake reloads checkout page , press "confirm" button. @ case example in orders admin page booked 2 orders number , see second number - ofc number of order ids skipped same number of missing orders stored opencart itself.
if want test go checkout page , fill orders , confirm it, @ case wont see difference, if go checkout page fill info , reload page , press confirm see order id skip 1 number.
in opencart database wont see missing order ids, because opencart insert order in database if confirmed.