tags:

views:

369

answers:

3

I'm using the method described here to display an individual product on a cms page:

http://www.molotovbliss.com/magento-commerce/magento-display-a-product-image-within-static-pages-and-blocks/

The problem is that if I try to display 2 products using this method both blocks show the same product even if I specify a different id in each block ie:

{{block type="catalog/product_new" product_id="1" template="catalog/product/view/your_new_page.phtml"}}

{{block type="catalog/product_new" product_id="2" template="catalog/product/view/your_new_page.phtml"}}

Adding the above code to my cms page results in product 1 being displayed twice.

A: 

My 2 cents (not beeing sure though...) : did you try to set a name to each block ? Like :

{{block type="catalog/product_new" product_id="1" name="first.product" template="catalog/product/view/your_new_page.phtml"}}

{{block type="catalog/product_new" product_id="2" name="second.product" template="catalog/product/view/your_new_page.phtml"}}
vrnet
unfortunately I still get the same result when adding unique names.
a1anm
+1  A: 

here is the solution change product_new to product_view like this: type="catalog/product_view" have fun :)

borux
+1  A: 

Without knowing exactly what version of Magento you are running, I chose to look at 1.3.2.4 for you.

Oddly, I'm suprised you get any good result using 'catalog/product_new'. It has no provision for passing in the product id as a block arg. 'catalog/product_view' will allow you to pass in the product id as an arg, but only once. If you notice below, it's sets the product as a registry object the first time and will not use the passed in product id after that.

public function getProduct()
{
    if (!Mage::registry('product') && $this->getProductId()) {
        $product = Mage::getModel('catalog/product')->load($this->getProductId());
        Mage::register('product', $product);
    }
    return Mage::registry('product');
}
Lee
I am using Magento 1.4. I changed my code to catalog/product_view and it works!!! It now displays different products on the same page!!!
a1anm