Magento mass_action指数 - 它们如何运作?

时间:2015-11-24 07:47:34

标签: magento indexing magento-1.9

我已经创建了一些代码来更新Magento的价格。我发现更新产品对象本身有点慢 - 所以我发现这可以一次更新单个属性,而且速度更快。

Mage::getSingleton('catalog/product_action')->updateAttributes(array($prod->getId()), array('price',10), $storeId);

当我运行它时,会在index_event表中创建一个条目 -

输入:mass_action,

实体:catalog_product

NEW_DATA

一个:12:{S:35: “cataloginventory_stock_match_result”; B:1; S:41: “Mage_CatalogInventory_Model_Indexer_Stock”;一个:1:{S:35: “cataloginventory_stock_match_result”; B:1;} S:34: “catalog_product_price_match_result”; b:1; S:40: “Mage_Catalog_Model_Product_Indexer_Price”;一个:2:{S:34: “catalog_product_price_match_result”; b:1; S:25: “reindex_price_product_ids”;一个:11:{I:0; S:2: “39”; I:1; S:3: “363”; I:2; S:3: “367”; I:3; S:3: “371”; I:4; S: 3: “375”; I:5; S:3: “379”; I:6; S:3: “383”; I:7; S:3: “387”; I:8; S:3: “391”; I:9; S:3: “395”; I:10; S:3: “399”;}} S:24: “catalog_url_match_result”; b:0; S:33: “catalog_product_flat_match_result”; b:1; S:39: “Mage_Catalog_Model_Product_Indexer_Flat”;一个:3:{S:33: “catalog_product_flat_match_result”; b:1; S:33: “catalog_product_flat_force_update”; b:1; S:32: “catalog_product_flat_product_ids”;一个:11:{I:0; S:2: “39”; I:1; S:3: “363”; I:2; S:3: “367”; I:3; S:3:“371 “我:4; S:3:” 375 “; I:5; S:3:” 379 “; I:6; S:3:” 383 “; I:7; S:3:” 387" ; I:8; S:3: “391”; I:9; S:3: “395”; I:10; S:3: “399”;}} S:34: “catalog_category_flat_match_result”; b:0; S:37:“catalog_category_product_ match_result “; B:1; S:43:” Mage_Catalog_Model_Category_Indexer_Product “;一个:1:{S:37:” catalog_category_product_match_result “; B:1;} S:35:” catalogsearch_fulltext_match_result “; B:1; S:41:” Mage_CatalogSearch_Model_Indexer_Fulltext “;一个:3:{S:35:” catalogsearch_fulltext_match_result “; b:1; S:27:” catalogsearch_force_reindex “; b:1; S:25:” catalogsearch_product_ids“;一个:11:{I:0; S :2: “39”; I:1; S:3: “363”; I:2; S:3: “367”; I:3; S:3: “371”; I:4; S:3 : “375”; I:5; S:3: “379”; I:6; S:3: “383”; I:7; S:3: “387”; I:8; S:3:” 391 “; I:9; S:3:” 395 “; I:10; S:3:” 399" ;}}}

我发现当我在循环中运行代码时,会自动添加此记录。

这个数据是否只用于重新索引受影响的产品?

如果启用了“手动索引”,会发生什么?

这对我来说是新的,所以希望有人有一些答案。

1 个答案:

答案 0 :(得分:0)

Magento能够在每次产品更新操作时触发索引事件。在您的情况下,您尝试通过批量操作更新产品。因此,magento会触发完全重建索​​引。

  1. 如果产品数量较少,您可以使用Magento模型而不是动作。

  2. 否则,通过将标志is_visible更改为false来停止索引进程;在以下路径Mage / Catalog / Model / Product / Indexer / Price.php。这将限制自动索引过程。

  3. 脚本完成后。你可以做手工价格指数。