我在以下方面进行了一些发票模板修改:
/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
允许在发票上包含制造商等自定义属性。
此代码有效,但它会吐出制造商 ID,我需要标签。
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->getSku($item), array('manufacturer'));
if ($product) {
$lines[0][] = array(
'text' => Mage::helper('core/string')->str_split($manufacturer, 15),
'feed' => 220
);
}
例如 - 当我需要“耐克”时,我得到 4138
我已经尝试过这个可以在前端工作但我得到一个错误:致命错误:调用非对象上的成员函数getResource()
$_product->getResource()->getAttribute('pos_short_colour')->getFrontend()->getValue($_product)
那么如何在发票模板中调用标签而不是 ID。
PS 我也尝试过使用 getData / getLabel / getText