【问题标题】:Magento Category Flat Data will not reindex error 'There was a problem with reindexing process.'Magento 类别平面数据不会重新索引错误“重新索引过程出现问题。”
【发布时间】:2011-09-26 14:25:24
【问题描述】:

我最近将 1.5.0.1 版的 magento 安装移动到实时服务器,但是前端没有显示任何产品。检查索引后,我发现 Category Flat Data 索引需要重新编制索引,但是在尝试重新编制索引时,我收到一个错误通知框,提示“重新编制索引过程存在问题。”

到目前为止,我已经尝试了以下

  1. 重置文件夹权限755,文件权限664

    找到 . -type f -exec chmod 644 {} \;

    找到 . -type d -exec chmod 755 {} \;

  2. 删除 var 文件夹的内容,包括缓存和锁定文件夹

  3. 尝试使用来自 public_html/shell 的以下命令通过控制台手动处理索引

    php indexer.php 重新索引

我已经检查了错误日志并且存在以下内容

2011-09-26T08:16:11+00:00 DEBUG (7): Exception message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
`store_id` smallint(5) unsigned not null default '0',
`all_children` text defau' at line 10
Trace: #0 /home/bboutique/www.bassboutique.co.uk/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/bboutique/www.bassboutique.co.uk/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/bboutique/www.bassboutique.co.uk/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE `c...', Array)
#3 /home/bboutique/www.bassboutique.co.uk/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE `c...', Array)
#4 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php(526): Varien_Db_Adapter_Pdo_Mysql->query('CREATE TABLE `c...')
#5 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php(433): Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat->_createTable('1')
#6 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php(237): Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat->rebuild()
#7 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Index/Model/Process.php(139): Mage_Catalog_Model_Category_Indexer_Flat->reindexAll()
#8 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Index/Model/Process.php(167): Mage_Index_Model_Process->reindexAll()
#9 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(124): Mage_Index_Model_Process->reindexEverything()
#10 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Index_Adminhtml_ProcessController->reindexProcessAction()
#11 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('reindexProcess')
#12 /home/bboutique/www.bassboutique.co.uk/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))
#13 /home/bboutique/www.bassboutique.co.uk/public_html/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#14 /home/bboutique/www.bassboutique.co.uk/public_html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#15 /home/bboutique/www.bassboutique.co.uk/public_html/index.php(80): Mage::run('', 'store')
#16 {main}

任何帮助将不胜感激

谢谢

伊恩

【问题讨论】:

  • 我遇到了一些流氓 SQL 语句的问题,这些语句需要我深入到数据库方法中并打印出语句,这样我才能看到问题出在哪里。您可能需要在其中调用一些 print $sq; 来查看有问题的语句是什么。
  • 正如@jprofitt 所说,转到文件/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php,第526 行并回显生成的创建表查询。

标签: php mysql zend-framework magento


【解决方案1】:

我在将 Magento 的示例数据加载到 Magento 1.5.1.0 时遇到了同样的错误(尽管 Varien 这么说,他们的示例数据不适用于所有 Magento 版本)

在 /app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php 我在第 549 行找到了这个:

switch ($column['DATA_TYPE']) {
                案例“smallint”:
                案例'int':
                    $_type = $column['DATA_TYPE'] 。 '(11)';
                    $_is_unsigned = (bool)$column['UNSIGNED'];
                    if ($column['DEFAULT'] === '') {
                        $column['DEFAULT'] = null;
                    }
                    休息;
                案例'varchar':............

'timestamp' 没有 case 语句; Magento 在 Magento 1.6.1.0 中用于“updated_at”和“created_at”列的数据类型

我做了一些 alter table 语句,将 catalog_category_entity 和 catalog_product_entity 中的 'timestamp' 列更改为 'datetime',索引问题就消失了。

我现在对示例数据中的所有“时间戳”列进行了查找和替换,以使其与 1.5.1.0 兼容

我希望这对某人有帮助:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-19
    • 1970-01-01
    相关资源
    最近更新 更多