Jump to content

Adapting a custom file to prestashop


t0m3kk

Recommended Posts

Hi everyone, my module is in the final lap but I need to make a file which isn't included in admin panel or in hooks, the file must work with my ajax querys but I have a some troubles with this file. So my files is named: moderate.php

 

To work with database I must include /classes/Db.php code:

<?php
require '../../classes/Db.php';
$db = Db::getInstance();
?>

The erros is:

Fatal error: Class 'Db' not found in /home/gtsvetan/public_html/presta/modules/my_module_name/moderate.php on line 4

 

When I try with class name in the file Db.php - DbCore the following error is:

Fatal error: Class 'MySQL' not found in /home/gtsvetan/public_html/presta/classes/Db.php on line 87

 

I include /classes/MySQL.php

The code is:

<?php
require '../../classes/Db.php';
require '../../classes/MySQL.php';
$db = Db::getInstance();
?>

The erros is (with DbCore::getInstance() or Db::getInstance()):

Fatal error: Class 'Db' not found in /home/gtsvetan/public_html/presta/classes/MySQL.php on line 28

 

So how to fix that or how to make a file which can working with database?

Link to comment
Share on other sites

So I examined the classes, controllers and config files. Class files are structored like this: filename = Db.php / classname = DbCore and etc with all class files. In folder /config the file named autoload.php is a simple function which include/require files in the system.

 

So I'll investigate where is the point with this file...

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

The solution is: Just include config.inc.php and enJoy :) When you are included this file everything will works :)

 

Hi, Thank you for your generosity.
 
It's so hard to find help and solution for our problems... Problems caused by a poor documentation.
 
I love prestashop, but their support is very poor!
 
I hope prestashop become greater than Magento.
 
Thank you again.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...