BabsD Posted March 2, 2017 Share Posted March 2, 2017 This functionality just stopped working and I don't know why. I am using Prestashop 1.6.1.11. Case: someone ordered, paid via PayPal, I got the payment, but the order was not closed in prestashop. Usually I went to Abandoned carts, looked for that non ordered cart cart, clicked on it. Then I used the button "Create an order from this cart" Then I could search again for the customer and the product list of this cart was loaded automatically. Now, nothing happens. I search for a customer, find it. Click choose customer, nothing happens, The product list below is empty. If I try to search for a product and then click "add to cart" nothing happens. I would be very grateful if someone could tell me what's going on suddenly? Link to comment Share on other sites More sharing options...
adolleschal Posted March 2, 2017 Share Posted March 2, 2017 (edited) we did already hours of debugging and found that the problem lies in the function displayAjaxSearchCarts() in controllers/admin/AdminCartsController.php the array $to_return which needs to be converted into a JSON String has recursive objects (object cart has object context which has object cart) in it, which results in an empty string from Tools::jsonEncode any ideas why? Edited March 2, 2017 by adolleschal (see edit history) Link to comment Share on other sites More sharing options...
SophieB Posted March 4, 2017 Share Posted March 4, 2017 Hello, I had exacttly the same problem, and I also made hours of debugging This is what I found: - I had an override of the Cart.php class, which was added by the module Freedelivery - I didn't have the bug when I the override was not present (I renamed it __Cart.php). Disabling the module was not enough... - I had the bug when the php version was 5.5 or more, but didn't have the bug with php 5.4 => I found out that the override of the function getSummaryDetails() caused the bug, this part of code precisely: if (!isset($this->context)) $this->context = Context::getContext(); if (!$this->context->cart) return $summary; It added a new entry 'context' in the entry 'cart' of the array returned by the function ajaxReturnVars() called by displayAjaxSearchCarts() in AdminCartsController.php This caused the bug when the array was passed to Tools::jsonEncode() function.... I asked the developper of the module if the part of code could be omitted, but unfortunetely I had no answer from him... I'm not skilled enough in Prestashop development to know what these lines are for... So for the moment I just set php 5.4 version, but I think it can only be a temporary solution. I hope it can help you, and would be glad if you would find the solution... Best regards Sophie Link to comment Share on other sites More sharing options...
adolleschal Posted March 4, 2017 Share Posted March 4, 2017 Hello, it was indeed an override of the class Cart.php (don't know from which module). This new Class added Context again to the Cart Class, i just commented the inclusion of context in the override class and then it worked again. And, yes the problems started after we upgraded from php 5.4 to php 7 (all version > 5.4 had the same issue, i tried all of them ). Best regards Andy Link to comment Share on other sites More sharing options...
igis Posted April 10, 2017 Share Posted April 10, 2017 Hi Andy, could you please explain what did you change ? Thanks!! Regards, Igor Link to comment Share on other sites More sharing options...
Alithrarion Posted October 4, 2017 Share Posted October 4, 2017 Hi, I have the same problem with PS 1.7.1.2, PHP version 5.6.30, Apache server and classic theme. If I try to downgrade PHP version to 5.4 I become a 500 http error (in BO too). I've tried to apply the modification descripted in this thread https://www.prestashop.com/forums/topic/606477-customers-search-doesnt-work-when-adding-order-from-back-office/ but it doesen't works. I'm desperate, I do not know how to fix it. Does anyone know how to fix it? Regards, Matteo 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