0

I have two store in my magento site, I want to get product_ids for which price is not matched for both stores.

For Example:

$collection = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToSelect(array('entity_id','price'));

foreach($collection as $val)
{
    $product = Mage::getModel('catalog/product')->setStoreId('1')->load($val->getEntityId());
    if($val->getPrice() != $product->getPrice())
    {
        // here I can get product_ids for which price are different for both stores
    }
}

The above script is working and returning product_ids as my requirement, but I have more than 35000 products in my site and this script takes time to execute or sometime it gives timeout error.

Is there any other method using magento or php functions so that I can get those product_ids in an array?

0

Set Flat Catalog Product Reffer

Then try below code (Not Tested)

$collection = Mage::getResourceModel('catalog/product_collection');//Collection from current store
$collection->getSelect()->join(array('storeOne'=> 'catalog_product_flat_1'),'main_table.price!=storeOne.price',array('*'));

echo '<pre>';
    print_r($collection);

For more Detail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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