Pergunta

I have a make a file in the magento root. like below

Foldername/pay.php

This files call api and work with some lib. when i call it through direct in the browser url.

I want to call this within magento function.

pay.php have a class and I add this file within a magento module file and make a object but it shows the error of object reference.

What should i do? Please suggest me.

Thanks in advance to all magento dev

Foi útil?

Solução

put your library at [magento]/lib folder

for example your library is PhpExcel so you have to put it in [magento]/lib/PhpExcel

and include your library in magento file before call.

$includePath = Mage::getBaseDir(). "/lib/PhpExcel/Classes";
set_include_path(get_include_path() . PS . $includePath); 

so you have create object of PhpExcel library to access it

$objPHPExcel = new PHPExcel();

for your reference download PhpExcel Export and check directory structure as well way to access external library in magento.

it create a object in [magento]\app\code\local\Conlabz\Mreport\controllers\Adminhtml\ExportController.php

hope this help you

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top