Ошибка opencart Неустранимая ошибка: Неперехваченное исключение: Ошибка: неизвестный столбец

Итак, прежде всего, я прошу прощения за мое неуклюжее объяснение. Мои навыки PHP нуждаются в серьезной доработке.

Я получил эту ошибку

Неустранимая ошибка: Неперехваченное исключение: Ошибка: неизвестный столбец «is_unlimited» в «списке полей»
Номер ошибки: 1054
INSERT INTO oc_seller_group SET product_id = '1202', gquantity = '0', _ 4_ = '59 ', group_commission =' 0 ', _ 6_ =' 30 ', _ 7_ =' stm ', _ 8_ =' 0 ', _ 9_ =' catalog / Image.jpg ', defaultCategoryProduct =' 0 ', _ 11_ =' 0 ', defaultCategoryPrice = '0', defaultNoOfListing = '0', _ 14_ = '0', defaultGroupCommissionPercentage = '0', _ 16_ = '0', _ 17_ = '0', _ 18_ = '1', _19 _ = '1' в / public_html / system /library/db/mysqli.php:40 Трассировка стека: # 0 /storage/modification/system/library/db.php(58): DB \ MySQLi- ›query ('INSERT INTO oc...') #1 /public_html/admin/model/customerpartner/seller_add_group.php(157): DB->query('INSERT INTO oc ...') # 2 / хранилище / модификация / система / двигатель / loader.php (264): ModelCustomerpartnerSellerAddGroup- в /public_html/system/library/db/mysqli.php в строке 40

Вот код файла seller_add_group.php:

    public function addGroupCust($data = array()) {

    $product_id = $this->add_group_as_product($data);

    if (isset($data['wk_autoApprove']) && $data['wk_autoApprove']) {
        $autoApprove = 1;
    } else {
        $autoApprove = 0;
    }

    $sql="INSERT INTO `" . DB_PREFIX . "seller_group` SET `product_id` = '" . (int)$product_id."' ,`gquantity` = '" . (int)$data['defaultCategoryQuantity'] . "',`gprice` = '".(float)$data['wk_product_price'] . "',`group_commission` = '". (float)$data['wk_group_commission'] . "',`expiry` = '" . (int)$data['wk_group_expiry'] . "',`membership_type` = '" . $this->db->escape($data['wk_group_type']) . "',`trial_status` = '" . (int)$data['wk_group_trial'] . "',`group_image` = '" . $this->db->escape($data['image']) . "', `defaultCategoryProduct` = '" . (int)$data['defaultCategoryProduct'] . "',`defaultCategoryQuantity` = '" . (int)$data['defaultCategoryQuantity'] . "', `defaultCategoryPrice` = '" . (float)$data['defaultCategoryPrice'] . "' ,`defaultNoOfListing` = '" . (int)$data['defaultNoOfListing'] . "',`defaultListingDuration` = '" . (int)$data['defaultListingDuration'] . "', `defaultGroupCommissionPercentage` = '" . (float)$data['defaultGroupCommissionPercentage'] . "',`defaultGroupCommissionFixed` = '" . (float)$data['defaultGroupCommissionFixed'] . "',`defaultListingFee` = '" . (float)$data['defaultListingFee'] . "',`autoApprove` = '" . (int)$autoApprove."', `is_unlimited`='" . (int)$data['allow_unlimited'] . "'";

    $this->db->query($sql);

    $id = $this->db->getLastId();

    foreach ($data['wk_name'] as $key => $value) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_name` SET `id`='" . (int)$id."', `language_id` = '" . (int)$value['language_id'] . "', name = '" . $this->db->escape($value['name']) . "'");
    }

    $account_menu = '';
    $productTabs = '';
    $profileOption = '';
    $publicSellerProfile = '';

    if (isset($data['wk_seller_group_allowed_account_menu'])) {
        foreach ($this->request->post['wk_seller_group_allowed_account_menu'] as $key => $menu) {
            $account_menu .= $key.":" . $menu.",";
        }
        $account_menu = rtrim($account_menu,',');
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'account', `value` = '" . $this->db->escape($account_menu) . "'");
    }

    if (isset($data['wk_seller_group_allowed_product_tabs'])) {
        foreach ($this->request->post['wk_seller_group_allowed_product_tabs'] as $key => $option) {
            $productTabs .= $key.":" . $option.",";
        }
        $productTabs = rtrim($productTabs,',');
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'producttab', `value` = '" . $this->db->escape($productTabs) . "'");
    }

    if (isset($data['wk_seller_group_allowed_profile_options'])) {
        foreach ($this->request->post['wk_seller_group_allowed_profile_options'] as $key => $option) {
            $profileOption .= $key.":" . $option.",";
        }
        $profileOption = rtrim($profileOption,',');
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'profileoption', `value` = '" . $this->db->escape($profileOption) . "'");
    }

    if (isset($data['wk_seller_group_allowed_public_seller_profile'])) {
        foreach ($this->request->post['wk_seller_group_allowed_public_seller_profile'] as $key => $option) {
            $publicSellerProfile .= $key.":" . $option.",";
        }
        $publicSellerProfile = rtrim($publicSellerProfile,',');
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'publicsellerprofile', `value` = '" . $this->db->escape($publicSellerProfile) . "'");
    }

    if (isset($data['productQuantity'])) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'productQuantity', `value` = '" . $this->db->escape(serialize($data['productQuantity'])) . "'");
    }

    if (isset($data['productListing'])) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'productListing', `value` = '" . $this->db->escape(serialize($data['productListing'])) . "'");
    }

    if (isset($data['productListingDuration'])) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'productListingDuration', `value` = '" . $this->db->escape(serialize($data['productListingDuration'])) . "'");
    }

    if (isset($data['productgroupCommission'])) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'productgroupCommission', `value` = '" . $this->db->escape(serialize($data['productgroupCommission'])) . "'");
    }

    if (isset($data['productListingFee'])) {
        $this->db->query("INSERT INTO `".DB_PREFIX."seller_group_setting` SET `group_id` = '" . (int)$id."', `setting_for`= 'productListingFee', `value` = '" . $this->db->escape(serialize($data['productListingFee'])) . "'");
    }

    return $product_id;
}

person Th3prof    schedule 20.07.2020    source источник
comment
Уделите время чтению сообщений об ошибках. Это ошибка SQL, а не ошибка PHP. Если вы посмотрите на SHOW CREATE TABLE oc_seller_group, то, надеюсь, ошибка будет очевидна.   -  person danblack    schedule 21.07.2020
comment
Я уже исправил эту проблему, просто создав столбец is_unlimited в oc_seller_group.   -  person Th3prof    schedule 21.07.2020


Ответы (1)


Просто создайте столбец is_unlimited в группе oc_seller_group, например: ALTER TABLE имя_таблицы ADD имя_столбца тип данных;

person Th3prof    schedule 21.07.2020