Jump to content

Can not edit products


M.N

Recommended Posts

Prestashop 1.7.8.11 but problem appeared already in v 10. PHP 7.4 Two shops with the same problem.

When saving product, there will be error message Can not update product. However, text fields are updated, save button made gray. So, when going back to products list and opening product again, it can be saved for one time. Combinations can not be generated in this way.

Looking at console there is strange issue with main.bundle.js file:

POST https://xxx.xx/admin/index.php/sell/catalog/products/4?_token=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 500 (Internal Server Error)
send @ main.bundle.js:1404
ajax @ main.bundle.js:1404
e.ajax @ main.bundle.js:1404
send @ form.js?1.7.8.11:677
(anonymous) @ form.js?1.7.8.11:876
dispatch @ main.bundle.js:1404
_.handle @ main.bundle.js:1404
VM532:2 Uncaught SyntaxError: Unexpected token '<', "
<!DOCTYPE "... is not valid JSON
    at parse (<anonymous>)
    at Function.<anonymous> (main.bundle.js:1404:142314)
    at e.<computed> [as parseJSON] (main.bundle.js:1404:141046)
    at Object.error (form.js?1.7.8.11:729:23)
    at i (main.bundle.js:1404:78329)
    at Object.fireWith [as rejectWith] (main.bundle.js:1404:79198)
    at D (main.bundle.js:1404:130029)
    at XMLHttpRequest.<anonymous> (main.bundle.js:1404:132472)
(anonymous) @ main.bundle.js:1404
e.<computed> @ main.bundle.js:1404
error @ form.js?1.7.8.11:729
i @ main.bundle.js:1404
fireWith @ main.bundle.js:1404
D @ main.bundle.js:1404
(anonymous) @ main.bundle.js:1404
load (async)
send @ main.bundle.js:1404
ajax @ main.bundle.js:1404
e.ajax @ main.bundle.js:1404
send @ form.js?1.7.8.11:677
(anonymous) @ form.js?1.7.8.11:876
dispatch @ main.bundle.js:1404
_.handle @ main.bundle.js:1404

The line resulting error in file looks like this (starting with o.send...):

 t = t("abort");
                                    try {
                                        o.send(e.hasContent && e.data || null)
                                    } catch (s) {
                                        if (t)
                                            throw s
                                    }

By some reason Debug mode does not load up, but can use inspect in browser. Compared main.bundle.js size over with version 1.7.8.8, seems to be the same size. So can be that root cause is somewhere else. Where to look for?

Link to comment
Share on other sites

14 hours ago, Prestashop Addict said:

Clear cache browser.

Thank you for reply. This is tested from back office and manually deleting the folders. Unfortunately no change.

Just noticed have written error message not correctly. Correct error message is: "Unable to update settings." when saving the product.

Link to comment
Share on other sites

Thanks for posters. Got debug result:

CRITICAL
10:47:44
php	Call to undefined method Product::updateCacheAttachment()
Hide context    Hide trace
[▼
  "exception" => FatalThrowableError {▶}
]
{▼
  /home/xxxxxxxxxxx/classes/Attachment.php:225 {▼
    › 
    › Product::updateCacheAttachment((int) $idProduct);
    › 
  }
  /home/xxxxxxxxxxx/classes/Attachment.php:271 {▶}
  /home/xxxxxxxxxxx/src/Adapter/Product/AdminProductWrapper.php:858 {▶}
  /home/xxxxxxxxxxx/src/PrestaShopBundle/Controller/Admin/ProductController.php:574 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200 {▶}
  /home/xxxxxxxxxxx/admin/index.php:82 {▶}
}
CRITICAL
10:47:44
request	Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "updateCacheAttachment" of class "Product"." at /home/xxxxxxxxxxx/classes/Attachment.php line 225
Hide context    Hide trace
[▼
  "exception" => UndefinedMethodException {▶}
]
{▼
  /home/xxxxxxxxxxx/classes/Attachment.php:225 {▼
    › 
    › Product::updateCacheAttachment((int) $idProduct);
    › 
  }
  /home/xxxxxxxxxxx/classes/Attachment.php:271 {▶}
  /home/xxxxxxxxxxx/src/Adapter/Product/AdminProductWrapper.php:858 {▶}
  /home/xxxxxxxxxxx/src/PrestaShopBundle/Controller/Admin/ProductController.php:574 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68 {▶}
  /home/xxxxxxxxxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200 {▶}
  /home/xxxxxxxxxxx/admin/index.php:82 {▶}
}
]

What to look for next?

Link to comment
Share on other sites

Products do not use attachments. Looked on database, all related to attachments is value 0.

For different token generation changed all related values in configuration.php It clearly worked, as had to login and set some new passwords, but it did not resolve the problem.

Edited by M.N (see edit history)
Link to comment
Share on other sites

On 1/31/2024 at 8:16 PM, M.N said:

Prestashop 1.7.8.11 but problem appeared already in v 10. PHP 7.4 Two shops with the same problem.

When saving product, there will be error message Can not update product. However, text fields are updated, save button made gray. So, when going back to products list and opening product again, it can be saved for one time. Combinations can not be generated in this way.

Hello,

1. Turn on debug mode to see any errors

2. Downgrade your PHP version to 7.0 or 7.2

3. check PHP ini settings, and make it compatible with your store data amount.

 

Regards


 

Link to comment
Share on other sites

5 minutes ago, Mian Waqas said:

Turn on debug mode to see any errors

Yep, now this post with errors is waiting for moderator approval for 26 hours in the forum. In short:

  "exception" => FatalThrowableError {▶}
]
{▼
  /home/xxxxxxxxxxx/classes/Attachment.php:225 {▼
    › 
    › Product::updateCacheAttachment((int) $idProduct);

 

Link to comment
Share on other sites

Thank you JBW! This was it, there was old version of Product.php used due to some override. Now solved, case closed.

27 minutes ago, JBW said:

Compare your classes/product.php

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...