Posts Tagged ‘main_table.custom_design_apply’

Hello Guys,

Today i m going to show you the ways to resolve error “SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘main_table.custom_desiwegn_apply’ in ‘field list’”

How this error occurs?

The above error occurs when we enable Flat catalog category settings from admin  >> System  >> Configuration >> Catalog  >> Frontend >> “Use Flat Catalog Category” set to “Yes”

How to resolve above error?

There are two ways to resolve above error specified below:

First Solution: 

Rewrite file  “YourProject\app\code\core\Mage\Catalog\Model\Resource\Category\Flat.php ” to do change in function getDesignUpdateData we need to comment code ”  ‘main_table.custom_design_apply’,” from function.

Second Solution:

To resolve above error we will create category attribute , create one file in root and paste below code and than execute that file once:

<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
// below code will add text attribute
$setup->addAttribute('catalog_category','custom_design_apply',
	 array(
            'type'              => 'int',
            'label'             => 'Apply To',
            'frontend'          => '',
            'table'             => '',
            'input'             => 'select',
            'class'             => '',
            'source'            => 'core/design_source_apply',
            'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
            'visible'           => true,
            'required'          => false,
            'user_defined'      => false,
            'default'           => '',
            'searchable'        => false,
            'filterable'        => false,
            'comparable'        => false,
            'visible_on_front'  => false,
            'unique'            => false,
            'group' => 'design',
	    'sort'  => 20
        )
);

Don’t forget to do re-index from Admin panel, System >> Index Management

I hope above solution works like  charm.

Thanks,

Bijal Bhavsar 🙂

Advertisements