I have magento 1.9 and at the order page ( /app/design/adminhtml/default/default/template/sales/items/column/name.phtml ) I need to add a custom attribute called "location"

<?php if ($_item = $this->getItem()): ?>
<h5 class="title"><span id="order_item_<?php echo $_item->getId() ?>_title"><?php echo $this->escapeHtml($_item->getName()) ?></span></h5>
<div><strong><?php echo $this->helper('sales')->__('SKU') ?>:</strong> <?php echo implode('<br />', Mage::helper('catalog')->splitSku($this->escapeHtml($this->getSku()))); ?></div>
<h5 class="title"><span id="order_item_location__title">Locatie: <?php echo implode('<br />', Mage::helper('catalog')->splitSku($this->escapeHtml($this->getLocation()))); ?></span></h5>

I'm not so good with magentoI have tried to mix codes I've found from blogs but still won't be able to get the value of "location".

1 Answer 1


Assuming you have an attribute called "location" active, place below code anywhere you like in sales/items/column/name.phtml

<?php echo $this->escapeHtml($_item->getProduct()->getLocation()); ?>

If "location" is a dropdown or multiselect value, use this instead

<?php echo $this->escapeHtml($_item->getProduct()->getAttributeText('location')); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.