Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Cardinality violation: 1242 Subquery returns more than 1 row
 
cmavroudis
Jr. Member
 
Total Posts:  20
Joined:  2011-06-13
 

Hi

Can anyone please help me on this issue as I am finding it very difficult to undertsand

I have been making some amends on my website and it has suddenly started to throw the error below if I try to add multiple items into my basket, everything was fine prior to today but I cant figure out what the issue is.

Cardinality violation1242 Subquery returns more than 1 row

I have recently made the following changes to my site (which i guess may have caused the error but i dont know):
- deleted some old products and added new products
- added new categories and reassigned all my products from old categories to the new categories (i deleted all old categories completely). 
I found that it does not work to retrospectively turn on the ‘in-anchor’ field on already live categories with associated products… the products from the child categories simply would not appear within the parent category.  I therefore had to create exact replica copies of the categories from scratch (same name, label, url etc) with ‘is_anchor’ enabled and then reassign my products to that category.
- chmod’d a whole load of files in order to use Magento Connect on my live site (then chmod’d back again)
- installed the royal mail magento extension for shipping purposes.

Can anybody please help me to solve this issue, would be much appreciated

Thanks
Costas

There has been an error processing your request
SQLSTATE[21000]
Cardinality violation1242 Subquery returns more than 1 row

Trace
:
#0 /home/admin/domains/ks.com/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/admin/domains/ks.com/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/admin/domains/ks.com/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/admin/domains/ks.com/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(DI...', Array)
#4 /home/admin/domains/ks.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(DI...', Array)
#5 /home/admin/domains/ks.com/public_html/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/admin/domains/ks.com/public_html/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
#7 /home/admin/domains/ks.com/public_html/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db->getSize()
#8 /home/admin/domains/ks.com/public_html/lib/Varien/Data/Collection.php(211): Varien_Data_Collection->getLastPageNumber()
#9 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1036): Varien_Data_Collection->getCurPage()
#10 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#11 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php(74): Mage_Eav_Model_Entity_Collection_Abstract->load()
#12 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php(94): Mage_Catalog_Block_Product_List_Upsell->_prepareData()
#13 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Catalog_Block_Product_List_Upsell->_beforeToHtml()
#14 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#15 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('upsell_products', true)
#16 /home/admin/domains/ks.com/public_html/app/design/frontend/ks/default/template/catalog/product/view.phtml(104): Mage_Core_Block_Abstract->getChildHtml('upsell_products')
#17 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/admin/dom...')
#18 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/kukist...')
#19 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#20 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#21 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#22 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#23 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#24 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#25 /home/admin/domains/ks.com/public_html/app/design/frontend/ks/default/template/page/2columns-right.phtml(88): Mage_Core_Block_Abstract->getChildHtml('content')
#26 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/admin/dom...')
#27 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/kukist...')
#28 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#29 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#30 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#31 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#32 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#33 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#34 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#35 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->noRouteAction()
#36 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#37 /home/admin/domains/ks.com/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))
#38 /home/admin/domains/ks.com/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#39 /home/admin/domains/ks.com/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#40 /home/admin/domains/ks.com/public_html/index.php(87): Mage::run('', 'store')
#41 {main}
 
Magento Community Magento Community
Magento Community
Magento Community
 
cmavroudis
Jr. Member
 
Total Posts:  20
Joined:  2011-06-13
 

just to post a follow to provide more detail, I ran the following chmod commands prior to finding out my site had broken.. Im not sure if this may have caused the issue but i thought id share it…

I had this error when trying to use magento connect on live:
Magento Connect issues on live due to 'Warning: Your Magento folder does not have sufficient write permissions.':

Because of this error I ran the following in ssh...
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+var var/.htaccess app/etc
chmod 550 mage
chmod 
-R o+w media

It didnt work so I did the following
...

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 777 {} \;
chmod o+var/.htaccess
chmod 550 mage

Connect worked fine so i downloaded the extension i needed 
(royal mail)

I then rolled back the permissions
find 
. -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+var var/.htaccess app/etc
chmod 550 mage
chmod 
-R o+w media
chmod 
-R 777 var/

I got a package.xl read error and so I chmod'd this file (and back again)
cd /home/admin/domains/ks.com/public_html/var/package/tmp

Thanks
Costas

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sindre|ProperHost
Mentor
 
Avatar
Total Posts:  1158
Joined:  2008-04-24
 

If you look at the stack trace there is a mentioning of a file in your template:

/home/admin/domains/ks.com/public_html/app/design/frontend/ks/default/template/catalog/product/view.phtml

I am guessing that your template contains some code not compatible with the new version of Magento. As an experiment, you can try to revert back to the default template and see if the store then loads. Just temporary rename the “frontend/ks” directory. If that is the case, the core Magento files are ok so you just need to work with your template to make it compatible.

There is also a similar thread here: http://www.magentocommerce.com/boards/viewthread/264748/#t367485

 
Magento Community Magento Community
Magento Community
Magento Community
 
cmavroudis
Jr. Member
 
Total Posts:  20
Joined:  2011-06-13
 

HI,

Thanks for your reply.

I did resort back to the custom themes and I was still getting the error. 

In the end, I reinstalled from scratch and reintroduced my theme

It worked after doing that but I never figured out what was causing the original error.

Thanks for your help nonetheless
Costas

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top