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('*')
                        array('lt' => 2500)
                        array('gt' => 2100)
                        array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)

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


by i need only


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.

1 Answer 1


Got this work to set store id in product collection's product object

Just need to add this like

 foreach ($collection as $product)

so in mode/product/url.php

this will get true

 $rewrite = $this->getUrlRewrite();
        if ($rewrite->getId()) {

and you can get value from rewrite table.

hope this will sure help you someone which could be face this type of issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.