Description
Presta 8
// If you need env vars.
use Symfony\Component\Dotenv\Dotenv;
require_once 'config/config.inc.php';
require_once 'app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->boot();
// If you need env vars.
$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/../../../.env');
// Fix "$displayPrecision must be of type int" error if you're working with products or orders.
$context = Context::getContext();
if (!$context->currency) {
$context->currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
}
if (!isset($context->currency->precision)) {
$context->currency->precision = (int) Configuration::get('PS_PRICE_DISPLAY_PRECISION');
}
// For multishops.
$context->shop = new Shop($YOUR_SHOP_ID);Consider setting these as well:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));Old versions
Find and include main init.php and main config.inc.php files.
(This may or may not work, I haven't tested it in a while and I'm not sure what version it works in.)