Magento Forum

   
Unknown column ‘rule.calculate_subtotal’ in ‘field list’
 
jharsem
Jr. Member
 
Total Posts:  3
Joined:  2010-10-26
 

Hiya,

I upgraded from CE 1.7.0.2 to 1.8.0.0 using the method described by Raphael Petrini here: http://www.magentocommerce.com/boards/viewthread/354220/P15/#t459900

it all seemed to work ok and the front page and admin pages seem to work fine - however when I try to access any (non-empty) category or product page I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘rule.calculate_subtotal’ in ‘field list’

Yep I have re-indexed everything and cache is cleared but to no avail. Has anyone seen this before ?

The full error stack is here:

#0 /var/www/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/magento/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /var/www/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('(SELECT `main_t...', Array)
#4 /var/www/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('(SELECT `main_t...', Array)
#5 /var/www/magento/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /var/www/magento/app/code/core/Mage/Tax/Model/Resource/Calculation.php(358): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select))
#7 /var/www/magento/app/code/core/Mage/Tax/Model/Resource/Calculation.php(99): Mage_Tax_Model_Resource_Calculation->_getRates(Object(Varien_Object))
#8 /var/www/magento/app/code/core/Mage/Tax/Model/Calculation.php(193): Mage_Tax_Model_Resource_Calculation->getRateInfo(Object(Varien_Object))
#9 /var/www/magento/app/code/core/Mage/Tax/Model/Observer.php(208): Mage_Tax_Model_Calculation->getRate(Object(Varien_Object))
#10 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Tax_Model_Observer->addTaxPercentToProductCollection(Object(Varien_Event_Observer))
#11 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Tax_Model_Observer), 'addTaxPercentTo...', Object(Varien_Event_Observer))
#12 /var/www/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('catalog_product...', Array)
#13 /var/www/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php(545): Mage::dispatchEvent('catalog_product...', Array)
#14 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(885): Mage_Catalog_Model_Resource_Product_Collection->_afterLoad()
#15 /var/www/magento/app/code/core/Mage/Review/Model/Observer.php(78): Mage_Eav_Model_Entity_Collection_Abstract->load()
#16 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Review_Model_Observer->catalogBlockProductCollectionBeforeToHtml(Object(Varien_Event_Observer))
#17 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1311): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Review_Model_Observer), 'catalogBlockPro...', Object(Varien_Event_Observer))
#18 /var/www/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('catalog_block_p...', Array)
#19 /var/www/magento/app/code/core/Mage/Catalog/Block/Product/List.php(164): Mage::dispatchEvent('catalog_block_p...', Array)
#20 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(885): Mage_Catalog_Block_Product_List->_beforeToHtml()
#21 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(605): Mage_Core_Block_Abstract->toHtml()
#22 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(549): Mage_Core_Block_Abstract->_getChildHtml('product_list', true)
#23 /var/www/magento/app/code/core/Mage/Catalog/Block/Category/View.php(90): Mage_Core_Block_Abstract->getChildHtml('product_list')
#24 /var/www/magento/app/design/frontend/default/celebrity/template/catalog/category/view.phtml(102): Mage_Catalog_Block_Category_View->getProductListHtml()
#25 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(412): include('/var/www/magent...')
#26 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(274): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#27 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(288): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->renderView()
#28 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(886): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->_toHtml()
#29 /var/www/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#30 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Text_List->_toHtml()
#31 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(605): Mage_Core_Block_Abstract->toHtml()
#32 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(549): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#33 /var/www/magento/app/design/frontend/default/celebrity/template/page/2columns-left.phtml(62): Mage_Core_Block_Abstract->getChildHtml('content')
#34 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(412): include('/var/www/magent...')
#35 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(274): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#36 /var/www/magento/var/ait_rewrite/Mage_Core_Block_Template.php(288): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->renderView()
#37 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(886): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->_toHtml()
#38 /var/www/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#39 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#40 /var/www/magento/app/code/core/Mage/Catalog/controllers/CategoryController.php(161): Mage_Core_Controller_Varien_Action->renderLayout()
#41 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_CategoryController->viewAction()
#42 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#43 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#44 /var/www/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#45 /var/www/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#46 /var/www/magento/index.php(87): Mage::run('', 'store')
#47 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
jharsem
Jr. Member
 
Total Posts:  3
Joined:  2010-10-26
 

Ok,

I think I have got it sorted - it appears the upgrade didn’t alter the tax_calculation_rule table and the calculate_subtotal field was missing (I found out the details by searching through the 1.8.0.0 code base - Line: 294 in app/core/Mage/Tax/Model/Resource/Calculation.php). So for now I have added the field: calculate_subtotal as tinyint(1) not null default 0 to the tax_calculation_rule table and it seems to have fixed my issues.

You could see that before this when you went to manage the tax rules the “calculate of subtotal” field was not saved. Now it is. I am going to have a look around to see if this broke anything but I can get to my category and product pages a-ok now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreimarketing
Jr. Member
 
Total Posts:  1
Joined:  2012-10-31
 

on line 294 i put this code

if( $ruleTableAliasName == ! NULL)

and he, work

 
Magento Community Magento Community
Magento Community
Magento Community
 
FD CITY
Member
 
Total Posts:  38
Joined:  2012-09-25
 

Hi.

I’m having the exact same problem since upgrade from 1.7.2

However I do not understand your solution.  Could someone give me a more detailed explanation please?

Many thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
FD CITY
Member
 
Total Posts:  38
Joined:  2012-09-25
 

I have fixed this issue now by creating a new Calculation.php using: http://www.phpkode.com/source/p/magento/magento/app/code/core/Mage/Tax/Model/Resource/Calculation.php

Hopefully this will not cause any problems down the line?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lucrian
Member
 
Avatar
Total Posts:  43
Joined:  2010-04-16
Galaţi, România, Europa, Terra, Calea Laptelui
 
jharsem - 01 October 2013 03:18 PM


[...] I have added the field: calculate_subtotal as tinyint(1) not null default 0 to the tax_calculation_rule table and it seems to have fixed my issues.
[...]

Thanks for solution.
SQL command:

ALTER TABLE `tax_calculation_ruleADD `calculate_subtotalTINYINT NOT NULL DEFAULT '0'
Don’t forget to add your table prefix if have one.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top