Public Member Functions | |
_construct () | |
setOrderFilter ($order) | |
setRandomOrder () | |
addIdFilter ($item) | |
filterByTypes ($typeIds) | |
filterByParent ($parentId=null) | |
Protected Member Functions | |
_afterLoad () |
Definition at line 34 of file Collection.php.
_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
mixed | $item |
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
int | $parentId |
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
array | $typeIds |
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
mixed | $order |
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 }