user5936336
user5936336

Reputation:

Display errors OpenCart

In PrestaShop I can display the errors with the function Tools::displayError() like this:

if (empty($email)) {
        $this->errors[] = Tools::displayError('Email is empty.');
        $this->doLog('ERROR: Email/username is empty');
    } elseif (!Validate::isEmail($email)) {
        $this->errors[] = Tools::displayError('Invalid email address.');
        $this->doLog('ERROR: Invalid Email address');
    }

Is there a similar way to do this in OpenCart? Is there a function i can use?

Thanks

Upvotes: 2

Views: 7894

Answers (1)

Sanchit Gupta
Sanchit Gupta

Reputation: 3224

To Turn on error reporting, please follow :

  • Go To Admin Panel

  • Go to System > Settings

  • Select your store from the list and click Edit

  • Go to the Server tab

  • To display errors, change Display Errors to Yes, If you want to log errors to a file, select Yes for Log Errors

  • Enter in an Error Log Filename

  • Click Save

Print Custom error message inside error.log

$logger = new Log('error.log'); //just pass the file name as error.log
$logger->write('Custom Error Message');

You will see the error file inside system-> storage-> logs-> error.log

Upvotes: 3

Related Questions