Mage_Sales_Model_Mysql4_Quote_Item_Option_Collection Class Reference

Inheritance diagram for Mage_Sales_Model_Mysql4_Quote_Item_Option_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 addItemFilter ($item)
 getProductIds ()
 getOptionsByItem ($item)
 getOptionsByProduct ($product)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 34 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 36 of file Collection.php.

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

addItemFilter ( item  ) 

Apply quote item(s) filter to collection

Parameters:
int | array $item
Returns:
Mage_Sales_Model_Mysql4_Quote_Item_Option_Collection

Definition at line 47 of file Collection.php.

00048     {
00049         if (empty($item)) {
00050             $this->addFieldToFilter('item_id', '');
00051         }
00052         elseif (is_array($item)) {
00053             $this->addFieldToFilter('item_id', array('in'=>$item));
00054         }
00055         elseif ($item instanceof Mage_Sales_Model_Quote_Item) {
00056             $this->addFieldToFilter('item_id', $item->getId());
00057         }
00058         else {
00059             $this->addFieldToFilter('item_id', $item);
00060         }
00061         return $this;
00062     }

getOptionsByItem ( item  ) 

Get all option for item

Parameters:
mixed $item
Returns:
array

Definition at line 84 of file Collection.php.

00085     {
00086         if ($item instanceof Mage_Sales_Model_Quote_Item) {
00087             $itemId = $item->getId();
00088         }
00089         else {
00090             $itemId = $item;
00091         }
00092 
00093         $options = array();
00094         foreach ($this as $option) {
00095             if ($option->getItemId() == $itemId) {
00096                 $options[] = $option;
00097             }
00098         }
00099         return $options;
00100     }

getOptionsByProduct ( product  ) 

Get all option for item

Parameters:
mixed $item
Returns:
array

Definition at line 108 of file Collection.php.

00109     {
00110         if ($product instanceof Mage_Catalog_Model_Product) {
00111             $productId = $product->getId();
00112         }
00113         else {
00114             $productId = $product;
00115         }
00116 
00117         $options = array();
00118         foreach ($this as $option) {
00119             if ($option->getProductId() == $productId) {
00120                 $options[] = $option;
00121             }
00122         }
00123         return $options;
00124     }

getProductIds (  ) 

Get array of all product ids

Returns:
array

Definition at line 69 of file Collection.php.

00070     {
00071         $ids = array();
00072         foreach ($this as $item) {
00073             $ids[] = $item->getProductId();
00074         }
00075         return array_unique($ids);
00076     }


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

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