Magento Forum

Page 1 of 2
FIX for “SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)”
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

Please replace the files listed below with the attached ones

app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php
app
/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php
app
/code/core/Mage/Eav/Model/Entity/Attribute.php

If you are familiar with patch shell command you can apply the patch.txt instead.

You can also uncompress the attached archive files.zip and copy its content to you Magento folder.

Thank you,
Michael.

File Attachments
Attribute.php  (File Size: 5KB - Downloads: 328)
AttributeController.php  (File Size: 10KB - Downloads: 288)
Indexer.php  (File Size: 16KB - Downloads: 280)
files.zip  (File Size: 9KB - Downloads: 351)
patch.txt  (File Size: 3KB - Downloads: 425)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Dave Smith
Member
 
Avatar
Total Posts:  58
Joined:  2008-02-03
Tamworth, UK
 

Thanks for this. I applied these new files but I still seem to be getting the same error when adding or editing an attribute. Any idea?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gwatt
Jr. Member
 
Total Posts:  15
Joined:  2008-04-01
 

I also tried placing these files in my folders on my grid server account and recieved the following error when trying to add an attribute

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

 
Magento Community Magento Community
Magento Community
Magento Community
 
cshontz
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2007-11-07
 

I also get the same error after adding an attribute - even with files replaced. Any updates on this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
cshontz
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2007-11-07
 

Actually, let me change that - it doesn’t look like I get the error on adding attributes anymore. However, I am still having difficulty editing attributes. This edit behavior is the same as pre-patch, which is what led me to believe the patch didn’t work.

When I try to save after an edit, the page perma-loads for around 25 minutes, and then Firefox times out. The only two settings I attempted to change are:

Values Required: No --> Yes
Visible on Catalog Pages on Front-end: No --> Yes

Any thoughts on this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
cshontz
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2007-11-07
 

When I save after an edit, could it be trying to update all of my 6,000 SKU’s, hence the timeout? None of the SKU’s make use of the attribute yet, however.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sccr410
Sr. Member
 
Total Posts:  76
Joined:  2008-04-02
 

Applying these files only makes Magento think I need to upgrade - I can’t get into the admin or frontend anymore unless I do the upgrade process.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mike222
Member
 
Total Posts:  41
Joined:  2008-04-07
Austria
 

Some more information that may help finding a solution.
I don’t know when it started but in the beginning it was no problem at all to insert/modify attributes. After a while of entering data into the system the well known SQL error occurs when changing an attribute in the admin panel.

Since that the layered navigation in the frontend is also not working correctly anymore. It only shows the categories together with the quantiy, but it does not show any of the other attributes anymore (it worked before for sure!).

Right now even if I open an attribute (e.g. price) and click immediately on the save-button, the error
SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)
occures.

I tried to export the not-working database and import it to another installation where the attribute thing was working. Just changed the dbname in the local.xml file and tried the same thing as above and - voila - the same error occurs.

Therefore I think that the problem is bound to the database content somehow.

If one of the magento-developers want a dump of the database, feel free to contact me at .

 
Magento Community Magento Community
Magento Community
Magento Community
 
sccr410
Sr. Member
 
Total Posts:  76
Joined:  2008-04-02
 

Simply changing hosts away from MediaTemple solved this SQL issue (and the speed issue)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jack Dorris
Jr. Member
 
Total Posts:  25
Joined:  2008-03-31
 

sccr410. can you please let us know the new ISP you moved to, I am on MediaTemple and having same issue. Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
sccr410
Sr. Member
 
Total Posts:  76
Joined:  2008-04-02
 

I moved the site to HostGator and it has no speed issues at all

 
Magento Community Magento Community
Magento Community
Magento Community
 
onesimpleman
Jr. Member
 
Total Posts:  24
Joined:  2008-04-14
 

The solutions seems to get rid of the cardinality error, but attributes seem to have disappeared from shopping options.
Any ideas
Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
shauncrittenden
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2008-04-17
Chicago
 

I am on media temple and I manually patched the listed files. The fix worked for me! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hadifarnoud
Sr. Member
 
Total Posts:  210
Joined:  2007-10-07
Guildford, Surrey, UK
 

I wrote a feed export code for ostokset.fi ( modified version of -not working- bizrate ) :

http://pastebin.com/d53205ee8

here is url of code http://www.halvathinnat.fi/magento/bizrate2.php

and I get SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

my magento is version 1.2.0.1
what should I do? you didn’t mention this fix is for what version.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AMWDS
Jr. Member
 
Total Posts:  1
Joined:  2009-02-14
 

Im using Magento 1.2.1 getting this error, tried your fix and get the following errors when trying to create a new product with custom attributes.

Warning: Invalid argument supplied for foreach() in app/code/core/Mage/Weee/Model/Observer.php on line 37
Trace:

#0 app/code/core/Mage/Weee/Model/Observer.php(37): mageCoreErrorHandler(2, ‘Invalid argumen...’, ‘/home/content/a...’, 37, Array)

#1 app/code/core/Mage/Core/Model/App.php(1166): Mage_Weee_Model_Observer->setWeeeRendererInForm(Object(Varien_Event_Observer))

#2 app/Mage.php(301): Mage_Core_Model_App->dispatchEvent(’adminhtml_catal...’, Array)

#3 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php(98): Mage::dispatchEvent(’adminhtml_catal...’, Array)

#4 app/code/core/Mage/Adminhtml/Block/Widget/Form.php(139): Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes->_prepareForm()

#5 app/code/core/Mage/Core/Block/Abstract.php(642): Mage_Adminhtml_Block_Widget_Form->_beforeToHtml()

#6 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php(78): Mage_Core_Block_Abstract->toHtml()

#7 app/code/core/Mage/Core/Block/Abstract.php(199): Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs->_prepareLayout()

#8 app/code/core/Mage/Core/Model/Layout.php(444): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))

#9 app/code/core/Mage/Core/Model/Layout.php(229): Mage_Core_Model_Layout->addBlock(’Mage_Adminhtml_...’, ‘product_tabs’)

#10 app/code/core/Mage/Core/Model/Layout.php(195): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))

#11 app/code/core/Mage/Core/Model/Layout.php(200): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))

#12 app/code/core/Mage/Core/Controller/Varien/Action.php(295): Mage_Core_Model_Layout->generateBlocks()

#13 app/code/core/Mage/Core/Controller/Varien/Action.php(223): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()

#14 app/code/core/Mage/Adminhtml/Controller/Action.php(230): Mage_Core_Controller_Varien_Action->loadLayout(Array, true, true)

#15 app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(187): Mage_Adminhtml_Controller_Action->loadLayout(Array)

#16 app/code/core/Mage/Core/Controller/Varien/Action.php(367): Mage_Adminhtml_Catalog_ProductController->newAction()

#17 app/code/core/Mage/Core/Controller/Varien/Router/Admin.php(143): Mage_Core_Controller_Varien_Action->dispatch(’new’)

#18 app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Admin->match(Object(Mage_Core_Controller_Request_Http))

#19 app/Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch()

#20 index.php(52): Mage::run()

#21 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
sankatha
Jr. Member
 
Total Posts:  2
Joined:  2009-03-25
United Kingdom
 

I am new Magento so hi everybody grin. I am running a test installation on Magento 1.2.1.2 and had the same issue when I tried to create product (any kind). Also I could not upload any images as well (it shows me the image browser but cannot proceed beyond that point because nothing happens). Tried applying the patch and got the error similar to AMWDS. Anyway after trying so many things like turning off/on cache etc I gave my server a clean reboot and it all worked fine again (I am on Debian 5, Apache 2 and MySQL 5).  Going to dig into the logs if I get the same problem again and will keep posting. Cheers !!!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2