我正在使用magento 1.8.0版并尝试更改发票的默认magento打印格式。我试图在abstract.php&中做出改变。 invoice.php但是如果我在摘要中创建自定义函数并在发票中调用它,则更改不会反映出来。如果还有其他方法可以自定义更改,请提供帮助。
任何帮助将不胜感激。亲切的,不要告诉使用任何扩展,因为我的客户不会为它支付一分钱。我只是想最初编辑它,然后想要改变完整的布局。
protected function insertAddress(&$page, $store = null)
{
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$font = $this->_setFontRegular($page, 10);
$page->setLineWidth(0);
$this->y = $this->y ? $this->y : 815;
$top = 815;
foreach (explode("\n", Mage::getStoreConfig('sales/identity/address', $store)) as $value){
if ($value !== '') {
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
$page->drawText(trim(strip_tags($_value)),
$this->getAlignRight($_value, 130, 440, $font, 10),
$top,
'UTF-8');
$top -= 10;
}
}
}
$this->y = ($this->y > $top) ? $top : $this->y;
}
/**
* Format address
*
* @param string $address
* @return array
*/
protected function _formatAddress($address)
{
$return = array();
foreach (explode('|', $address) as $str) {
foreach (Mage::helper('core/string')->str_split($str, 45, true, true) as $part) {
if (empty($part)) {
continue;
}
$return[] = $part;
}
}
return $return;
}