Mage_Sales_Model_Order_Pdf_Items_Abstract Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Pdf_Items_Abstract:

Mage_Core_Model_Abstract Varien_Object Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract Mage_Sales_Model_Order_Pdf_Items_Creditmemo_Default Mage_Sales_Model_Order_Pdf_Items_Invoice_Default Mage_Sales_Model_Order_Pdf_Items_Shipment_Default Mage_Bundle_Model_Sales_Order_Pdf_Items_Creditmemo Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment Mage_Downloadable_Model_Sales_Order_Pdf_Items_Creditmemo Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice Mage_Sales_Model_Order_Pdf_Items_Creditmemo_Grouped Mage_Sales_Model_Order_Pdf_Items_Invoice_Grouped

List of all members.

Public Member Functions

 setOrder (Mage_Sales_Model_Order $order)
 setSource (Mage_Core_Model_Abstract $source)
 setItem (Varien_Object $item)
 setPdf (Mage_Sales_Model_Order_Pdf_Abstract $pdf)
 setPage (Zend_Pdf_Page $page)
 getOrder ()
 getSource ()
 getItem ()
 getPdf ()
 getPage ()
 draw ()
 getItemOptions ()
 getSku ($item)

Protected Member Functions

 _formatOptionValue ($value)
 _parseDescription ()
 _setFontRegular ($size=7)
 _setFontBold ($size=7)
 _setFontItalic ($size=7)

Protected Attributes

 $_order
 $_source
 $_item
 $_pdf
 $_pdfPage


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

_formatOptionValue ( value  )  [protected]

Definition at line 208 of file Abstract.php.

00209     {
00210         $order = $this->getOrder();
00211 
00212         $resultValue = '';
00213         if (is_array($value)) {
00214             if (isset($value['qty'])) {
00215                 $resultValue .= sprintf('%d', $value['qty']) . ' x ';
00216             }
00217 
00218             $resultValue .= $value['title'];
00219 
00220             if (isset($value['price'])) {
00221                 $resultValue .= " " . $order->formatPrice($value['price']);
00222             }
00223             return  $resultValue;
00224         } else {
00225             return $value;
00226         }
00227     }

_parseDescription (  )  [protected]

Definition at line 229 of file Abstract.php.

00230     {
00231         $description = $this->getItem()->getDescription();
00232         if (preg_match_all('/<li.*?>(.*?)<\/li>/i', $description, $matches)) {
00233             return $matches[1];
00234         }
00235 
00236         return array($description);
00237     }

_setFontBold ( size = 7  )  [protected]

Definition at line 262 of file Abstract.php.

00263     {
00264         $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf');
00265         $this->getPage()->setFont($font, $size);
00266         return $font;
00267     }

_setFontItalic ( size = 7  )  [protected]

Definition at line 269 of file Abstract.php.

00270     {
00271         $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf');
00272         $this->getPage()->setFont($font, $size);
00273         return $font;
00274     }

_setFontRegular ( size = 7  )  [protected]

Definition at line 255 of file Abstract.php.

00256     {
00257         $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf');
00258         $this->getPage()->setFont($font, $size);
00259         return $font;
00260     }

draw (  )  [abstract]

getItem (  ) 

Retrieve item object

Exceptions:
Mage_Core_Exception 
Returns:
Varien_Object

Definition at line 166 of file Abstract.php.

00167     {
00168         if (is_null($this->_item)) {
00169             Mage::throwException(Mage::helper('sales')->__('Item object is not specified.'));
00170         }
00171         return $this->_item;
00172     }

getItemOptions (  ) 

Definition at line 239 of file Abstract.php.

00239                                      {
00240         $result = array();
00241         if ($options = $this->getItem()->getOrderItem()->getProductOptions()) {
00242             if (isset($options['options'])) {
00243                 $result = array_merge($result, $options['options']);
00244             }
00245             if (isset($options['additional_options'])) {
00246                 $result = array_merge($result, $options['additional_options']);
00247             }
00248             if (isset($options['attributes_info'])) {
00249                 $result = array_merge($result, $options['attributes_info']);
00250             }
00251         }
00252         return $result;
00253     }

getOrder (  ) 

Retrieve order object

Exceptions:
Mage_Core_Exception 
Returns:
Mage_Sales_Model_Order

Definition at line 138 of file Abstract.php.

00139     {
00140         if (is_null($this->_order)) {
00141             Mage::throwException(Mage::helper('sales')->__('Order object is not specified.'));
00142         }
00143         return $this->_order;
00144     }

getPage (  ) 

Retrieve Pdf page object

Exceptions:
Mage_Core_Exception 
Returns:
Zend_Pdf_Page

Definition at line 194 of file Abstract.php.

00195     {
00196         if (is_null($this->_pdfPage)) {
00197             Mage::throwException(Mage::helper('sales')->__('PDF page object is not specified.'));
00198         }
00199         return $this->_pdfPage;
00200     }

getPdf (  ) 

Retrieve Pdf model

Exceptions:
Mage_Core_Exception 
Returns:
Mage_Sales_Model_Order_Pdf_Abstract

Definition at line 180 of file Abstract.php.

00181     {
00182         if (is_null($this->_pdf)) {
00183             Mage::throwException(Mage::helper('sales')->__('PDF object is not specified.'));
00184         }
00185         return $this->_pdf;
00186     }

getSku ( item  ) 

Definition at line 276 of file Abstract.php.

00277     {
00278         if ($item->getOrderItem()->getProductOptionByCode('simple_sku'))
00279             return $item->getOrderItem()->getProductOptionByCode('simple_sku');
00280         else
00281             return $item->getSku();
00282     }

getSource (  ) 

Retrieve source object

Exceptions:
Mage_Core_Exception 
Returns:
Mage_Core_Model_Abstract

Definition at line 152 of file Abstract.php.

00153     {
00154         if (is_null($this->_source)) {
00155             Mage::throwException(Mage::helper('sales')->__('Source object is not specified.'));
00156         }
00157         return $this->_source;
00158     }

setItem ( Varien_Object item  ) 

Set item object

Parameters:
Varien_Object $item
Returns:
Mage_Sales_Model_Order_Pdf_Items_Abstract

Definition at line 102 of file Abstract.php.

00103     {
00104         $this->_item = $item;
00105         return $this;
00106     }

setOrder ( Mage_Sales_Model_Order order  ) 

Set order model

Parameters:
Mage_Sales_Model_Order $order
Returns:
Mage_Sales_Model_Order_Pdf_Items_Abstract

Definition at line 78 of file Abstract.php.

00079     {
00080         $this->_order = $order;
00081         return $this;
00082     }

setPage ( Zend_Pdf_Page $  page  ) 

Set current page

Parameters:
Zend_Pdf_Page $page
Returns:
Mage_Sales_Model_Order_Pdf_Items_Abstract

Definition at line 126 of file Abstract.php.

00127     {
00128         $this->_pdfPage = $page;
00129         return $this;
00130     }

setPdf ( Mage_Sales_Model_Order_Pdf_Abstract pdf  ) 

Set Pdf model

Parameters:
Mage_Sales_Model_Order_Pdf_Abstract $pdf
Returns:
Mage_Sales_Model_Order_Pdf_Items_Abstract

Definition at line 114 of file Abstract.php.

00115     {
00116         $this->_pdf = $pdf;
00117         return $this;
00118     }

setSource ( Mage_Core_Model_Abstract source  ) 

Set Source model

Parameters:
Mage_Core_Model_Abstract $source
Returns:
Mage_Sales_Model_Order_Pdf_Items_Abstract

Definition at line 90 of file Abstract.php.

00091     {
00092         $this->_source = $source;
00093         return $this;
00094     }


Member Data Documentation

$_item [protected]

Definition at line 56 of file Abstract.php.

$_order [protected]

Definition at line 42 of file Abstract.php.

$_pdf [protected]

Definition at line 63 of file Abstract.php.

$_pdfPage [protected]

Definition at line 70 of file Abstract.php.

$_source [protected]

Definition at line 49 of file Abstract.php.


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

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