Topic: Sales Order - quantity stays at zero FOR 2.1
I'm not sure whether you want these on Mantis or not - but Mantis has no 2.1 section, so I'll post it here.
When you enter a sales order, regardless of what you put in the quantity, it remains zero when you add the line. The total stays $0.00 too. I think this is because on the table item_codes, the quantity for products is always zero.
I debugged it and found that when you add a new item, items_db.inc calls
add_item_code($stock_id, $stock_id, $description, 1, 0);
However, in item_codes_db.inc, this results in the $qty being passed in as zero. This ends up on the database.
When you add an item to a sales order now, it's always zeroed out because of the code in sales_order_ui.inc at lines 40 or 65:
$order->add_to_cart (count($order->line_items), $item['stock_id'],$new_item_qty*$item['quantity'], $item_price, $discount);
It's the $new_item_qty * $item['quantity'] that's the problem. $item['quantity'] is always zero.
I'm not 100% sure what you're getting at with this code, but I suspect maybe you meant:
add_item_code($stock_id, $stock_id, $description, $category_id, 1, 0);
on line 44 of items_db.inc.
ie. you forgot to pass the $category_id parameter in.
When I make this change, it looks like everything works ok again on sales orders.
Cheers
Pete