Reputation: 31
Is there any way of showing to product cost in magento´s order view (backend)? So far I have not found an extension that does this (maybe you will :) ), so I guess I will have to do it myself.
What would be an efficient way of doing this? Maybe by overwriting the admin template? Or maybe there is a setting for this I just wasn't able to find.
Thanks in advance :)
Upvotes: 3
Views: 6592
Reputation: 327
At first you can create attribute for product, set attribute config in product. Well, you can get this attribute by Magento object. Example:
$product = Mage::getModel('catalog/product');
echo $product->getAttributeName();
Upvotes: 0
Reputation: 41
I had same issue. Then I have checked "cost" attribute and found that this attribute is assigned to some types of products. So I changed it for all product types.
This works for me. Hope this works for you.
Upvotes: 1
Reputation: 31
did it the quick way:
<?php
if ($children = $_item->getChildrenItems())
{
$children = $_item->getChildrenItems();
$ProductId = $children[0]->getProductId();
}
else
{
$ProductId = $_item->getProductId();
}
?>
Upvotes: 0
Reputation: 27119
To do this, edit two templates from the adminhtml
section. In sales/order/view/items.phtml
, add a new <col>
and <th>
for your column. Then, in sales/order/view/items/renderer/default.phtml
, add the corresponding <td>
for that field. Use something like this to get the cost:
<td><?php print Mage::getModel("catalog/product")->load($_item->getProductId())->getCost(); ?></td>
Hope that helps!
Thanks, Joe
Upvotes: 1