Saturday 24 September 2011

Magento Jextn Faq SQLSTATE[42S22]: Column not found: 1054 Unknown column 'store' in 'where clause'

When I installed  Jextn Faq  Extension I got the following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'store' in 'where clause'

I have just comment on three lines and works for me.
app\code\community\Jextn\Faq\Model\Mysql4\Faq\collection.php
after 
public function setFirstStoreFlag($flag = false)
{
    $this->$previewFlag = $flag;
    return $this;
}
 before
public function setFirstStoreFlag($flag = false)
{
//  $this->$previewFlag = $flag;
    return $flag;
}
In same file remove If condition from  function _afterLoad() and its look like this
protected function _afterLoad()
{
//        if ($this->$previewFlag) {
        $items = $this->getColumnValues('faq_id');
        if (count($items)) {
            $select = $this->getConnection()->select()
                    ->from($this->getTable('faq_store'))
                    ->where($this->getTable('faq_store').'.faq_id IN (?)', $items);
            if ($result = $this->getConnection()->fetchPairs($select)) {
                foreach ($this as $item) {
                    if (!isset($result[$item->getData('faq_id')])) {
                        continue;
                    }
                    if ($result[$item->getData('faq_id')] == 0) {
                        $stores = Mage::app()->getStores(false, true);
                        $storeId = current($stores)->getId();
                        $storeCode = key($stores);
                    } else {
                        $storeId = $result[$item->getData('faq_id')];
                        $storeCode = Mage::app()->getStore($storeId)->getCode();
                    }
                    $item->setData('_first_store_id', $storeId);
                    $item->setData('store_code', $storeCode);
                }
            }
        }
//        }
    parent::_afterLoad();
}
change in this file also app\code\community\Jextn\Faq\Model\Mysql4\faq.php change
after
$collection = Mage::getModel('faq/faq')->getCollection()
                ->addStoreFilter($storeId)
                ->addIsActiveFilter();
before
$collection = Mage::getModel('faq/faq')->getCollection()
                //->addStoreFilter($storeId)
                ->addIsActiveFilter();

No comments:

Post a Comment