2013-08-21 100 views
0

我有一個magento多存儲設置,並且在創建/刪除存儲視圖時我一定做了一些錯誤,因爲現在當嘗試重新索引catalog_url_rewrite時,出現以下錯誤。任何人有任何想法我可以嘗試?完整性約束違規:1452 - Magento Multistore

2013-08-21T16:45:46+00:00 ERR (3): 
    exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`myserver`.`core_url_rewrite`, CONSTRAINT `FK_CORE_URL_REWRITE_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE C)' in /home/myserver/public_html/lib/Zend/Db/Statement/Pdo.php:228 
    Stack trace: 
    #0 /home/myserver/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) 
    #1 /home/myserver/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) 
    #2 /home/myserver/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array) 
    #3 /home/myserver/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) 
    #4 /home/myserver/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `co...', Array) 
    #5 /home/myserver/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `co...', Array) 
    #6 /home/myserver/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1910): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `co...', Array) 
    #7 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Resource/Url.php(300): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('core_url_rewrit...', Array) 
    #8 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Url.php(293): Mage_Catalog_Model_Resource_Url->saveRewrite(Array, NULL) 
    #9 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Url.php(320): Mage_Catalog_Model_Url->_refreshCategoryRewrites(Object(Varien_Object), '/', false) 
    #10 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Url.php(461): Mage_Catalog_Model_Url->_refreshCategoryRewrites(Object(Varien_Object), NULL, false) 
    #11 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Url.php(254): Mage_Catalog_Model_Url->refreshCategoryRewrite('318', '130', false) 
    #12 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Url.php(248): Mage_Catalog_Model_Url->refreshRewrites('130') 
    #13 /home/myserver/public_html/app/code/core/Mage/Catalog/Model/Indexer/Url.php(257): Mage_Catalog_Model_Url->refreshRewrites() 
    #14 /home/myserver/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Indexer_Url->reindexAll() 
    #15 /home/myserver/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll() 
    #16 /home/myserver/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(178): Mage_Index_Model_Process->reindexEverything() 
    #17 /home/myserver/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Index_Adminhtml_ProcessController->massReindexAction() 
    #18 /home/myserver/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('massReindex') 
    #19 /home/myserver/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)) 
    #20 /home/myserver/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() 
    #21 /home/myserver/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array) 
    #22 /home/myserver/public_html/index.php(87): Mage::run('', 'store') 
    #23 {main} 

回答

0

看起來您已經刪除了一些商店ID或商店。

如果商店ID不存在於'core_store'表中,就會發生這種情況。

+0

我做過了,是否應該爲商店添加一個商店ID行來解決問題,否則我會更加頭痛?我注意到即使該商店不存在於'core_store'中,我仍然有catalog_product_flat_131 – willboudle

+0

刪除商店標識不存在的所有平面表。您需要檢查以前的數據,以便在缺少core_store表上進行輸入並插入一個。 – oscprofessionals

相關問題