开发者

creating magento groups needs reindexing

开发者 https://www.devze.com 2023-02-06 02:51 出处:网络
We are programmatically creating a customer groups in Magento, and assigning it to the new customers coming to our site. Once this customer logs in, he is not able to see any of the products in the pr

We are programmatically creating a customer groups in Magento, and assigning it to the new customers coming to our site. Once this customer logs in, he is not able to see any of the products in the product catalog. Once we run the reindexing, the customer is able to see the products in the product catalog. If a customer group is already created and reindexing is done, and if we add the customer to that existing customer group, the customer is able to see the products. We need to know why is it necessary to reindex every time we create a new customer group. Is there开发者_Python百科 any other way to avoid reindexing?


maybe you could just try to run the reindex after you created that group. You could achieve this with the following code:

Mage::getResourceModel('catalog/product_flat_indexer')->rebuild();
//assuming you already imported the Mage-class

Since I don't know which index is causing this problem, please have a look at the following links to see how to rebuild the other indexes:

Refresh Magento Cache programmatically

Full list of functions for reindexing


Reindexing is neccessary, because magento creates own price fields for each customer group in the flat tables. In these fields product prices are pre-calculated.

I have the same problem in 1.4.1. But the error occurs when try to reindexing with magento backend.

0

精彩评论

暂无评论...
验证码 换一张
取 消