Search This Blog

Saturday, July 13, 2013

Magento code for url rewrite and flat table indexing product id wise and store wise

  • Magento code for url rewrite and flat table indexing product id wise and store wise
  • How to index individual /particular product in magento, store wise, for single product or single id,
  • Code in magento indexing with sku, product id, flat table indexing with single product
  • Magento indexing with sku, product id, flat table indexing with single product

For particular store

$productId=array(166,162);
$storeId=1;
Mage::getModel('catalog/product_flat_indexer')->updateProduct(array($productId),$storeId);

For all stores 
$productId=array(166,162);
$storeId=null;
Mage::getModel('catalog/product_flat_indexer')->updateProduct(array($productId),$storeId);



For URL indexing check or core url rewrite

taken from app/code/core/Mage/Catalog/Model/Url.php
Mage::getModel('catalog/url')->refreshProductRewrite($productId,$storeId);
Run url rewrite first and then for flat