0

my question is simple but I have not found a form to solve it. I am trying to include a library located on the magento's module which I am developing.

$simple_excel_path = Mage::getBaseDir('code')."/local/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php";
echo $simple_excel_path;
require $simple_excel_path;

This code returns the following error:

(echo) this route is correct. /home/javiertxu/Documentos/webs/magentoabc/app/code/local/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php

(error) but the require function is going to another site Fatal error: require(): Failed opening required '/home/javiertxu/Documentos/webs/magentoabc/app/codelocal/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php' (include_path='/home/javiertxu/Documentos/webs/magentoabc/app/code/local:/home/javiertxu/Documentos/webs/magentoabc/app/code/community:/home/javiertxu/Documentos/webs/magentoabc/app/code/core:/home/javiertxu/Documentos/webs/magentoabc/lib:.:/usr/share/php') in /home/javiertxu/Documentos/webs/magentoabc/app/design/adminhtml/default/default/template/massiveupdatingproducts/massiveupdatingproductsbackend.phtml on line 5

This is the directory:

enter image description here

What I should do?

Thanks

0

Your module name is lowercase, you should change libraries for Libraries, following module naming convention in Magento

Magento adds every code pool folder as include path, so you don't need to pass the full path (although that shouldn't throw any error), it is enough starting path from your module main folder ('Javi')

Last thing, be sure the file has the right permissions to be readable by webserver user

  • Thanks, I solved that before you answered, but you were right, I gave permission 777 to the library and it run. – Javi Torre Sustaeta Feb 7 '19 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.