PrestaShop Fatal error in module Api: syntax error, unexpected T_FUNCTION, expecting ')' - prestashop

When I enter prestashop back office and click the modules tab in the top menu it is giving the following error, prestashop version 1.5.3.1
[PrestaShop] Fatal error in module Api:
syntax error, unexpected T_FUNCTION, expecting ')'
Any help would be greatly appreciated, searched prestashop forums and cannot find a solution
Thanks in advance

It may be related to version of PHP. I had this problem because of unsupported version of module. What I did was turn on the debug mode on PrestaShop which showed me in what module error was happening and then just removed that module from PrestaShop installation diretory, modules folder.
If you are using that module, you could backup it, then re-installing it, etc.

It turned out it was a problem with Youstice v1.7.2 module
It was causing the API error, what we did in the end was change the name of a folder in the public_html>modules from- "yousticeresolutionsystem" to "yousticeresolutionsystemX"
because it wouldn't allow me to delete the folder to stop the API error.
By using X this in effect deletes the folder stopping the error

Related

Prestashop Productcomments Module Issue

I am experiencing a problem with the Productcomments module which I am using in a custom module and I cannot figure out how to fix it. The problem is with the star rating in the Productcomments form itself. This form works perfectly in a localhost environment - see images 1 and 2, but not on a live server - see images 3 and 4. On the live server it is showing no stars, just radio buttons, and no delete button for removing the stars.
Form as it looks on WAMP
Code from Chromes Inspect for WAMP
Form as it looks on Live Server
Code from Chromes Inspect for Live Server
Disabling the link to the following 2 js files recreates the problem on the local server which would suggest that the problem lies in the links to these two files on the live server, however I have checked all links to these files and they are correct, as are the permissions for these files.
jquery.rating.pack.js and productcomments.js
Occasionally when I clear cache under Advanced Parameters > Performance I get the following error message:
Fatal error: Uncaught --> Smarty: unable to write file /home/productm/public_html/cache/smarty/compile/10/e2/20/wrt5cbbb0747109d3_91450142
<-- thrown in /home/productm/public_html/tools/smarty/sysplugins/smarty_internal_write_file.php on line 46
This problem applies to all 1.6 versions of Prestashop tested.
Any suggestions on how to fix this problem would be appreciated.
Thanks
Kathleen
The error code you've got from clearing cache is linked to permission problems.
Here's probably a duplicate of your issue: How to fix erorr "Fatal error: Uncaught --> Smarty: unable to write file"?
Check that your prestashop files are set to 644 and folders 755 permission. (not just the js files you've mentioned).
Also if you manually moved the module to your live server(ftp), check the ownership of those files.
Edit:
I'll add this to the answer since the permissions didn't fix your problem.
looks like you have a prestashop bug going on with the JS (Synchronous loaded scripts)
here's a patch to fix that, maybe it fixes your original problem.
https://github.com/PrestaShop/PrestaShop/pull/6749/commits/73fd8dbed9f413a70f7d04fc4badd48f00ca501a

Unable to resolve module `some-name` from `Path/To/Project/script.js`

I tried to require("some-name"); in my script.js. This gave me the following error:
Unable to resolve module some-name from Path/To/Project/script.js: Module does not exist in the module map.
So I removed the require("some-name"); in the script.js. The same error occurred.
So I went to a previous state of the app. The error keeps happening and there is nowhere in the code that I request the "some-name" file nor I have the file in my directory.
Here an image where I search in my code to the old file name:
The screen shot of the error in react-native.
I tried the steps shown in the error message and it did not resolve the problem.
It is possible to add more information if it is unclear.
The problem is the cache.
This problem was fixed by:
renaming the file where the error came from.
restarting the server.
Due to the file renaming the server took the updated project with out the error. This problem was solved with the help of Nikhil Parmar in this chat.
The error was already fixed in the code but the server still used the cached project. A normal cache clear and server restart did not work.

Yiii2 - 500 internal error

someone gave a copy of a project created with yii2 and I had to Execute composer to get all the packages for the project, but I get this error:
This is what I get in the Runtime/app.log file:
[127.0.0.1][-][-][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Page not found. in C:\xampp\htdocs\prueba-desarrolladores\vendor\yiisoft\yii2\web\Request.php:189
I haven't been able to access the main view of the project. I've been looking at the related post in here, but nothing works I have no idea what to do, thanks for the help.
I had this twice.Firstly I seen my "Network Tab" in Chrome Developer Options and it said:
PHP Notice 'yii\base\ErrorException' with message 'unserialize(): Error at offset 0 of 16105 bytes'
I was delete my cookies with EditThisCookie Chrome extension and solved temporary.Tomorrow day I had this error again and I found the solution in this answer and I delete my project runtime/debug folder and my problem solved.

Prestashop module page not working

i've loaded a backup from an old prestashop 1.4.6.2 website on a subdomain. now i'm experiencing some problems with the module page. whenever i want to expand a module category it refers me to a 404 page. i have error reporting on and only have one error :
Strict Standards: Declaration of jbx_custominvoice::l() should be compatible with ModuleCore::l($string, $specific = false, $id_lang = NULL) in public_html/presta1.4/classes/Module.php(551) : eval()'d code on line 149
I checked if it was just as easy as adding those variables to the function, but that didnt change anything except make the error go away. Also when i look in the console from chrome i see the error:
Uncaught TypeError: $(...).on is not a function
I've looked all over google and prestashop forums but couldnt find a working solution.
I think it can be a firewall to block the access issue

I keep getting "The following module(s) were not installed properly"

I installed prestashop successfully through your marketplace, and been able to play around with it and also to upload new modules. But every time i try to install the uploaded modules, i get this message
"The following module(s) were not installed properly:"
But the prestashop default modules do install without issues.
What is causing that problem? because the same modules were uploaded and installed without issues on cpanel shared web hosting?
Check modules sql commands for installation. I think module has an character issue. if u enable debugmode and display errors on config/defines.inc.php u can see where the error is.
If u cant solve.
Find this line on your module main php ( for "testmodule" its "testmodule.php") "if (!DB::getInstance()->execute(trim($query))) return false;" some think like that. And remove or close this line. But when u doing this u must manualy run modules sql code with phpmyadmin or something else after or before install module.
modules sql files usualy "install.sql" but some this coders add sql code on modules main phps.
This is a generic error and means that your module installation has failed.