I am trying to add custom attribute "publisher name" below product name in PDF invoice. Publisher is a custom attribute created by me.
I have copied
app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
to
app/code/local/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
And have added some code in default.php
but this is not working properly. It is showing attribute id like 250,251 in the pdf but I want it to show publisher name
I add following code in default.php
$Publisher = $this->getPublisherValue($item);
$lines[1][] = array(
'text' => Mage::helper('core/string')->str_split($Publisher, 35),
'feed' => 35
);
private function getPublisherValue($item)
{
$prod = Mage::getModel('catalog/product')->load($item->getProductId());
if(($return_publisher = $prod->getPublisher()))
return $return_publisher;
else
return 'N/A';
}
250,251
looks like it's avarchar
attribute with thetable
backend. Must be a multiselect due to the comma.