Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice Class Reference

Inheritance diagram for Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice:

Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract Mage_Sales_Model_Order_Pdf_Items_Abstract Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 draw ()


Detailed Description

Definition at line 35 of file Invoice.php.


Member Function Documentation

draw (  ) 

Draw item line

Reimplemented from Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract.

Definition at line 37 of file Invoice.php.

00038     {
00039         $order  = $this->getOrder();
00040         $item   = $this->getItem();
00041         $pdf    = $this->getPdf();
00042         $page   = $this->getPage();
00043         $shift  = array(0, 10, 0);
00044         $leftBound = 35;
00045 
00046         $this->_setFontRegular();
00047 
00048         $page->drawText($item->getQty()*1, 435, $pdf->y, 'UTF-8');
00049 
00050         /* in case Product name is longer than 80 chars - it is written in a few lines */
00051         foreach (Mage::helper('core/string')->str_split($item->getName(), 60, true, true) as $key => $part) {
00052             $page->drawText($part, 35, $pdf->y-$shift[0], 'UTF-8');
00053             $shift[0] += 10;
00054         }
00055 
00056         $options = $this->getItemOptions();
00057         if (isset($options)) {
00058             foreach ($options as $option) {
00059                 // draw options label
00060                 $this->_setFontItalic();
00061                 foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) {
00062                     $page->drawText($_option, 35, $pdf->y-$shift[0], 'UTF-8');
00063                     $shift[0] += 10;
00064                 }
00065                 // draw options value
00066                 $this->_setFontRegular();
00067                 if ($option['value']) {
00068                     $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
00069                     $values = explode(', ', $_printValue);
00070                     foreach ($values as $value) {
00071                         foreach (Mage::helper('core/string')->str_split($value, 60,true,true) as $_value) {
00072                             $page->drawText($_value, 40, $pdf->y-$shift[0], 'UTF-8');
00073                             $shift[0] += 10;
00074                         }
00075                     }
00076                 }
00077             }
00078         }
00079 
00080         foreach ($this->_parseDescription() as $description){
00081             $page->drawText(strip_tags($description), 65, $pdf->y-$shift[1], 'UTF-8');
00082             $shift[1] += 10;
00083         }
00084 
00085         /* in case Product SKU is longer than 36 chars - it is written in a few lines */
00086         foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) {
00087             if ($key > 0) {
00088                 $shift[2] += 10;
00089             }
00090             $page->drawText($part, 240, $pdf->y-$shift[2], 'UTF-8');
00091         }
00092 
00093         $font = $this->_setFontBold();
00094 
00095         $row_total = $order->formatPriceTxt($item->getRowTotal());
00096         $page->drawText($row_total, 565-$pdf->widthForStringUsingFontSize($row_total, $font, 7), $pdf->y, 'UTF-8');
00097 
00098         $price = $order->formatPriceTxt($item->getPrice());
00099         $page->drawText($price, 395-$pdf->widthForStringUsingFontSize($price, $font, 7), $pdf->y, 'UTF-8');
00100 
00101         $tax = $order->formatPriceTxt($item->getTaxAmount());
00102         $page->drawText($tax, 495-$pdf->widthForStringUsingFontSize($tax, $font, 7), $pdf->y, 'UTF-8');
00103 
00104         // draw Links Section Title
00105         $this->_setFontItalic();
00106         $pdf->y -= 10;
00107         $x = $leftBound;
00108         $_purchasedItems = $this->getLinks()->getPurchasedItems();
00109         $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8');
00110 
00111         // draw Links
00112         $this->_setFontRegular();
00113         foreach ($_purchasedItems as $_link) {
00114             $pdf->y -= 10;
00115 //            $text = $_link->getLinkTitle() . ' ('.$_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():'U').')';
00116             $text = $_link->getLinkTitle();
00117             $page->drawText($text, $x+10, $pdf->y, 'UTF-8');
00118         }
00119         $pdf->y -= 15;
00120     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:09 2009 for Magento by  doxygen 1.5.8