开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜