11/21/2012

Magento invoice pdf : display custom options in one line



open default.php
at path:

app/code/local/Mage/Sales/Model/Order/Pdf/Items/Invoice

//REPLACE THE LINES  one that starts with if ($options) {
        //foreach ($options as $option) { with the followin lines.

       
       $options = $this->getItemOptions();
    if ($options) {
        foreach ($options as $option) {
            if ($option['value']) {
                $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
                $values = explode(', ', $_printValue);
                foreach ($values as $value) {
                    $optlabel= Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true);
                    $optval = Mage::helper('core/string')->str_split($value, 50, true, true);
                    $lines[][] = array(
                        'text' => htmlspecialchars_decode ($optlabel[0]." : ".$optval[0]),
                        'feed' =>35
                    );
                }
            }
        }
    }

No comments:

Post a Comment