- $allready_on_order = 0;
-
- foreach ($order->line_items as $order_item)
- {
- if (strcasecmp($order_item->stock_id, $new_item) == 0)
- {
- $allready_on_order = 1;
- display_error(_("For Part :") . $new_item . " " . "This item is already on this order. You can change the quantity ordered of the existing line if necessary.");
- }
- }
-
- if ($allready_on_order != 1)
- {
- $order->add_to_cart ($new_item, $new_item_qty, $standard_cost);
- } /* end of if not already on the order */
+ if ($order->find_cart_item($new_item))
+ display_error(_("For Part :") . $new_item . " " . "This item is already on this order. You can change the quantity ordered of the existing line if necessary.");
+ else
+ $order->add_to_cart (count($order->line_items), $new_item, $new_item_qty, $standard_cost);