Magento PDF发票-如何将定制产品选项放在一行上? [英] Magento PDF Invoices - how do I get custom product options to be on one line?
本文介绍了Magento PDF发票-如何将定制产品选项放在一行上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用我的PDF发票/装运/贷项通知单,我浪费了很多纸张,其中逐行列出了自定义产品选项和可配置选项.我希望将它们放在一个块中,这样每个完整配置的产品都不会占用半页.
With my PDF invoices/shipments/credit memos I have a lot of paper wasted with custom product options and configurable options listed line by line. I would prefer these to be in one block so they don't take up half a page per fully configured product.
有什么想法吗?
推荐答案
在./Items/Invoice/Default.php中,我这样做:
In ./Items/Invoice/Default.php I did this:
// custom options
$options = $this->getItemOptions();
if ($options) {
foreach ($options as $option) {
// draw options label
// $lines[][] = array(
// 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
// 'font' => 'italic',
// 'feed' => 35
//);
if ($option['value']) {
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
$Mac= Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true);
$Guffin = Mage::helper('core/string')->str_split($value, 50, true, true);
$lines[][] = array(
'text' => htmlspecialchars_decode ($Mac[0]." : ".$Guffin[0]),
'feed' =>35
);
}
}
}
}
这是作弊,因为它不适用于多项选择,但适用于现有项目.
This is cheating in that it will not work for multi-select but it does for the project in-hand.
由于Magento弄错了这一点,还不得不输入htmlspecialchars_decode.
Also had to put in the htmlspecialchars_decode as Magento gets that bit wrong.
这篇关于Magento PDF发票-如何将定制产品选项放在一行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文