Проблема с ценой переиндексации (список значений не соответствует списку столбцов)


Кто-то использовал модуль Innoext_AdvancePricing? После перехода на Magento 1.7 переиндексация завершается сбоем или вставкой неверных данных.

Трассировка стека сбоев:

Exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1' 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(320): 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('INSERT INTO `ca...', Array)
#4 lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 app/code/local/Innoexts/AdvancedPricing/Model/Mysql4/Catalog/Product/Indexer/Price/Configurable.php(222): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
#6 app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Configurable.php(50): Innoexts_AdvancedPricing_Model_Mysql4_Catalog_Product_Indexer_Price_Configurable->_applyConfigurableOption()
#7 app/code/local/Innoexts/AdvancedPricing/Model/Mysql4/Catalog/Product/Indexer/Price.php(167): Mage_Catalog_Model_Resource_Product_Indexer_Price_Configurable->reindexAll()
#8 /app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Innoexts_AdvancedPricing_Model_Mysql4_Catalog_Product_Indexer_Price->reindexAll()
#9 app/code/core/Mage/Index/Model/Process.php(209): Mage_Index_Model_Indexer_Abstract->reindexAll()
#10 app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#11 shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#12 shell/indexer.php(198): Mage_Shell_Compiler->run()
#13 {main}

Неверные данные в таблице catalog_product_index_price:

currency is always '0.0' (should be EUR, GBP etc)
store_id is always 0

Я буду благодарен за любую помощь.

Author: Marcin Rogacki, 2013-09-09

1 answers

Это был беспорядок с таблицами (конечно, из-за Column count doesn't match). Каким-то образом столбец из catalog_product_index_table был удален или не добавлен.

Кроме того, важен порядок столбцов в приведенном ниже методе.

Innoexts_AdvancedPricing_Model_Mysql4_Catalog_Product_Indexer_Price_Configurable::_prepareFinalPriceData()

Особенно для тех, которые являются частью первичного ключа (entity_id,customer_group_id,website_id,currency,store_id).

Например,

    if ($this->getVersionHelper()->isGe1700()) {
        $select->columns(array(
            'group_price'      => new Zend_Db_Expr('gp.price'), 
            'base_group_price' => new Zend_Db_Expr('gp.price'), 
        )); 
    }   
    $select->columns(array(
        'currency'      => $indexerHelper->getCurrencyExpr('cw.website_id'), 
        'store_id'      => new Zend_Db_Expr('cs.store_id'), 
    ));

Может отличаться в зависимости от того, как упорядочены столбцы в таблице:

    $select->columns(array(
        'currency'      => $indexerHelper->getCurrencyExpr('cw.website_id'), 
        'store_id'      => new Zend_Db_Expr('cs.store_id'), 
    ));
    if ($this->getVersionHelper()->isGe1700()) {
        $select->columns(array(
            'group_price'      => new Zend_Db_Expr('gp.price'), 
            'base_group_price' => new Zend_Db_Expr('gp.price'), 
        )); 
    }   
 2
Author: Marcin Rogacki, 2013-09-23 09:56:24