0

I'm taking a look at a friend's Magento website - they want to run a multi-store setup which I have done before on my own website.

So anyway, I make the new Website, make the new Store, all good so far. I try to make a new Store View and it gives me the "Error creating store view - An error occurred while saving. Please review the error log' message.

I've tried going through exception.log but I can't quite make out what is causing the issue...

I know that whatever it is, is staring me in the face, but I'm glancing right over it...

Can anyone shame me and point out where I'm going wrong?

Not sure if relevant but this particular Magento installation has an insane amount of extensions...


extract from exception.log


2016-08-12T12:37:33+00:00 DEBUG (7): Exception message: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)
Trace: #0 /home/idsuppli/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/idsuppli/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/idsuppli/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/idsuppli/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `core_st...', Array)
#4 /home/idsuppli/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `core_st...', Array)
#5 /home/idsuppli/public_html/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(380): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
#7 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/Store.php(265): Mage_Core_Model_Resource_Db_Abstract->load(Object(ET_CurrencyManager_Model_Store), Array, 'code')
#8 /home/idsuppli/public_html/app/code/community/MageParts/Base/Helper/Data.php(199): Mage_Core_Model_Store->load(Array)
#9 /home/idsuppli/public_html/app/code/community/MageParts/Permissions/Helper/Data.php(927): MageParts_Base_Helper_Data->getStoreId()
#10 /home/idsuppli/public_html/app/code/community/MageParts/Permissions/Helper/Data.php(990): MageParts_Permissions_Helper_Data->getConfigTableEntry('mageparts_permi...', 'model', 'core/store')
#11 /home/idsuppli/public_html/app/code/community/MageParts/Permissions/Model/Observer/Global.php(52): MageParts_Permissions_Helper_Data->clearModelCache('core/store')
#12 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/App.php(1339): MageParts_Permissions_Model_Observer_Global->refreshModelCache(Object(Varien_Event_Observer))
#13 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/App.php(1318): Mage_Core_Model_App->_callObserverMethod(Object(MageParts_Permissions_Model_Observer_Global), 'refreshModelCac...', Object(Varien_Event_Observer))
#14 /home/idsuppli/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('model_save_afte...', Array)
#15 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/Abstract.php(465): Mage::dispatchEvent('model_save_afte...', Array)
#16 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Core_Model_Abstract->_afterSave()
#17 /home/idsuppli/public_html/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php(221): Mage_Core_Model_Abstract->save()
#18 /home/idsuppli/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_System_StoreController->saveAction()
#19 /home/idsuppli/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
#20 /home/idsuppli/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 /home/idsuppli/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#22 /home/idsuppli/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#23 /home/idsuppli/public_html/index.php(87): Mage::run('', 'store')
#24 {main}
0

It looks like the problem is in this line:

/home/idsuppli/public_html/app/code/community/MageParts/Base/Helper/Data.php(199): Mage_Core_Model_Store->load(Array)

The call to ->load() should be passed in an integer but is instead being given an array.

Take a look at line# 199 in file /home/idsuppli/public_html/app/code/community/MageParts/Base/Helper/Data.php. You should be able to backtrack it from there.

The final error is an SQL error resulting from the model being passed an array.

In fact, if you want to see the query thats causing the problem, go to lib/Varien/Db/Adapter/Pdo/Mysql.php and set the following properties to true.

protected $_debug = false; //change to true
protected $_logAllQueries = false; //change to true

All queries that take place will be logged in var/debug/pdo_mysql.log. You can search for the offending query there as well and that should also provide you with some insight as to what's going on.

| improve this answer | |
  • @RaymondMorgan, did my answer get you going in the right direction? – Shawn Abramson Aug 18 '16 at 14:19
  • Hi Shawn, my profuse apologies for taking so long to get back to you. Something urgent came up and I was offline for a while --- anyway your answer was PERFECT! Found the offending code, as per your direction and she's running! – Raymond Morgan Aug 25 '16 at 11:55
  • Awesome! I am glad I was able to help! Btw, don't forget to turn off query logging bc it can slow down performance on a production environment. – Shawn Abramson Aug 25 '16 at 12:54

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.