Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

SKU displays badly In the PDF Invoice when too long
 
KryzaMatt
Jr. Member
 
Total Posts:  3
Joined:  2009-02-04
 

Hi,

When Using a Bundle Product in an invoice, the SKU is way too long and becomes unreadable (See attached image)
Is there a way to give it more vertical space ?

Thank you for helping!

Image Attachments
bug-magento-pdf-sku.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
KryzaMatt
Jr. Member
 
Total Posts:  3
Joined:  2009-02-04
 

Problem found in :
app/code/core/Mage/Bundle/Sales/Order/Pdf/Items/Invoice.php, line 77.

This code does not work good. The first and second line are always overlaped.

/* in case Product SKU is longer than 36 chars - it is written in a few lines */
foreach (Mage::helper('core/string')->str_split($item->getSku(), 30) as $key => $part{
          $page
->drawText($part380$pdf->y-$shift[2]'UTF-8');
           if (
$key 0{
                 $shift[2] 
+= 10;
            
}
 }

This code is used in every PDF redering files for order types… I changed it for :

/* in case Product SKU is longer than 36 chars - it is written in a few lines */
if (strlen($item->getSku()) > 30{
    $parts 
Mage::helper('core/string')->str_split($item->getSku(), 36);
    foreach (
$parts as $part{
        $page
->drawText($part380$pdf->y-$shift[2]'UTF-8');
        
$shift[2] += 10;
    
}
else {
    $page
->drawText($item->getSku(), 380$pdf->y'UTF-8');
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top