SQLSTATE[21000]: Cardinality violation: When product in more than one category - Magento
I've been battling with this for a while.
I get a cardinality violation when adding a product to cart that is in more than one catergory.
SQLST开发者_如何学编程ATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)
Anybody come across this?
I was getting SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)
I was trying to delete some data in my controller's massDeleteAction
foreach ($categoryIds as $categoryId) {
$category = Mage::getModel('look/category')->load($categoryIds);
$category->delete();
}
Notice the line
$category = Mage::getModel('look/category')->load($categoryIds);
After changing the code to
foreach ($categoryIds as $categoryId) {
$category = Mage::getModel('look/category')->load($categoryId);
$category->delete();
}
Problem resolved
精彩评论