Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract Class Reference

Inheritance diagram for Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract:

Mage_Sales_Model_Order_Pdf_Items_Abstract Mage_Core_Model_Abstract Varien_Object Mage_Bundle_Model_Sales_Order_Pdf_Items_Creditmemo Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment

List of all members.

Public Member Functions

 getChilds ($item)
 isShipmentSeparately ($item=null)
 isChildCalculated ($item=null)
 getBundleOptions ($item=null)
 getSelectionAttributes ($item)
 getOrderOptions ($item=null)
 getOrderItem ()
 getValueHtml ($item)
 canShowPriceInfo ($item)


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

canShowPriceInfo ( item  ) 

Can show price info for item

Parameters:
Mage_Sales_Order_Item $item
Returns:
bool

Definition at line 252 of file Abstract.php.

00253     {
00254         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
00255                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
00256             return true;
00257         }
00258         return false;
00259     }

getBundleOptions ( item = null  ) 

Retrieve Bundle Options

Parameters:
Varien_Object $item
Returns:
array

Definition at line 157 of file Abstract.php.

00158     {
00159         if ($options = $this->getOrderItem()->getProductOptions()) {
00160             if (isset($options['bundle_options'])) {
00161                 return $options['bundle_options'];
00162             }
00163         }
00164         return array();
00165     }

getChilds ( item  ) 

Getting all available childs for Invoice, Shipmen or Creditmemo item

Parameters:
Varien_Object $item
Returns:
array

Definition at line 43 of file Abstract.php.

00044     {
00045         $_itemsArray = array();
00046 
00047         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
00048             $_items = $item->getInvoice()->getAllItems();
00049         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
00050             $_items = $item->getShipment()->getAllItems();
00051         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
00052             $_items = $item->getCreditmemo()->getAllItems();
00053         }
00054 
00055         if ($_items) {
00056             foreach ($_items as $_item) {
00057                 if ($parentItem = $_item->getOrderItem()->getParentItem()) {
00058                     $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
00059                 } else {
00060                     $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
00061                 }
00062             }
00063         }
00064 
00065         if (isset($_itemsArray[$item->getOrderItem()->getId()])) {
00066             return $_itemsArray[$item->getOrderItem()->getId()];
00067         } else {
00068             return null;
00069         }
00070     }

getOrderItem (  ) 

Retrieve Order Item

Returns:
Mage_Sales_Order_Item

Definition at line 215 of file Abstract.php.

00216     {
00217         if ($this->getItem() instanceof Mage_Sales_Order_Item) {
00218             return $this->getItem();
00219         } else {
00220             return $this->getItem()->getOrderItem();
00221         }
00222     }

getOrderOptions ( item = null  ) 

Retrieve Order options

Parameters:
Varien_Object $item
Returns:
array

Definition at line 192 of file Abstract.php.

00193     {
00194         $result = array();
00195 
00196         if ($options = $this->getOrderItem()->getProductOptions()) {
00197             if (isset($options['options'])) {
00198                 $result = array_merge($result, $options['options']);
00199             }
00200             if (isset($options['additional_options'])) {
00201                 $result = array_merge($result, $options['additional_options']);
00202             }
00203             if (!empty($options['attributes_info'])) {
00204                 $result = array_merge($options['attributes_info'], $result);
00205             }
00206         }
00207         return $result;
00208     }

getSelectionAttributes ( item  ) 

Retrieve Selection attributes

Parameters:
Varien_Object $item
Returns:
mixed

Definition at line 173 of file Abstract.php.

00174     {
00175         if ($item instanceof Mage_Sales_Model_Order_Item) {
00176             $options = $item->getProductOptions();
00177         } else {
00178             $options = $item->getOrderItem()->getProductOptions();
00179         }
00180         if (isset($options['bundle_selection_attributes'])) {
00181             return unserialize($options['bundle_selection_attributes']);
00182         }
00183         return null;
00184     }

getValueHtml ( item  ) 

Retrieve Value HTML

Parameters:
Mage_Sales_Order_Item $item
Returns:
string

Definition at line 230 of file Abstract.php.

00231     {
00232         $result = strip_tags($item->getName());
00233         if (!$this->isShipmentSeparately($item)) {
00234             if ($attributes = $this->getSelectionAttributes($item)) {
00235                 $result =  sprintf('%d', $attributes['qty']) . ' x ' . $result;
00236             }
00237         }
00238         if (!$this->isChildCalculated($item)) {
00239             if ($attributes = $this->getSelectionAttributes($item)) {
00240                 $result .= " " . strip_tags($this->getOrderItem()->getOrder()->formatPrice($attributes['price']));
00241             }
00242         }
00243         return $result;
00244     }

isChildCalculated ( item = null  ) 

Retrieve is Child Calculated

Parameters:
Varien_Object $item
Returns:
bool

Definition at line 117 of file Abstract.php.

00118     {
00119         if ($item) {
00120             if ($item->getOrderItem()) {
00121                 $item = $item->getOrderItem();
00122             }
00123             if ($parentItem = $item->getParentItem()) {
00124                 if ($options = $parentItem->getProductOptions()) {
00125                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00126                         return true;
00127                     } else {
00128                         return false;
00129                     }
00130                 }
00131             } else {
00132                 if ($options = $item->getProductOptions()) {
00133                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00134                         return false;
00135                     } else {
00136                         return true;
00137                     }
00138                 }
00139             }
00140         }
00141 
00142         if ($options = $this->getOrderItem()->getProductOptions()) {
00143             if (isset($options['product_calculations'])
00144                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00145                 return true;
00146             }
00147         }
00148         return false;
00149     }

isShipmentSeparately ( item = null  ) 

Retrieve is Shipment Separately flag for Item

Parameters:
Varien_Object $item
Returns:
bool

Definition at line 78 of file Abstract.php.

00079     {
00080         if ($item) {
00081             if ($item->getOrderItem()) {
00082                 $item = $item->getOrderItem();
00083             }
00084             if ($parentItem = $item->getParentItem()) {
00085                 if ($options = $parentItem->getProductOptions()) {
00086                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00087                         return true;
00088                     } else {
00089                         return false;
00090                     }
00091                 }
00092             } else {
00093                 if ($options = $item->getProductOptions()) {
00094                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00095                         return false;
00096                     } else {
00097                         return true;
00098                     }
00099                 }
00100             }
00101         }
00102 
00103         if ($options = $this->getOrderItem()->getProductOptions()) {
00104             if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00105                 return true;
00106             }
00107         }
00108         return false;
00109     }


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

Generated on Sat Jul 4 17:23:35 2009 for Magento by  doxygen 1.5.8