Skip to content
Advertisement

opencart error Fatal error: Uncaught Exception: Error: Unknown column

So first of I apologize for my rocky explanation. My PHP skills need serious refinement.

I did get this error

Fatal error: Uncaught Exception: Error: Unknown column ‘is_unlimited’ in ‘field list’
Error No: 1054
INSERT INTO oc_seller_group SET product_id = ‘1202’ ,gquantity = ‘0’,gprice = ’59’,group_commission = ‘0’,expiry = ’30’,membership_type = ‘stm’,trial_status = ‘0’,group_image = ‘catalog/Image.jpg’, defaultCategoryProduct = ‘0’,defaultCategoryQuantity = ‘0’, defaultCategoryPrice = ‘0’ ,defaultNoOfListing = ‘0’,defaultListingDuration = ‘0’, defaultGroupCommissionPercentage = ‘0’,defaultGroupCommissionFixed = ‘0’,defaultListingFee = ‘0’,autoApprove = ‘1’, is_unlimited=’1′ in /public_html/system/library/db/mysqli.php:40 Stack trace: #0 /storage/modification/system/library/db.php(58): DBMySQLi->query(‘INSERT INTO oc...') #1 /public_html/admin/model/customerpartner/seller_add_group.php(157): DB->query('INSERT INTO oc…’) #2 /storage/modification/system/engine/loader.php(264): ModelCustomerpartnerSellerAddGroup- in /public_html/system/library/db/mysqli.php on line 40

Here’s the code of seller_add_group.php file:

    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;
}

Advertisement

Answer

Just Create ‘is_unlimited’ Column in ‘oc_seller_group’ for ex: ALTER TABLE table_name ADD column_name datatype;

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement