0

I have a module that added a foo_import column to the sales_flat_order table using the proper sql folder method. I renamed this column both in the sql folder, and in the database using phpmyadmin. I have renamed it to export_flag. The site works fine, module works fine, can still place orders. Issue is, when I click on the sales tab on the backoffice, I get this issue.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_flat_order.foo_import' in 'field list', query was: SELECT `main_table`.*, `sales_flat_order`.`foo_import` FROM `sales_flat_order_grid` AS `main_table`
 INNER JOIN `sales_flat_order` ON main_table.entity_id = sales_flat_order.entity_id ORDER BY created_at DESC LIMIT 20

#0 /var/www/kute3/includes/src/Varien_Db_Statement_Pdo_Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/kute3/includes/src/__default.php(65519): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/kute3/includes/src/__default.php(54710): Zend_Db_Statement->execute(Array)
#3 /var/www/kute3/includes/src/__default.php(55747): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /var/www/kute3/includes/src/__default.php(56683): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /var/www/kute3/includes/src/__default.php(54967): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#6 /var/www/kute3/includes/src/__default.php(32325): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#7 /var/www/kute3/includes/src/__default.php(32951): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#8 /var/www/kute3/includes/src/__default.php(32157): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#9 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Widget_Grid.php(533): Varien_Data_Collection_Db->load()
#10 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Sales_Order_Grid.php(62): Mage_Adminhtml_Block_Widget_Grid->_prepareCollection()
#11 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Widget_Grid.php(626): Mage_Adminhtml_Block_Sales_Order_Grid->_prepareCollection()
#12 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Widget_Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#13 /var/www/kute3/includes/src/__default.php(2612): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#14 /var/www/kute3/includes/src/__default.php(2331): Mage_Core_Block_Abstract->toHtml()
#15 /var/www/kute3/includes/src/__default.php(2275): Mage_Core_Block_Abstract->_getChildHtml('grid', true)
#16 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Widget_Grid_Container.php(77): Mage_Core_Block_Abstract->getChildHtml('grid')
#17 /var/www/kute3/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml()
#18 /var/www/kute3/includes/src/__default.php(3418): include('/var/www/kute3/...')
#19 /var/www/kute3/includes/src/__default.php(3449): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#20 /var/www/kute3/includes/src/__default.php(3463): Mage_Core_Block_Template->renderView()
#21 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Template.php(81): Mage_Core_Block_Template->_toHtml()
#22 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Widget_Container.php(308): Mage_Adminhtml_Block_Template->_toHtml()
#23 /var/www/kute3/includes/src/__default.php(2613): Mage_Adminhtml_Block_Widget_Container->_toHtml()
#24 /var/www/kute3/includes/src/__default.php(13851): Mage_Core_Block_Abstract->toHtml()
#25 /var/www/kute3/includes/src/__default.php(2613): Mage_Core_Block_Text_List->_toHtml()
#26 /var/www/kute3/includes/src/__default.php(2331): Mage_Core_Block_Abstract->toHtml()
#27 /var/www/kute3/includes/src/__default.php(2275): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#28 /var/www/kute3/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
#29 /var/www/kute3/includes/src/__default.php(3418): include('/var/www/kute3/...')
#30 /var/www/kute3/includes/src/__default.php(3449): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#31 /var/www/kute3/includes/src/__default.php(3463): Mage_Core_Block_Template->renderView()
#32 /var/www/kute3/includes/src/Mage_Adminhtml_Block_Template.php(81): Mage_Core_Block_Template->_toHtml()
#33 /var/www/kute3/includes/src/__default.php(2613): Mage_Adminhtml_Block_Template->_toHtml()
#34 /var/www/kute3/includes/src/__default.php(28559): Mage_Core_Block_Abstract->toHtml()
#35 /var/www/kute3/includes/src/__default.php(14244): Mage_Core_Model_Layout->getOutput()
#36 /var/www/kute3/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(95): Mage_Core_Controller_Varien_Action->renderLayout()
#37 /var/www/kute3/includes/src/__default.php(14272): Mage_Adminhtml_Sales_OrderController->indexAction()
#38 /var/www/kute3/includes/src/__default.php(18726): Mage_Core_Controller_Varien_Action->dispatch('index')
#39 /var/www/kute3/includes/src/__default.php(18256): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#40 /var/www/kute3/includes/src/__default.php(21084): Mage_Core_Controller_Varien_Front->dispatch()
#41 /var/www/kute3/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#42 /var/www/kute3/index.php(83): Mage::run('', 'store')
#43 {main}

I have cleared cache and reindexed.

How can I get Magento to update it's understanding of the sales_flat_order table?

  • Did you clear the storage cache? Magento keeps an internal 'view' of the db structure. – ProxiBlue Feb 9 '16 at 22:20
  • Can you show your grid.php file too? I think problem persist there. – Adarsh Khatri Feb 9 '16 at 22:31
  • what version of magento ? – DarkMukke Feb 11 '16 at 17:48
0

Most likely the module that added the column has a Model folder, in this folder usually you can find some references to that column. I suggest that you make a search on the Module folder for foo_import and then replace this with the name of the new column export_flag.

  • No references to foo_import in the model folder, or anywhere else in the repo. – Goose Feb 9 '16 at 21:59
0

Did you try to explicitly flush/refresh the Cache storage? Try to flush it with the button in the upper right corner of the cache page.

"Flush Cache Storage"

Magento stores some model/db data in this cache. I had a similair problem once. I searched for hours. Seems Magento does a hard cache on some entities (like database fields) in this cache.

0

I found that despite me clearing my cache using the "Flush Cache Storage" button, there was still an instance of the old column name under var/cache/. Deleting this resolved the issue. Unsure why flushing the cache didn't fix the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.