how to refresh magento tier price cache after sql insert
I've imported new tier prices into the magento database using the sql shown below and when I view the product in the admin, the tiers are correct. However, on the front-end, the tiers are not displayed under I Save the product in the back-end.
I've deleted the var/cache, rebuilt the Catalog Index, refreshed Inventory Stock Status (?) and even tried doing a bulk Update Attributes on those products, none of which seem to refresh the price cache. I can't find any value in the product entity tables that relate to tier pricing to tweak.
I see that there is a Price
object in Mage_CatalogIndex
which makes me think that it needs refreshing...
I'm using Magento v1.3.2.4 and have a couple of hundred SKUs that I don't want to manually have to Save in the backend!
insert ignore into `catalog_product_entity_tier_price` (all_groups, customer_group_id, qty, entity_id, `value`) select '0','5','12',entity_id,'10' from `catalog_product_entity` where category_ids = 3;
All suggestions welcome.
Thanks, JD开发者_开发知识库
I wonder if trying something like this will help?
$productsForCatalogIndexUpdate = array(123,1231); //Add your product ids here
if (count($productsForCatalogIndexUpdate)) {
Mage::log("About to update the catalog price index on the following products " . join(', ', $productsForCatalogIndexUpdate));
Mage::getModel('catalogindex/indexer')->plainReindex(
$productsForCatalogIndexUpdate,
Mage_CatalogIndex_Model_Indexer::REINDEX_TYPE_PRICE
);
Mage::getModel("catalogindex/observer")->clearPriceAggregation();
}
If I remember correctly it rebuilds the price index tables for the specified prices.
精彩评论