Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento 1.6.2不能重新索引产品平面数据_Php_Mysql_Magento - Fatal编程技术网

Php Magento 1.6.2不能重新索引产品平面数据

Php Magento 1.6.2不能重新索引产品平面数据,php,mysql,magento,Php,Mysql,Magento,我们的magento 1.6.2无法重新索引产品平面数据。它有时还显示“重新编制索引的过程存在问题” 我从其他用户的经验中尝试了许多解决方案。没有结果。我们进口了大宗产品,但我们不确定这是否是重新编制索引问题的原因 理想的解决方案是什么 这是我在shell中使用的命令: php /usr/local/lsws/fcgi-bin/lsphp5 /home/user/domains/my domain../public_html/shell/indexer.php 这是exception.log

我们的magento 1.6.2无法重新索引产品平面数据。它有时还显示“重新编制索引的过程存在问题”

我从其他用户的经验中尝试了许多解决方案。没有结果。我们进口了大宗产品,但我们不确定这是否是重新编制索引问题的原因

理想的解决方案是什么

这是我在shell中使用的命令:

php /usr/local/lsws/fcgi-bin/lsphp5 /home/user/domains/my domain../public_html/shell/indexer.php 
这是exception.log中的错误

2012-08-09T14:55:43+00:00 DEBUG (7): Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`galagearbox/#sql-1662_1fc419`, CONSTRAINT `FK_CAT_PRD_FLAT_4_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCA)
Trace: #0 /home/corecolu/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/corecolu/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/corecolu/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/corecolu/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/corecolu/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/corecolu/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/corecolu/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(327): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/corecolu/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2548): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/corecolu/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/corecolu/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(4)
#10 /home/corecolu/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/corecolu/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/corecolu/public_html/app/code/core/Mage/Index/Model/Process.php(207): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/corecolu/public_html/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#14 /home/corecolu/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(124): Mage_Index_Model_Process->reindexEverything()
#15 /home/corecolu/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Index_Adminhtml_ProcessController->reindexProcessAction()
#16 /home/corecolu/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('reindexProcess')
#17 /home/corecolu/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))
#18 /home/corecolu/public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#19 /home/corecolu/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#20 /home/corecolu/public_html/index.php(83): Mage::run('', 'store')
#21 {main}

在Magento中重新索引错误可能有很多原因,因此我担心永远不会有一个覆盖所有可能错误的“理想”解决方案

由于您发布了一条非技术性错误消息,我猜您尝试使用管理后端重新索引产品平面数据,并在那里看到了错误消息

我建议再次尝试重新编制索引,但这次使用
shell/indexer.php

/usr/bin/php -f /abs/path/to/shell/indexer.php -- --reindex catalog_product_flat
这样,如果重新索引失败,您将获得更有意义的技术错误消息

下面是一个列表,其中显示了将哪个参数用于哪个索引:

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog URL Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock Status
tag_summary                   Tag Aggregation Data
更新 您在帖子中添加的例外说明

catalog_product_flat_4.entity_id

被发现已损坏

通常这意味着一些记录在
目录产品实体.entity\u id
字段中包含
null
,其中它们应该包含现有的
实体id

在尝试修复此问题之前,请先备份数据库

现在,要查找损坏的记录,请使用以下方法查询数据库:

SELECT
    a.entity_id
FROM
    catalog_product_flat_4 AS a
LEFT JOIN
    catalog_product_entity AS b ON a.entity_id = b.entity_id
WHERE
    ISNULL(b.entity_id)
此查询找到的
实体id
s是表
目录产品\u平面\u 4
中的
实体id
s,它们已损坏,需要删除


删除
目录\u产品\u平面\u 4中的相应记录,然后再次尝试重新编制索引。

在Magento中重新编制错误索引可能有很多原因,因此恐怕永远不会有一个涵盖所有可能错误的“理想”解决方案

create one file like reindex.php in your magento root directory with following code

<?php

    enter code here

// when you get status "Processing" instead of "Ready" in your index management run this script and it's working fine
// change the index order as per your requirement currently it's 7 for Catalog Search Index  you can set as per your requirement

require_once 'app/Mage.php';
umask( 0 );
Mage :: app( "default" );
Mage::log("Started Rebuilding Search Index At: " . date("d/m/y h:i:s"));
$sql = "truncate catalogsearch_fulltext;";
$mysqli = Mage::getSingleton('core/resource')->getConnection('core_write');
$mysqli->query($sql);
$process = Mage::getModel('index/process')->load(7);
$process->reindexAll();
Mage::log("Finished Rebuilding Search Index At: " . date("d/m/y h:i:s"));

now save it and run it using browser and it will solved your problem

I hope you will get your solution. I will help you if you still getting problem.
由于您发布了一条非技术性错误消息,我猜您尝试使用管理后端重新索引产品平面数据,并在那里看到了错误消息

我建议再次尝试重新编制索引,但这次使用
shell/indexer.php

/usr/bin/php -f /abs/path/to/shell/indexer.php -- --reindex catalog_product_flat
这样,如果重新索引失败,您将获得更有意义的技术错误消息

下面是一个列表,其中显示了将哪个参数用于哪个索引:

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog URL Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock Status
tag_summary                   Tag Aggregation Data
更新 您在帖子中添加的例外说明

catalog_product_flat_4.entity_id

被发现已损坏

通常这意味着一些记录在
目录产品实体.entity\u id
字段中包含
null
,其中它们应该包含现有的
实体id

在尝试修复此问题之前,请先备份数据库

现在,要查找损坏的记录,请使用以下方法查询数据库:

SELECT
    a.entity_id
FROM
    catalog_product_flat_4 AS a
LEFT JOIN
    catalog_product_entity AS b ON a.entity_id = b.entity_id
WHERE
    ISNULL(b.entity_id)
此查询找到的
实体id
s是表
目录产品\u平面\u 4
中的
实体id
s,它们已损坏,需要删除

删除
catalog\u product\u flat\u 4中的相应记录,然后再次尝试重新索引。

使用以下代码在magento根目录中创建一个类似reindex.php的文件
create one file like reindex.php in your magento root directory with following code

<?php

    enter code here

// when you get status "Processing" instead of "Ready" in your index management run this script and it's working fine
// change the index order as per your requirement currently it's 7 for Catalog Search Index  you can set as per your requirement

require_once 'app/Mage.php';
umask( 0 );
Mage :: app( "default" );
Mage::log("Started Rebuilding Search Index At: " . date("d/m/y h:i:s"));
$sql = "truncate catalogsearch_fulltext;";
$mysqli = Mage::getSingleton('core/resource')->getConnection('core_write');
$mysqli->query($sql);
$process = Mage::getModel('index/process')->load(7);
$process->reindexAll();
Mage::log("Finished Rebuilding Search Index At: " . date("d/m/y h:i:s"));

now save it and run it using browser and it will solved your problem

I hope you will get your solution. I will help you if you still getting problem.
使用以下代码在magento根目录中创建一个类似reindex.php的文件

magento可编程重新索引 身份证号码

1目录\产品\属性

2目录产品价格

3目录url

4产品目录

5目录类公寓

6目录\类别\产品

7目录搜索库存

8存货目录

9 tag_摘要

对于($i=1;$i加载($i)

$process->reindexAll()


}

magento以编程方式重新编制索引 身份证号码

1目录\产品\属性

2目录产品价格

3目录url

4产品目录

5目录类公寓

6目录\类别\产品

7目录搜索库存

8存货目录

9 tag_摘要

对于($i=1;$i加载($i)

$process->reindexAll()


}

谢谢,我在shell/inder.php警告中收到以下错误:输入中出现意外字符:“第654行的in/usr/local/lsws/fcgi-bin/lsphp-5.3.10解析错误:语法错误,第654行的/usr/local/lsws/fcgi-bin/lsphp-5.3.10中出现意外T_字符串[~]#警告:输入中出现意外字符:“在第654行的/usr/local/lsws/fcgi bin/lsphp-5.3.10中,请忽略indexer.php拼写错误此
lsphp-5.3.10
不是标准的Magento文件。请在文件
lsphp-5.3.10
的第654行附近发布代码,最好是在您的问题中(注释中不可读)。谢谢,我很有希望,我会尝试。只是想知道包含主要产品信息的表。从哪个表目录\u产品\u平面表在重新编制索引后获取信息?它们从为产品实体定义的多个EAV表中获取数据,主要是
目录\u产品\u实体\u*
。谢谢,我得到了shell/inder.php警告出现以下错误:输入中出现意外字符:“第654行的/usr/local/lsws/fcgi-bin/lsphp-5.3.10解析错误:语法错误,第654行的/usr/local/lsws/fcgi-bin/lsphp-5.3.10中出现意外的T_字符串[~]#警告:输入中出现意外字符:“在第654行的/usr/local/lsws/fcgi bin/lsphp-5.3.10中,请忽略indexer.php拼写错误此
lsphp-5.3.10
不是标准的Magento文件。请在文件
lsphp-5.3.10
的第654行附近发布代码,最好是在您的问题中(注释中不可读)。谢谢,我很有希望,我会尝试。只是想知道包含主要产品信息的表。重新编制索引后,从哪个表目录\u产品\u平板表中获取信息?它们得到的是