c64girl Posted October 10, 2022 Share Posted October 10, 2022 Has anyone perhaps done such a change so that when a customer returns a product, the order status also changes? When i accept return in "Merchandise Return" the status of return change but the order is the same. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted October 11, 2022 Share Posted October 11, 2022 Sorry the requested changes is not provided by the Prestashop default, as the order status doesnt changes. That can on be possible after making changes in core files. You can hire a developer for the same who can customize this by modifying the code code for you. Link to comment Share on other sites More sharing options...
c64girl Posted October 12, 2022 Author Share Posted October 12, 2022 17 hours ago, Knowband Plugins said: Sorry the requested changes is not provided by the Prestashop default, as the order status doesnt changes. That can on be possible after making changes in core files. You can hire a developer for the same who can customize this by modifying the code code for you. I am not asking it is possible by default. I know its not. I am asking if someone done that changes and can share how to. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted October 12, 2022 Share Posted October 12, 2022 You can add the below code in "controllers\admin\AdminReturnController.php" , postProcess(), above"if (Tools::isSubmit('submitAddorder_returnAndStay')) {" Code need to added : $kb_order_obj = new Order($orderReturn->id_order); $history = new OrderHistory(); $history->id_order = $kb_order_obj->id; $history->id_employee = (int) $this->context->employee->id; $use_existings_payment = false; if (!$kb_order_obj->hasInvoice()) { $use_existings_payment = true; } $history->changeIdOrderState((int) Configuration::get('PS_OS_CANCELED'), $kb_order_obj, $use_existings_payment); //code to update the order status to "Cancelled" Note that the whole order is treated as cancelled $carrier = new Carrier($kb_order_obj->id_carrier, $kb_order_obj->id_lang); $templateVars = array(); if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $kb_order_obj->shipping_number ) { $templateVars = array( '{followup}' => str_replace('@', $kb_order_obj->shipping_number, $carrier->url) ); } // Save all changes if ($history->addWithemail(true, $templateVars)) { //Code to send the respective mails for cancelled order to customer // synchronizes quantities if needed.. if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { foreach ($kb_order_obj->getProducts() as $product) { if (StockAvailable::dependsOnStock($product['product_id'])) { StockAvailable::synchronize( $product['product_id'], (int) $product['id_shop'] ); } } } } Link to comment Share on other sites More sharing options...
c64girl Posted October 13, 2022 Author Share Posted October 13, 2022 (edited) Working with no problem, status is changed automaticly to canceled. Edited October 13, 2022 by c64girl (see edit history) Link to comment Share on other sites More sharing options...
c64girl Posted October 13, 2022 Author Share Posted October 13, 2022 (edited) One more question. Is it possible to somehow modify the code to automatically change the status in Merchandise Return to Waiting for package? As soon as the customer sets the merchandise return? Of course, along with this would go changing the status of the customer to cancelled. Edited October 13, 2022 by c64girl (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