7
votes

I have multi-store Magento installation, and different product prices are set in different stores. I want to display on one page the actual product price from the current store, and the price from other store (I have its ID), but I'm not sure how to get that info?

The prices are set for each store view for each product, no tier-pricing or special-pricing was used.

1

1 Answers

19
votes

If you know the storeId, set in setStoreId :

/**
 * call the Magento catalog/product model
 * set the current store ID
 * load the product
 */
$product = Mage::getModel('catalog/product')
            ->setStoreId($storeId)
            ->load($key); 

Display in a block :

echo $product->getName();

We can also use print_r to see the values :

print_r($product->getData()); 

The following code will show current store ID :

$storeId    = Mage::app()->getStore()->getId();

To get all product ID's with each store view :

$product    = Mage::getModel('catalog/product');
$products   = $product->getCollection()->addStoreFilter($storeId)->getData();

If you change the $storeId will show different product.