Jump to content

Edit History

tommiwtf

tommiwtf

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

tommiwtf

tommiwtf

51 minutes 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));

?
 

×
×
  • Create New...