1 hour ago, D. Tengler said:Just add the condition to PaymentModule.php
search // updates stock in shops and add condition for customer group.
find:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $update_stock_ === true) { $product_list = $order->getProducts(); foreach ($product_list as $product) { // if the available quantities depends on the physical stock if (StockAvailable::dependsOnStock($product['product_id'])) { // synchronizes StockAvailable::synchronize($product['product_id'], $order->id_shop); } } }
replace:
(change id_group == 3 to you group)
$customer = new Customer((int) $order->id); if ($customer->id_group == 3) {$update_stock_ = true;} else {$update_stock_ = false;} // updates stock in shops if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && ($update_stock_ === true)) { $product_list = $order->getProducts(); foreach ($product_list as $product) { // if the available quantities depends on the physical stock if (StockAvailable::dependsOnStock($product['product_id'])) { // synchronizes StockAvailable::synchronize($product['product_id'], $order->id_shop); } } }
are you sure you get the correct id_group in this way and not
$customer = new Customer(intval($cookie->id_customer));
?
ALSO: prestashop crashes when I try to complete the order with that code
.png.022b5452a8f28f552bc9430097a16da2.png)