I am not sure this a bug or I am not understanding how the missing order is suppose to work
I just noticed when I deleted my missing orders it add back all the quantities which it should if it deducted them but it turns out the quantities are at more than what I actually started with. I would think if the order never got placed it shouldn't pull quantities from the item or add them back when I clear the missing order section . So has anyone else experience this
I just noticed when I deleted my missing orders it add back all the quantities which it should if it deducted them but it turns out the quantities are at more than what I actually started with. I would think if the order never got placed it shouldn't pull quantities from the item or add them back when I clear the missing order section . So has anyone else experience this
Weird, I dont seem to have this problem. I have alot of missing orders, as I have been coding a payment module, but it doesn't seem like it touches the quantity.
Do you have any contributions installed?
Do you have any contributions installed?
Request Reviews v1.0 released.
Hi again,
I did some testing, and I DO have this problem, if "Stock Subtract" is enabled under Settings. Hmm, I'll look into it later.
I did some testing, and I DO have this problem, if "Stock Subtract" is enabled under Settings. Hmm, I'll look into it later.
Request Reviews v1.0 released.
Open this file: admin/model/customer/order.php
Find this at around line 53:
Replace with:
Find this, at around line 122:
Replace with:
That should do the trick. Please let me know if you run into problems. I just tested it quickly, and it seems to work.
Find this at around line 53:
Code: Select all
if ($this->config->get('config_stock_subtract')) {
foreach($products as $product) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
}
}
Code: Select all
if ($this->config->get('config_stock_subtract')) {
foreach($products as $product) {
if ($product['order_status_id'] != 0) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
}
}
}
Code: Select all
public function getOrderProducts($order_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
return $query->rows;
}
Code: Select all
public function getOrderProducts($order_id) {
$query = $this->db->query("SELECT op.*, o.order_id, o.order_status_id FROM " . DB_PREFIX . "order_product op, " . DB_PREFIX . "order o WHERE op.order_id='" . (int)$order_id ."' AND op.order_id = o.order_id");
return $query->rows;
}
Last edited by dbstr on Mon Sep 07, 2009 3:02 am, edited 1 time in total.
Request Reviews v1.0 released.
I changed the code and when I went to log in into the admin i get and error:
Parse error: syntax error, unexpected T_PUBLIC in /hermes/web09/b2036/xxxxxxx/htdocs/shop/admin/model/customer/order.php on line 61
Parse error: syntax error, unexpected T_PUBLIC in /hermes/web09/b2036/xxxxxxx/htdocs/shop/admin/model/customer/order.php on line 61
Could you paste line 61, and the 10 lines above it?
But I'm pretty sure it's because you miss a } somewhere near line 60.
But I'm pretty sure it's because you miss a } somewhere near line 60.

Request Reviews v1.0 released.
here is line 51 - 61:
$this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "'");
if ($this->config->get('config_stock_subtract')) {
foreach($products as $product) {
if ($product['order_status_id'] != 0) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
}
}
}
public function getOrder($order_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "'");
if ($this->config->get('config_stock_subtract')) {
foreach($products as $product) {
if ($product['order_status_id'] != 0) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
}
}
}
public function getOrder($order_id) {
Code: Select all
$this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "'");
if ($this->config->get('config_stock_subtract')) {
foreach($products as $product) {
if ($product['order_status_id'] != 0) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
}
}
}
}
public function getOrder($order_id) {

Request Reviews v1.0 released.
I can now log in but when i go to order section in admin I get an error when I click on the order : The error is :
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order o WHERE op.order_id='155' AND op.order_id = o.order_id' at line 1
Error No: 1064
SELECT op.*, o.order_status_id FROM order_product op, order o WHERE op.order_id='155' AND op.order_id = o.order_id
I checked my completed orders and they have a similar error
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order o WHERE op.order_id='155' AND op.order_id = o.order_id' at line 1
Error No: 1064
SELECT op.*, o.order_status_id FROM order_product op, order o WHERE op.order_id='155' AND op.order_id = o.order_id
I checked my completed orders and they have a similar error
Ok. Could you tell me your mysql version?
And you should probably undo the changes, till I got a fix for you. >:(
And you should probably undo the changes, till I got a fix for you. >:(
Request Reviews v1.0 released.
We figured it out in private messages.
Should others run into the same problem, add `` around the database tables in the getOrderProducts sql query.
It's simply because ORDER is a reserved SQL word, and if you dont use prefixed tables it will cause an error. My bad, no-brainer...
Should others run into the same problem, add `` around the database tables in the getOrderProducts sql query.
Code: Select all
public function getOrderProducts($order_id) {
$query = $this->db->query("SELECT op.*, o.order_id, o.order_status_id FROM `" . DB_PREFIX . "order_product` op, `" . DB_PREFIX . "order` o WHERE op.order_id='" . (int)$order_id ."' AND op.order_id = o.order_id");
return $query->rows;
}
Request Reviews v1.0 released.
Who is online
Users browsing this forum: No registered users and 20 guests