akasht94 Posted March 11, 2017 Share Posted March 11, 2017 Hello devs, Is there any way through which I can restore the cart of a Prestashop 1.6+ through order ID or order details.It would be like reorder function which we used after payment is done or failed when orders created. I have order details and I just want to trigger the re-order function or something like that through which Cart restores. Any suggestion would be a great help for me. Thanks in advance. Link to comment Share on other sites More sharing options...
NemoPS Posted March 12, 2017 Share Posted March 12, 2017 What about thisCart::getCartIdByOrderId($idOrder)Then using that id instantiate a new cart, remove the id and save it, it's like a cloneWhat do you need to do with the cart? 1 Link to comment Share on other sites More sharing options...
akasht94 Posted March 14, 2017 Author Share Posted March 14, 2017 Hi NemoPs, Thanks for your reply. Actually, This will return the cart id. I already have a cart id. How I can initiate the same cart with that id.I want to restore the cart if the payments fail or cancelled by user or if the person clicked a back button without completing the payment. I have achieved this on magento but not able to implement this with my module in PrestaShop. After validating the order, Cart empties but it should be restored if a Payment failed or cancelled for the user's suitability. Link to comment Share on other sites More sharing options...
NemoPS Posted March 15, 2017 Share Posted March 15, 2017 Ah, in that case just use $this->context->cart = new Cart($id_cart);Then $this->context->cookie->id_cart = $id_cart;Should work in the front Link to comment Share on other sites More sharing options...
akasht94 Posted March 15, 2017 Author Share Posted March 15, 2017 Thanks, I have implemented the same stuff but in a different manner.I used a duplicate() of PrestaShop to populate the cart with the same item.I am marking it as solved. Link to comment Share on other sites More sharing options...
Navid59 Posted February 23, 2021 Share Posted February 23, 2021 On 3/15/2017 at 11:39 AM, NemoPS said: Ah, in that case just use $this->context->cart = new Cart($id_cart); Then $this->context->cookie->id_cart = $id_cart; Should work in the front Hello @NemoPS I'm new in Prestashop, I used your solution is works I mean without add new order a new card object will create and after set the cookie , it's show's I have an active card, but when I want to see the Items inside of Card, The Card will is EMPTY, again ;-( Any solution, 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