I am trying to get the product attribute in my downloadable controller. I am working on an ebook store. I have created a custom module sp. I need the product attribute to watermark my ebooks.
The controller I am working on is Mage/Downloadable/controllers/DownloadController.php
Any suggestions?
Thanks.
Depends totally in which action you are.
If you have a look at the linkAction
you can see how they obtain the product:
$id = $this->getRequest()->getParam('id', 0);
$linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item')->load($id, 'link_hash');
[...]
$product = Mage::getModel('catalog/product')->load($linkPurchasedItem->getProductId());
Now the product is loaded in the $product
variable.
You can get product attributes as usual by $product->getData('my_custom_attribute')
or $product->getMyCustomAttribute
.