lordmicro Posted January 6, 2014 Share Posted January 6, 2014 (edited) Здравствуйте. Использую систему расширенного управления запасами. Версия PrestaShop 1.5.6.1, но проблема была и в 1.5.4.1.Нашёл проблему, что при добавлении и удалении товаров из заказа не происходит синхронизация остатков.Проблему не решил, но изолировал.Мой diff для controllers/admin/AdminOrdersController.php: [spam-filter] -1743,6 +1743,14 [spam-filter] // Get the last product $product = end($products); + + // synchronizes quantities if needed.. + if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) + { + StockAvailable::synchronize($order_detail->product_id, (int)$order_detail->id_shop); + $product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($order_detail->product_id, $order_detail->product_attribute_id, (int)$order_detail->id_shop); + } + $resume = OrderSlip::getProductSlipResume((int)$product['id_order_detail']); $product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity']; $product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl']; [spam-filter] -2062,6 +2070,12 [spam-filter] // Reinject quantity in stock $this->reinjectQuantity($order_detail, $order_detail->product_quantity); + // synchronizes quantities if needed.. + if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) + { + $product_id = (int)$order_detail->product_id; + } + // Delete OrderDetail $res &= $order_detail->delete(); [spam-filter] -2075,6 +2089,13 [spam-filter] $order->weight = sprintf("%.3f ".Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight); } + // synchronizes quantities if needed.. + if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) + { + if (StockAvailable::dependsOnStock($product_id)) + StockAvailable::synchronize($product_id, (int)$order->id_shop); + } + if (!$res) die(Tools::jsonEncode(array( 'result' => $res, Суть изменений: обновляю остатки после добавления товара к заказу и после удаления товара из заказа. For English users topic here. Edited January 6, 2014 by lordmicro (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now