user586921
user586921

Reputation: 11

creating magento groups needs reindexing

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 any other way to avoid reindexing?

Upvotes: 1

Views: 957

Answers (2)

Oliver
Oliver

Reputation: 1

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.

Upvotes: 0

Tim
Tim

Reputation: 5943

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

Upvotes: 1

Related Questions