karxix Posted January 10, 2020 Share Posted January 10, 2020 Hello I added in /public_html/override/controllers/front the file OrderController.php with the below code to be able to redirect user to cart on re-order (instead of checkout page), but it does not seem to be working, it only works when I edit the core file (I tried clearing cache from the var folder and from backoffice) What could be the issue? <?php // I tried "class OrderController" as well class OrderControllerOverride extends OrderControllerCore { /* * roy: to redirect to cart on reorder */ public function postProcess() { die("A"); parent::postProcess(); if (Tools::isSubmit('submitReorder') && $id_order = (int) Tools::getValue('id_order')) { $oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id)); $duplication = $oldCart->duplicate(); if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) { $this->errors[] = $this->trans('Sorry. We cannot renew your order.', array(), 'Shop.Notifications.Error'); } elseif (!$duplication['success']) { $this->errors[] = $this->trans( 'Some items are no longer available, and we are unable to renew your order.', array(), 'Shop.Notifications.Error' ); } else { $this->context->cookie->id_cart = $duplication['cart']->id; $context = $this->context; $context->cart = $duplication['cart']; CartRule::autoAddToCart($context); $this->context->cookie->write(); Tools::redirect('cart?action=show'); // redirect to cart instead of order page } } $this->bootstrap(); } } Link to comment Share on other sites More sharing options...
musicmaster Posted January 16, 2020 Share Posted January 16, 2020 Did you delete class_index.php? Link to comment Share on other sites More sharing options...
tomerg3 Posted January 16, 2020 Share Posted January 16, 2020 In some PS version you need to delete that file (in /cache) folder, and others you can simply hit the clear cache button from the performance page Link to comment Share on other sites More sharing options...
karxix Posted January 17, 2020 Author Share Posted January 17, 2020 hello, I have done both the above, (cache, var/cache/ and back office clear cache), none worked Link to comment Share on other sites More sharing options...
tomerg3 Posted January 17, 2020 Share Posted January 17, 2020 When you call parent::postProcess(); you are calling the same function you are trying to override. Replace "parent" with the class that OrderControllerCore extends 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