Mage_Sales_Block_Order_Item_Renderer_Default Class Reference

Inheritance diagram for Mage_Sales_Block_Order_Item_Renderer_Default:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Bundle_Block_Sales_Order_Items_Renderer Mage_Downloadable_Block_Sales_Order_Item_Renderer_Downloadable Mage_Sales_Block_Order_Item_Renderer_Grouped

List of all members.

Public Member Functions

 setItem (Varien_Object $item)
 getItem ()
 getOrder ()
 getOrderItem ()
 getItemOptions ()
 getFormatedOptionValue ($optionValue)
 getSku ()


Detailed Description

Definition at line 34 of file Default.php.


Member Function Documentation

getFormatedOptionValue ( optionValue  ) 

Accept option value and return its formatted view

Parameters:
mixed $optionValue Method works well with these $optionValue format: 1. String 2. Indexed array e.g. array(val1, val2, ...) 3. Associative array, containing additional option info, including option value, e.g. array ( [label] => ..., [value] => ..., [print_value] => ..., [option_id] => ..., [option_type] => ..., [custom_view] =>..., )
Returns:
array

Definition at line 104 of file Default.php.

00105     {
00106         $optionInfo = array();
00107 
00108         // define input data format
00109         if (is_array($optionValue)) {
00110             if (isset($optionValue['option_id'])) {
00111                 $optionInfo = $optionValue;
00112                 if (isset($optionInfo['value'])) {
00113                     $optionValue = $optionInfo['value'];
00114                 }
00115             } elseif (isset($optionValue['value'])) {
00116                 $optionValue = $optionValue['value'];
00117             }
00118         }
00119 
00120         // render customized option view
00121         if (isset($optionInfo['custom_view']) && $optionInfo['custom_view']) {
00122             $_default = array('value' => $optionValue);
00123             if (isset($optionInfo['option_type'])) {
00124                 try {
00125                     $group = Mage::getModel('catalog/product_option')->groupFactory($optionInfo['option_type']);
00126                     return array('value' => $group->getCustomizedView($optionInfo));
00127                 } catch (Exception $e) {
00128                     return $_default;
00129                 }
00130             }
00131             return $_default;
00132         }
00133 
00134         // truncate standard view
00135         $result = array();
00136         if (is_array($optionValue)) {
00137             $_truncatedValue = implode("\n", $optionValue);
00138             $_truncatedValue = nl2br($_truncatedValue);
00139             return array('value' => $_truncatedValue);
00140         } else {
00141             $_truncatedValue = Mage::helper('core/string')->truncate($optionValue, 55, '');
00142             $_truncatedValue = nl2br($_truncatedValue);
00143         }
00144 
00145         $result = array('value' => $_truncatedValue);
00146 
00147         if (Mage::helper('core/string')->strlen($optionValue) > 55) {
00148             $result['value'] = $result['value'] . ' <a href="#" class="dots" onclick="return false">...</a>';
00149             $optionValue = nl2br($optionValue);
00150             $result = array_merge($result, array('full_view' => $optionValue));
00151         }
00152 
00153         return $result;
00154     }

getItem (  ) 

Definition at line 42 of file Default.php.

00043     {
00044         return $this->_getData('item');
00045     }

getItemOptions (  ) 

Definition at line 67 of file Default.php.

00068     {
00069         $result = array();
00070         if ($options = $this->getOrderItem()->getProductOptions()) {
00071             if (isset($options['options'])) {
00072                 $result = array_merge($result, $options['options']);
00073             }
00074             if (isset($options['additional_options'])) {
00075                 $result = array_merge($result, $options['additional_options']);
00076             }
00077             if (isset($options['attributes_info'])) {
00078                 $result = array_merge($result, $options['attributes_info']);
00079             }
00080         }
00081         return $result;
00082     }

getOrder (  ) 

Retrieve current order model instance

Returns:
Mage_Sales_Model_Order

Definition at line 52 of file Default.php.

00053     {
00054         return $this->getOrderItem()->getOrder();
00055     }

getOrderItem (  ) 

Definition at line 58 of file Default.php.

00059     {
00060         if ($this->getItem() instanceof Mage_Sales_Model_Order_Item) {
00061             return $this->getItem();
00062         } else {
00063             return $this->getItem()->getOrderItem();
00064         }
00065     }

getSku (  ) 

Return sku of order item.

Returns:
string

Definition at line 161 of file Default.php.

00162     {
00163         if ($this->getOrderItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
00164             return $this->getOrderItem()->getProductOptionByCode('simple_sku');
00165         }
00166         return $this->getItem()->getSku();
00167     }

setItem ( Varien_Object item  ) 

Definition at line 36 of file Default.php.

00037     {
00038         $this->setData('item', $item);
00039         return $this;
00040     }


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

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