首页 > 解决方案 > 未捕获的错误:prestashop 1.6 中未找到类“Db”

问题描述

我试图在 prestashop 1.6 中安装一个模块

当我检查 phpmyadmin 时,我看到一张桌子不在那里。

所以我去 www/modules/ecster/sq/install.php

我得到这个错误。

Fatal error: Uncaught Error: Class 'Db' not found in /modules/ecsterpay/sql/install.php:45 Stack trace: #0 {main} thrown in /modules/ecsterpay/sql/install.php on line 45

这是我的代码:

$sql = array();



$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ecsterpay` (

    `id_cart` int(10) NOT NULL,

    `id_shop` int(10) NOT NULL,

    `key_cart` varchar(200) NOT NULL,

    `external_id` varchar(20) NOT NULL DEFAULT \'\',

    `internal_id` varchar(20) NOT NULL DEFAULT \'\',

    `id_order` int(10) NOT NULL,

    `accepted` tinyint NOT NULL DEFAULT 0,

    `debit` tinyint NOT NULL DEFAULT 0,

    `annul` tinyint NOT NULL DEFAULT 0,

    `credit` tinyint NOT NULL DEFAULT 0,



    PRIMARY KEY (`id_cart`, `id_shop`)

) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';



foreach ($sql as $query) {

    if (Db::getInstance()->execute($query) == false) {

        return false;

    }
}

标签: phpprestashop-1.6

解决方案


在 install.php 中尝试:include_once('../../../config.inc.php');

问候


推荐阅读