0

自从我从 1.6.2 升级到 1.7 以来,我在 magento 中遇到了错误。我对 Zend DB 调用不太熟悉,也无法找出这些错误。

2013-09-11T15:52:15+00:00 ERR (3): 
exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_increment_id' in 'where clause'' in   lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0   lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1   lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2   lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3   lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4   lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#5   lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#6   lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#7   lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#8   app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#9   lib/Varien/Data/Collection/Db.php(566): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#10   lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#11   app/code/core/Mage/Sales/Model/Order/Shipment/Api.php(76): Varien_Data_Collection->getIterator()
#12 [internal function]: Mage_Sales_Model_Order_Shipment_Api->items(Array)
#13   app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(296): call_user_func_array(Array, Array)
#14 [internal function]: Mage_Api_Model_Server_Handler_Abstract->call('ec5d1479c284c4c...', 'sales_order_shi...', Array)
#15   lib/Zend/Soap/Server.php(832): SoapServer->handle('<?xml version="...')
#16   app/code/core/Mage/Api/Model/Server/Adapter/Soap.php(150): Zend_Soap_Server->handle()
#17   app/code/core/Mage/Api/Model/Server.php(138): Mage_Api_Model_Server_Adapter_Soap->run()
#18   app/code/core/Mage/Api/controllers/SoapController.php(40): Mage_Api_Model_Server->run()
#19   app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Api_SoapController->indexAction()
#20   app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#21   app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#22   app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#23   app/Mage.php(686): Mage_Core_Model_App->run(Array)
#24   index.php(87): Mage::run('', 'store')
#25 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_increment_id' in 'where clause'' in   lib/Zend/Db/Statement/Pdo.php:234
Stack trace:
#0   lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1   lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2   lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3   lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4   lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5   lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#6   lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#7   app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#8   lib/Varien/Data/Collection/Db.php(566): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#9   lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#10   app/code/core/Mage/Sales/Model/Order/Shipment/Api.php(76): Varien_Data_Collection->getIterator()
#11 [internal function]: Mage_Sales_Model_Order_Shipment_Api->items(Array)
#12   app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(296): call_user_func_array(Array, Array)
#13 [internal function]: Mage_Api_Model_Server_Handler_Abstract->call('ec5d1479c284c4c...', 'sales_order_shi...', Array)
#14   lib/Zend/Soap/Server.php(832): SoapServer->handle('<?xml version="...')
#15   app/code/core/Mage/Api/Model/Server/Adapter/Soap.php(150): Zend_Soap_Server->handle()
#16   app/code/core/Mage/Api/Model/Server.php(138): Mage_Api_Model_Server_Adapter_Soap->run()
#17   app/code/core/Mage/Api/controllers/SoapController.php(40): Mage_Api_Model_Server->run()
#18   app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Api_SoapController->indexAction()
#19   app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#20   app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21   app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#22   app/Mage.php(686): Mage_Core_Model_App->run(Array)
#23   index.php(87): Mage::run('', 'store')
#24 {main}

这些错误似乎源自 app/code/core/Mage/Sales/Model/Order/Shipment/Api.php(76) 并且这些是相关行。

47     /**
48      * Retrieve shipments by filters
49      *
50      * @param null|object|array $filters
51      * @return array
52      */
53     public function items($filters = null)
54     {
55         $shipments = array();
56         //TODO: add full name logic
57         $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
58             ->addAttributeToSelect('increment_id')
59             ->addAttributeToSelect('created_at')
60             ->addAttributeToSelect('total_qty')
61             ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
62             ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
63             ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
64             ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left');
65 
66         /** @var $apiHelper Mage_Api_Helper_Data */
67         $apiHelper = Mage::helper('api');
68         try {
69             $filters = $apiHelper->parseFilters($filters, $this->_attributesMap['shipment']);
70             foreach ($filters as $field => $value) {
71                 $shipmentCollection->addFieldToFilter($field, $value);
72             }
73         } catch (Mage_Core_Exception $e) {
74             $this->_fault('filters_invalid', $e->getMessage());
75         }
76         foreach ($shipmentCollection as $shipment) {
77             $shipments[] = $this->_getAttributes($shipment, 'shipment');
78         }
79 
80         return $shipments;
81     }

一切似乎都很好,但我可能找错了地方。任何帮助,将不胜感激。

4

1 回答 1

0

尝试使用这个 Magento 数据库修复工具,它应该可以帮助你http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool

于 2013-09-20T21:30:57.847 回答