JulianM Posted March 6, 2013 Share Posted March 6, 2013 Recently I started to use PSWebServiceLibrary to update the product price remotely (I could not update the stock yet, but that's another story). However, in order to debug it I needed to enable display_errors in PrestaShop to see what is happening in the backend (at least in version 1.5.x). This is ok unless that your store is in live mode and you start getting users to the web at the same time. What I did was enabling the errors only for Web Service API calls that came from PSWebServiceLibrary. Here is the solution I found: 1. First, go to PSWebServiceLibrary and specify a custom User Agent. I added the following line below line 135 of PSWebServiceLibrary.php curl_setopt($session, CURLOPT_USERAGENT, 'PSWebServiceLibrary'); 2. Then, go to PrestaShop /config/config.inc.php and added the following line below the display_errors setting: if ( preg_match('/PSWebServiceLibrary/i', $_SERVER['HTTP_USER_AGENT'] )) @ini_set('display_errors', 'on'); This way, if the User Agent is PSWebServiceLibrary then it will enable display_errors, otherwise not. Hope it helps. Julian Magnone 2 Link to comment Share on other sites More sharing options...
reno123 Posted December 26, 2016 Share Posted December 26, 2016 Thanks @JulianM for this simple hint - this is great solution for debuging during API woring. I wiil add PS 1.6.1.10 fix: In PSWebServiceLibrary.php you have to add CURLOPT_USERAGENT into $defaultParams array, so you have to add one more parameter: CURLOPT_USERAGENT => 'PSWebServiceLibrary' instead of addind line curl_setopt($session, CURLOPT_USERAGENT, 'PSWebServiceLibrary'); 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