Options in our Magento store have several product options that customers must fill in before they complete their purchase.
The problem is that we found that when we generated an invoice from the orders, there were a lot of forced line breaks in the options that were included on the invoice.
The cause of the problem turned out to be the fact that many of the option values included commas and the code was forcing a line break at every comma.
We solved the problem by adding a couple of lines to the file /app/code/local/Mage/Sales/Model/Order/pdf/items/invoice/Default.php
Look for a section of code that looks like this around line 125:
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, 100, true, true),
'feed' => 50
);
}
And add the two lines shown below in bold before and after the $values = explode(', ', $_printValue) line.
$_printValue = str_replace(', ',',_ ',$_printValue);
$values = explode(', ', $_printValue);
$values = str_replace('_','',$values);