I’ve just set up a Magento multi-store, and I’m trying to figure out how to display products from those 3 stores in my homepage. Problem is that my code is only showing the posts from the current store.
ex: store (1) shows products of store (1)
store (2) shows products of store (2)
but I don’t need it that way. I need all products from all stores
here’s my code, so far. Could somebody help me?
<?php
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->setVisibility(array(2,3,4))
->setOrder('created_at', 'desc')
->setPage(1, 20)
->setStoreId('1');
?>
<?php foreach($_productCollection as $_product) : ?>
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(250, 150); ?>" alt="" />
<a href="<?php echo $_product->getProductUrl(); ?>"> <?php echo $_product->getName(); ?> </a>
<div class="grddescription"><?php echo $_product->getDescription(); ?>
<?php endforeach; ?>
thank you, fellas!
I found a way to get it work!
in a external file which does not have nothing to do with magento (I placed it in root)
I call magento (in the outside, so I’m able to use all of it’s feat without having to worry about limitations) like this;
than with this;
I’m able to get all the products from all the sites!
Note: all the products are displayed thanks to glist.phtml which is a simple list.phtml file edited to fit my needs.
Yo!