OK, so we have this site that has a lot of custom options and we'd like to ideally have the label and value on the same line when the invoice PDF is created. I have located the file responsible at
app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
and have made a copy at
app/code/local/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
but my PHP is not good enough for me to figure out how to have the label and value on the same line.
This is the code in question:
$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']), 40, true, true),
'font' => 'italic',
'feed' => 35
);
if ($option['value']) {
if (isset($option['print_value'])) {
$_printValue = $option['print_value'];
} else {
$_printValue = strip_tags($option['value']);
}
$values = explode(', ', $_printValue);
foreach ($values as $value) {
$lines[][] = array(
'text' => Mage::helper('core/string')->str_split($value, 30, true, true),
'feed' => 40
);
}
}
}
}
Ideally, I'd like to keep the checks and just have the 'text' be in this form: 'label' - 'value'
Thanks!