knutselsmurf Posted January 1, 2019 Share Posted January 1, 2019 Hello ! I have made a shipping module, worked great in every Prestashop version. But now with prestashop 1.7.x it doesn't work: I get an fatal ERROR 500 (and can't find any description about this). Can somebody tell me what's is changed in Prestashop 1.7.x according shipping modules, and what must be done to make a shippingmodule for 1.6 also compatible with Prestashop 1.7.x ?? I tried to find documentation on the prestashop website, but as allways: the developer-documentation is VERY POOR AND INCOMPLETE.... It doesn't help developers to make nice modules for prestashop at all !!! I hope somebody can tell me what to do.... I have looked at other shipping modules for 1.7 already: but developers need good and detailed info so they know what they are doing.. Any help would be nice !! With kind regards, 😉 Arthur Link to comment Share on other sites More sharing options...
JBW Posted January 2, 2019 Share Posted January 2, 2019 What are the details of the 500 error message (acivate debug mode to see it)? Link to comment Share on other sites More sharing options...
knutselsmurf Posted January 2, 2019 Author Share Posted January 2, 2019 No extra info, I have debug active. Nothing in logs... Also check the server: nothing there too ? Link to comment Share on other sites More sharing options...
El Patron Posted January 2, 2019 Share Posted January 2, 2019 (edited) what is the shipping module carrier for? maybe we can find one for 1.7. and if you cannot get the underlying php error from 500 error...all is lost Edited January 2, 2019 by El Patron (see edit history) Link to comment Share on other sites More sharing options...
JBW Posted January 2, 2019 Share Posted January 2, 2019 Thats strange. Debug mode should give you the details of the 500 error. Can you post a screenshot of the error page? Anyway, you should be able to run your module line-by-line in debugger (e.g. X-Debug ext) to identify the exact point where the error occurs. Link to comment Share on other sites More sharing options...
knutselsmurf Posted January 4, 2019 Author Share Posted January 4, 2019 On the moment, I am rewriting the module using the shippingmodule from the prestashop module generator. JBW: which PHP-editor are you using ? And how can I use the XDEBUG ? Is there a howto for ? ERROR 500 page: just the error, I see sometimes more info: I have a debug-enable module from prestashop for that: but it's still not very handy. A good PHP-editor with XDEBUG option and howto would be great ! Link to comment Share on other sites More sharing options...
razaro Posted January 4, 2019 Share Posted January 4, 2019 @knutselsmurf There is few ways to enable debug mode in 1.7 from back office in Advanced parameters or by editing define.inc.php You should get some error instead of 500 page. If not do check hosting error logs there must be some info about that. And prestashop module generator is still for 1.6, module may work but also it probably do not use all features of 1.7. Also do check different PHP versions what work in 5.6 it may not in 7.2. Link to comment Share on other sites More sharing options...
JBW Posted January 5, 2019 Share Posted January 5, 2019 I personally use Eclipse (because I know it from Java development years ago) + Xdebug but there are many options out there, you have to try what suits you best. On google there are tutorials how to set it up and get it running (for Xdebug some php.ini entires). Link to comment Share on other sites More sharing options...
knutselsmurf Posted January 5, 2019 Author Share Posted January 5, 2019 Hello ! I have installed XAMPP, ECLIPSE and XDEBUG. Installed Prestashop (bitnami) on local harddisk. How can I debug this: I want to upload a module in the prestashop admin and see what is happening line by line in this module. Would be nice if somebody can help me with this. 😉 Arthur Link to comment Share on other sites More sharing options...
knutselsmurf Posted January 5, 2019 Author Share Posted January 5, 2019 A question: I have made a module. big PHP file... So, I want to put some functions in another php-file and want to load them into the main module. For example, I have a tools.php ( ../modules/testmodule/include/tools.php) file which contains this: private function insertdb($id, $value, $db, $tabel) { $db->Execute('INSERT INTO ' . pSQL($tabel) . " (id,value) values ('" . pSQL($id) . " ', '" . pSQL($value) . "');"); } In the main module file ( ../modules/testmodule/testmodule.php) I have this placed after the line: class Testmodule extends CarrierModule { public function __construct() { // all kind of code } include(dirname(__FILE__).'/includes/tools.php'); public function getContent() { /** * If values have been submitted in the form, process. */ $output = ''; if (((bool)Tools::isSubmit('submitShippingdefaultModule')) == true) { $output .= $this->postProcess(); } $this->context->smarty->assign('module_dir', $this->_path); $output .= $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl'); return $output .= $this->renderForm(); } } But I get an error, not visable what's wrong.. Seems to be the include(dirname(__FILE__).'/includes/tools.php'); line is not allowed. When I remove the line, it works... How can I include functions from other php-files ? Just to make smaller php-files.. Any help with example would be nice ! With kind regards, 😉 Arthur Link to comment Share on other sites More sharing options...
JBW Posted January 8, 2019 Share Posted January 8, 2019 Try require_once 'includes/tools.php' above the class declaration. And the function in your Tools class has to be declared as static. Anyway Tools class is already existing as this class name is used by Prestashop so you should rename it. 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