pranab13 Posted March 27, 2017 Share Posted March 27, 2017 (edited) Hi, I have a Prestashop B2B website 1.6.1.10 linked to an ERP system so all the products, clients and other flows are coming in and out from this ERP system. Customers are ordering on the prestashop website and paying after and not on the plateform so no check, no bank transfer... nothing. For that I made a module that allows them not to pay and to pass directly the order. (I copied the cheque module and adapt the wording and order status). Also customers are allowed to order products even though they are out of stock. We have someone making a connector between the ERP and our Prestashop website so it imports and exports flows from one plateform to the other. The person is saying that for the connector to work, the order state has to be the "Payment accepted" one of Prestashop (the second order status). That way the order goes into the ERP when exporting the flows from Prestashop into the ERP. I don't know how to manage to put only this state. Did someone already do that on a Prestashop? Can we tell Prestashop: put "Payment accepted" whatever the order state is? When a customer orders products on stock the order state is the one I created with the copied check module "Payment accepted" instead of Awaiting check payment" with the order_state id 1) but as I didn't know at first that it had to be the prestashop order_state id 2 "Payment accepted", the order doesn't flow on the ERP. When customers are ordering products out of stock, the state is "On backorder (paid)", that's why I only need the "Payment accepted" and not the other states. Can we deactivate them except the order state id 2 ? I don't know where to find that and what to edit so that it can so that. Thank you for your replies. Edited March 27, 2017 by pranab13 (see edit history) Link to comment Share on other sites More sharing options...
pranab13 Posted March 27, 2017 Author Share Posted March 27, 2017 I found a solution for one of my problems : When I copied the cheque module that I named confirmedpayment, I created PS_OS_CONFIRMEDPAYMENT on config.inc.php. In order to change the status of the order to payment accepted with that module, I had to change this bit of code on the modules/confirmedpayment/validation.php and modules/confirmedpayment/controllers/front/validation.php $confirmedpayment->validateOrder((int)$cart->id, Configuration::get('PS_OS_CONFIRMEDPAYMENT'), $total, $confirmedpayment->displayName, NULL, array(), (int)$currency->id, false, $customer->secure_key); replaced by $confirmedpayment->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $confirmedpayment->displayName, NULL, array(), (int)$currency->id, false, $customer->secure_key); And on modules/confirmedpayment/confirmedpayment.php on line 164 I replaced the PS_OS_CONFIRMEDPAYMENT by PS_OS_PAYMENT : if (in_array($state, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_OUTOFSTOCK_UNPAID')))) That way the status is Payment accepted ! But when a customer orders a product that is out of stock, the status is still On backorder (paid), how do I change that? Since it's not a module and it won't be like the first solution. Link to comment Share on other sites More sharing options...
pranab13 Posted March 27, 2017 Author Share Posted March 27, 2017 Found a solution for the second problem but can someone tell me if the previous solution and the following are good and aren't going to mess up something ? On classes/PaymentModule.php line 689, the code was $history->changeIdOrderState(Configuration::get($order->valid ? 'PS_OS_OUTOFSTOCK_PAID' : 'PS_OS_OUTOFSTOCK_UNPAID'), $order, true); and I changed it to $history->changeIdOrderState(Configuration::get($order->valid ? 'PS_OS_PAYMENT' : 'PS_OS_PAYMENT'), $order, true); and now the backorder status is changed to payment accepted. I would like your opinion on those solutions before marking the problem as solve, please. 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