Jump to content

Get Error 500 Retrieving Single Item Detail With Webservice


Recommended Posts

Hi,

 

I followed the guide to setup prestashop webservices (http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service), i create a key with permission to read categories and products and i was able to get the list of items,

api/categories

but when try to get the details of a single item i get an error 500

api/categories/1

enabling the debug output i get the following error description

Fatal error: Uncaught Error: Function name must be a string in /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php:542
Stack trace:
#0 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php(481): WebserviceOutputBuilderCore->renderField(Object(Product), Array, 'id_default_imag...', Array, 0)
#1 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php(385): WebserviceOutputBuilderCore->renderEntity(Object(Product), 0)
#2 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceRequest.php(1694): WebserviceOutputBuilderCore->getContent(Array, NULL, 'full', 0, 2)
#3 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceRequest.php(560): WebserviceRequestCore->returnOutput()
#4 /Applications/MAMP/htdocs/prestatest/webservice/dispatcher.php(87): WebserviceRequestCore->fetch('SE389PMRE2E2ZIF...', 'GET', 'products/1', Array, false, NULL)
#5 {main}
  thrown in /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php on line 542

Thanks for any comment.

 

 

 

 

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

Hi,

 

I followed the guide to setup prestashop webservices (http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service), i create a key with permission to read categories and products and i was able to get the list of items,

api/categories
but when try to get the details of a single item i get an error 500

api/categories/1
enabling the debug output i get the following error description

Fatal error: Uncaught Error: Function name must be a string in /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php:542
Stack trace:
#0 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php(481): WebserviceOutputBuilderCore->renderField(Object(Product), Array, 'id_default_imag...', Array, 0)
#1 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php(385): WebserviceOutputBuilderCore->renderEntity(Object(Product), 0)
#2 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceRequest.php(1694): WebserviceOutputBuilderCore->getContent(Array, NULL, 'full', 0, 2)
#3 /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceRequest.php(560): WebserviceRequestCore->returnOutput()
#4 /Applications/MAMP/htdocs/prestatest/webservice/dispatcher.php(87): WebserviceRequestCore->fetch('SE389PMRE2E2ZIF...', 'GET', 'products/1', Array, false, NULL)
#5 {main}
  thrown in /Applications/MAMP/htdocs/prestatest/classes/webservice/WebserviceOutputBuilder.php on line 542
Thanks for any comment.

 

On line 542 mentioned above, try changing 

 $field['value'] = $object->$field['getter']();

to: 

 $field['value'] = $object->($field['getter'])();

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...