It this article we will try to explain the reason behind the “spinning” save button on the product back office, that seems to be bothering merchants since Prestashop 126.96.36.199.
Update: possible Fix on Git
Here is a fix that came out recently, you can try replacing the red lines with green ones, or simply download the file and replace yours:
The issue: Save buttons on the Prestashop Product back office keep spinning (almost) forver
Ever since the release of Prestashop 188.8.131.52, many users of the Prestashop forums have reported the same, big issue that seemed to be affecting all upgraded versions of the software. The fearsome glitch being an absolute catastrophe for merchants, since it made it impossible to save the product page in the back office. Thus, impossible to edit or add products whatsoever.
Given that is one of the worst issues the Prestashop back office ever had, what is the cause of it? I fired an out-of-the-box 184.108.40.206 myself on my localhost and sought for a reasonable explanation: the save button keeps spinning until all tabs are loaded via ajax. This means that until all of them (Information, Prices, Combinations and so on) are fully loaded, it won’t be possible to even save the product. Let’s have a look at a screenshot to better understand what’s going on under the hood while the button is disabled:
Notice how many ajax calls to the same page are performed, with the last one still pending response. Each of them fetches the content of a tab, and it won’t ever be possible to save the page before everything has been loaded.
Unfortunately, the back office being slower and slower the more Prestashop versions are released, the waiting time might become unsustainable. It took 10 seconds on that localhost test, but it can grow up to one minute, or even more, on shared, medium quality hostings.
The reason behind it
In the end, it all comes down to a question: why wasn’t this happening before? Simple: it was indeed possible to save before all tabs had been loaded, however this ended up spawning the well known “Product must be in the default category” or “link_rewrite field is required” errors, which were indeed caused by saving the product form without all the necessary fields having been filled with the required data yet. We can think of the spinning button as a measure to prevent this kind of error.
Troubleshooting the issue
Given that it’s a matter of timing, let’s try to go over some possible fixes that came up in the constantly updating forum thread (Prestashop 220.127.116.11 problem with saving products).
Make sure you also enable error reporting by setting PS_MODE_DEV to true in config/defines.inc.php before even thinking of troubleshooting.
Identifying the source
There are three possible scenarios: a broken entry in the ajax requests queue, that will show up in red (see previous screenshot) in the list mentioned above; a forever pending request; lastly, a really slow request. It is important to understand which of these is preventing the button from being clickable, as the long-term fix will vary depending on it. Make sure you wait a couple of minutes and keep an eye on the following timing column as well:
Once we are relatively sure about the type of issue, how can we find out the source?
First, you can tell the tab name by the url:
In this case, you can see action=Suppliers, so we’re dealing with the suppliers table. If it’s a module, it will be action=Module*ModuleName* without asterisks of course.
In the case of a red entry make sure you check out the ajax response by clicking on the broken url itself, it should give you more insights on what’s wrong with it.
Case 1: Broken Module
The most common source of the error is a broken module. Inspect the name as above, and if it really is a module go ahead and disable it; it should fix the big issue while you figure out the underlying cause.
Case 2: broken product tab
This is worse than the previous, as it can’t be solved by simply disabling a module. Once you are sure it really is a tab (see above), there are multiple things you can do. If it’s a red entry and the response is a Prestashop Exception or PHP error, follow the hints given by the error itself. Common issues might come from:
- A hard-modified AdminProductsController.php
- AdminProductsController.php override
- Broken/incompatible methods coming from other overrides
If you didn’t modify the original controller, you can temporarily disable all overrides by reaching Advanced Parameters > Performance and setting Disable all overrides to yes.
If you are not using overrides, the issue might be coming, yet again, from a module. Reach Modules > Positions, check “Display non-positionable hooks”, and then look for modules hooked to one of the following:
Wrapping it up
This post was not meant to give you a 100% reliable solution, since it’s impossible to predict every single scenario. Still, I hope it pointed you to the right direction in case you were facing the never-ending spinning save button issue in Prestashop 18.104.22.168 and newer.