Next Webinar: Maximizing Magento - Get the Most out of Promotions. Register Today!

Magento

Open Source eCommerce Evolved

Magento Forum

   
FIX for “SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)”
 
Michael
Magento Team
 
Total Posts:  640
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: 88)
AttributeController.php  (File Size: 10KB - Downloads: 71)
Indexer.php  (File Size: 16KB - Downloads: 73)
files.zip  (File Size: 9KB - Downloads: 101)
patch.txt  (File Size: 3KB - Downloads: 77)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Dave Smith
Jr. Member
 
Avatar
Total Posts:  19
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?

 Signature 

the now: musicline-ltd.com | the soon to be: musiclinedirect.com

 
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:  85
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:  85
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:  85
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
Member
 
Total Posts:  48
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
Jr. Member
 
Total Posts:  26
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 .

 Signature 

Blu-ray Onlineshop
http://www.blu-ray-onlineshop.at

 
Magento Community Magento Community
Magento Community
Magento Community
 
sccr410
Member
 
Total Posts:  48
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:  18
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
Member
 
Total Posts:  48
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:  6
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
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
40937 users|343 users currently online|87592 forum posts