nicolast
nicolast

Reputation: 732

Magento get product from page layout (like 1column.phtml)

I'm using Magento 1.7

I've created a custom page layout (parallaxe.phtml)
A product is associated to this custom page layout.

I'm on the product view page, my custom layout page is showing.
I want to acces my product's informations directly from this page.

$_product = $this->getProduct();

returns null :(

Any idea ?

Upvotes: 0

Views: 943

Answers (1)

Domen Vrankar
Domen Vrankar

Reputation: 1743

I assume that your template is attached to a block of type core/template (or some other block that does not set a product variable.

You can access the product variable from registry by calling either $product = Mage::registry('current_product'); or $product = Mage::registry('product');

Upvotes: 1

Related Questions