Prestashop Endless Spinning Product Save Button

a 夏天 提交于 2019-12-06 00:53:21

It is a very common problem of Prestashop 1.6.x.x.

What is the background of it?

Prestashop has a complex product editing page consisting of multiple tabs where information is loaded asynchronously (using Ajax). The "Save" and "Save & stay" buttons keeps spinning until all tabs are loaded successfully. If you have got any error in one of these tabs data - it will keep spinning long or forever.

There are these solutions

  1. Try another browser. To be sure it is not related with your browser (Javascript is relative to the browser) - try another one.

  2. Fix your Prestashop. Possibly you have an error in your Prestashop. It can be broken or outdated modules, broken or invalid data in the database, modified core Prestashop files etc. It is not easy to debug and fix it.

  3. Add a trick*. Caution! Do it if you are sure you have no other options. By adding this trick you can get some Javascript warnings while saving a new product but it won't produce data loss.

*Adding a trick

You are not going to edit core Prestashop files, but use overrides.

[yoursiteroot] - is a root folder of your Prestashop site. It can be public_html/ or else.

[youradmin] - is an admin folder of your Prestashop installation. It can be a sequence of random characters like smbcl5blanwcxnfs/ or anything else. You can see it while logged to your admin panel in the URL line: http://www.yoursite.com/[youradmin]/index.php?....

  1. Using FTP copy all .tpl files

    from [yoursiteroot]/[youradmin]/themes/default/template/controllers/products

    to [yoursiteroot]/override/controllers/admin/templates/products

    If this folder doesn't exist - create it exactly with all its path folders.

    (Optionally you can copy the same index.php file from that folder to all new folders you have created. It is just for the security reasons.)

  2. Find at the bottom of all these freshly copied files the same lines:

    <button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save'}</button>
    <button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save and stay'}</button>
    

    and change to:

    <button type="submit" name="submitAddproduct" class="btn btn-default pull-right"><i class="process-icon-save"></i> {l s='Save'}</button>
    <button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right"><i class="process-icon-save"></i> {l s='Save and stay'}</button>
    

    What exactly we have done with the code?

    Removed disabled="disabled".

    Replaced process-icon-loading with process-icon-save.

  3. Be sure in your site Backoffice settings Advanced parameters > Performance > Disable all overrides is set to No.

Disable all overrides is set to "No"

Done!

We hope Prestashop fix this awkward errors precaution in a future.

If you want to remove the trick - just remove all these added .tpl files.

It's a JS code problem. I created a fix for it in GitHub. Hopefully it will be merged and integrated in 1.6.1.x soon.

https://github.com/PrestaShop/PrestaShop/pull/5949

This issue should be fixed in PS 1.6.1.9, to fix it in previous versions, try to comment out those lines in a template override of form.tpl file (/adminXXXX/themes/default/template/controllers/products/helpers/form/form.tpl) :

https://github.com/PrestaShop/PrestaShop/blob/5566c2d9d7e4ab88a201b2c5cf10e1cda2ff7150/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl#L252-L254

This fix works for me in PS 1.6.1.1 and 1.6.1.5

Solution from ps forum ( https://www.prestashop.com/forums/topic/300347-cannot-edit-product-save-or-save-and-stay-not-work/page-2#entry2429099 )

Hope this help...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!