Product collection to get canonical product url By cron process
-
30-10-2019 - |
Question
its really strange to get such kind of issue relate to get product correct url
below is my collection to get product information
$store = Mage::app()->getDefaultStoreView();
$rootCategoryId = $store->getRootCategoryId();
// Gets the current store's id
$storeId = $store->getStoreId();
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')
->addStoreFilter($storeId)
->addAttributeToFilter(
'entity_id',
array('lt' => 2500)
)
->addAttributeToFilter(
'entity_id',
array('gt' => 2100)
)
->addAttributeToFilter(
'status',
array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
)->addUrlRewrite($rootCategoryId);
when i will run this process by CLI ( means any php file to call this collection its given my correct url of product
but problem is occurred when this collection is called by any cron process with cron_schedule table
i am getting below url
http://www.anydomain.com/index.php/catalog/product/view/id/2107/s/product-url
by i need only
http://www.anydomain.com/product-url
above result is working fine with any CLI (means with php file to call this collection)
but its not working with Cron process.
would you please help me to get it done.any suggestion would be appreciate.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange