Db::Instance prestashop

2019-07-25 12:05发布

I added config.inc.php inside my php script in order to access to Db class provided.

The problem is that when I launch the script from the server, it redicted to the website prestashop and then I can't see what I want to echo in the html page.

More, I have made a error in order to see the behaviour: nothing is shown, he redirect to the prestashop website.

Please help me.

1条回答
不美不萌又怎样
2楼-- · 2019-07-25 12:48

SOLVED

After lots of tests, the soloution is very easy.

In order to use class from Prestashop service in my_own_file.php, we have to include

  • config.inc.php located inside config directory
  • init.php located at the root of the store

But, to reach this two includes, my_own_file.php has to be at the root of the prestashop store directory or inside it.

The reason is that, to access to prestashop store files, the file has to be part of the store also. Otherwise, you don't have the permission and your sever loads index.php .

查看更多
登录 后发表回答