Ali Samie Posted January 15, 2023 Share Posted January 15, 2023 While prestashop provides a page for order settings and specially for order status setting, it does no work as expected. We want our customers to return their products only if it is "Delivered", so I opened order status settings page in back office, and saw that for "Shipped" status we have the "Delivery" flag as active. I disabled this but again when an order is in this status, customer can return products of the order, even they are not arrived and delivered yet! This is the current order status settings This is the current order details page which you can see customer can return products Link to comment Share on other sites More sharing options...
Nickz Posted January 15, 2023 Share Posted January 15, 2023 I think you will need someoutside data to accomplish that. The shipping service has that. Link to comment Share on other sites More sharing options...
Ali Samie Posted January 15, 2023 Author Share Posted January 15, 2023 2 minutes ago, Nickz said: I think you will need someoutside data to accomplish that. The shipping service has that. what do you mean by outside data? like another table? or modification? I think this should already work with the prestashop order status settings. in template file of the order return, there is a flag with this key "is-returnable", which means what it says. But when you look anlt the result, it doesn't work properly Link to comment Share on other sites More sharing options...
Nickz Posted January 15, 2023 Share Posted January 15, 2023 7 minutes ago, Ali Samie said: what do you mean by outside data? like another table? or modification? who has the data once the parcel made it? DHL, Fedex etc.??? Link to comment Share on other sites More sharing options...
Ali Samie Posted January 15, 2023 Author Share Posted January 15, 2023 2 hours ago, Nickz said: who has the data once the parcel made it? DHL, Fedex etc.??? we do the delivery on our own. we do not use any services Link to comment Share on other sites More sharing options...
Nickz Posted January 15, 2023 Share Posted January 15, 2023 4 minutes ago, Ali Samie said: we do the delivery on our own. we do not use any services Ok than you can manually enter that data. Link to comment Share on other sites More sharing options...
bera_ramazan Posted January 15, 2023 Share Posted January 15, 2023 please edit themes/x/templates/custumer/_partials/order-detail-return.tpl add this code {if $order.history.current.id_order_state == 5} XXX {/if} add these if columns to the field you want to hide Link to comment Share on other sites More sharing options...
Ali Samie Posted January 16, 2023 Author Share Posted January 16, 2023 9 hours ago, bera_ramazan said: please edit themes/x/templates/custumer/_partials/order-detail-return.tpl add this code {if $order.history.current.id_order_state == 5} XXX {/if} add these if columns to the field you want to hide Thank you this is a quick fix. I see that this issue happens here in this file src/Adapter/Presenter/Order/OrderDetailLazyArray.php /** * Can this order be returned by the client? * * @return bool */ public function isReturnable() { if (Configuration::get('PS_ORDER_RETURN', null, null, $this->id_shop) && $this->isPaidAndShipped()) { return $this->getNumberOfDays(); } return false; } I should apply a fix to this method I guess Link to comment Share on other sites More sharing options...
Ali Samie Posted January 17, 2023 Author Share Posted January 17, 2023 I fixed it with an override in a custom module Here is the override <?php class Order extends OrderCore { /** * Can this order be returned by the client? * * @return bool */ public function isReturnable() { return $this->isDelivered() && parent::isReturnable(); } /** * Checks if the current order status is delivered. * * @return bool */ public function isDelivered() { $order_state = $this->getCurrentOrderState(); if ($order_state->delivery) { return true; } return false; } } 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