Magento 1 – Show Custom Attribute in Sidebar Wishlist

custom-optionsmagento-1wishlist

I have a sidebar whislist
/app/design/frontend/base/default/template/wishlist/sidebar.phtml
I need to add a "custom attribute" called manufacturer.

I have tried many options like these but all don't show a thing:

<?php echo $this->getManufacturer()) ?>

<?php echo $this->htmlEscape($_item->getData('manufacturer')); ?>
<?php echo $_product->getManufacturer() ?>

<?php $_item = $this->getItem()?>
<?php $_product= Mage::getSingleton('catalog/product')->load($_item->getProductId()) ?>
<?php echo $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product); ?>

<?php echo $item->getAttributeText('manufacturer') ?> 
<?php echo $item->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($item); ?>

Thisone shows "3" and no manufacturer name, at least showing something..

<?php echo $this->htmlEscape($_item->getManufacturer()) ?>

How can I get my manufacturer there? I can show them about everywhere else..

Best Answer

Look at the loop code of sidebar, by default it's:

<?php foreach ($this->getWishlistItems() as $_item): ?>

Inside thip loop $_item->getManufacturer() will return your attribute value, but you have to be sure, that product have this attribute fulfilled.

You can display it i.e. like this:

<?php if ( $_item->getManufacturer() ): ?>
Manufacturer: <?php echo $this->htmlEscape($_item->getManufacturer()) ?>
<?php endif ?>

Edit:

Which Magento version you're using? Probably this code will work, but its not optimal:

<?php if ( $manufacturer = Mage::getModel('catalog/product')->load($_item->getId())->getAttributeText('manufacturer') ): ?>
    Manufacturer: <?php echo $this->htmlEscape( $manufacturer ) ?>
<?php endif ?>