Mage_Sales_Model_Mysql4_Order_Item_Collection Class Reference

Inheritance diagram for Mage_Sales_Model_Mysql4_Order_Item_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 _construct ()
 setOrderFilter ($order)
 setRandomOrder ()
 addIdFilter ($item)
 filterByTypes ($typeIds)
 filterByParent ($parentId=null)

Protected Member Functions

 _afterLoad ()


Detailed Description

Definition at line 34 of file Collection.php.


Member Function Documentation

_afterLoad (  )  [protected]

Assign parent items

Reimplemented from Varien_Data_Collection_Db.

Definition at line 41 of file Collection.php.

00042     {
00043         parent::_afterLoad();
00044         /**
00045          * Assign parent items
00046          */
00047         foreach ($this as $item) {
00048             if ($item->getParentItemId()) {
00049                 $item->setParentItem($this->getItemById($item->getParentItemId()));
00050             }
00051         }
00052         return $this;
00053     }

_construct (  ) 

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 36 of file Collection.php.

00037     {
00038         $this->_init('sales/order_item');
00039     }

addIdFilter ( item  ) 

Set filter by item id

Parameters:
mixed $item
Returns:
Mage_Sales_Model_Mysql4_Order_Item_Collection

Definition at line 85 of file Collection.php.

00086     {
00087         if (is_array($item)) {
00088             $this->addFieldToFilter('item_id', array('in'=>$item));
00089         } elseif ($item instanceof Mage_Sales_Model_Order_Item) {
00090             $this->addFieldToFilter('item_id', $item->getId());
00091         } else {
00092             $this->addFieldToFilter('item_id', $item);
00093         }
00094         return $this;
00095     }

filterByParent ( parentId = null  ) 

Filter collection by parent_item_id

Parameters:
int $parentId
Returns:
Mage_Sales_Model_Mysql4_Order_Item_Collection

Definition at line 115 of file Collection.php.

00116     {
00117         if (empty($parentId)) {
00118             $this->addFieldToFilter('parent_item_id', array('null' => true));
00119         }
00120         else {
00121             $this->addFieldToFilter('parent_item_id', $parentId);
00122         }
00123         return $this;
00124     }

filterByTypes ( typeIds  ) 

Filter collection by specified product types

Parameters:
array $typeIds
Returns:
Mage_Sales_Model_Mysql4_Order_Item_Collection

Definition at line 103 of file Collection.php.

00104     {
00105         $this->addFieldToFilter('product_type', array('in' => $typeIds));
00106         return $this;
00107     }

setOrderFilter ( order  ) 

Set filter by order id

Parameters:
mixed $order
Returns:
Mage_Sales_Model_Mysql4_Order_Item_Collection

Definition at line 61 of file Collection.php.

00062     {
00063         if ($order instanceof Mage_Sales_Model_Order) {
00064             $orderId = $order->getId();
00065         }
00066         else {
00067             $orderId = $order;
00068         }
00069         $this->addFieldToFilter('order_id', $orderId);
00070         return $this;
00071     }

setRandomOrder (  ) 

Definition at line 73 of file Collection.php.

00074     {
00075         $this->setOrder('RAND()');
00076         return $this;
00077     }


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

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