Magento - get current product

前端 未结 4 2007
天涯浪人
天涯浪人 2021-02-05 08:18

I have a sidebar block in my layout that is being displayed on different pages.

In this block I have a list of products, and I want to select the current product when I

4条回答
  •  滥情空心
    2021-02-05 08:27

    $_proId  = $this->getProduct()->getId();
    $_product= Mage::getModel('catalog/product')->load($_proId);
    

    This actually does work. It has been down voted above, however it worked for me. I understand that the product does indeed load when you use getProduct(), however, I was only getting partial information of the product. Getting the ID and reloading the product brought back all the information.

    It might be specific to a version of Magento, however it does work though it looks stupid.

提交回复
热议问题