Public Member Functions | |
joinValues ($storeId) | |
setProductIdFilter ($productId) | |
setPositionOrder () | |
appendSelections ($selectionsCollection, $stripBefore=false, $appendAll=true) | |
setIdFilter ($ids) | |
Protected Member Functions | |
_construct () | |
_stripSelections () | |
Protected Attributes | |
$_selectionsAppended = false |
Definition at line 34 of file Collection.php.
_construct | ( | ) | [protected] |
Initialization here
Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.
Definition at line 37 of file Collection.php.
00038 { 00039 $this->_init('bundle/option'); 00040 }
_stripSelections | ( | ) | [protected] |
Removes appended selections before
Definition at line 109 of file Collection.php.
00110 { 00111 foreach ($this->getItems() as $option) { 00112 $option->setSelections(array()); 00113 } 00114 $this->_selectionsAppended = false; 00115 return $this; 00116 }
appendSelections | ( | $ | selectionsCollection, | |
$ | stripBefore = false , |
|||
$ | appendAll = true | |||
) |
Append selection to options stripBefore - indicates to reload appendAll - indecates do we need to filter by saleable and required custom options
Mage_Bundle_Model_Mysql4_Selection_Collection | $selectionsCollection | |
bool | $stripBefore | |
bool | $appendAll |
Definition at line 82 of file Collection.php.
00083 { 00084 if ($stripBefore) { 00085 $this->_stripSelections(); 00086 } 00087 00088 if (!$this->_selectionsAppended) { 00089 foreach ($selectionsCollection->getItems() as $key=>$_selection) { 00090 if ($_option = $this->getItemById($_selection->getOptionId())) { 00091 if ((!$appendAll && $_selection->isSalable() && !$_selection->getRequiredOptions()) || $appendAll) { 00092 $_selection->setOption($_option); 00093 $_option->addSelection($_selection); 00094 } else { 00095 $selectionsCollection->removeItemByKey($key); 00096 } 00097 } 00098 } 00099 $this->_selectionsAppended = true; 00100 } 00101 return $this->getItems(); 00102 }
joinValues | ( | $ | storeId | ) |
Definition at line 42 of file Collection.php.
00043 { 00044 $this->getSelect()->joinLeft(array('option_value_default' => $this->getTable('bundle/option_value')), 00045 '`main_table`.`option_id` = `option_value_default`.`option_id` and `option_value_default`.`store_id` = "0"', 00046 array()) 00047 ->from('', array('default_title' => 'option_value_default.title')); 00048 00049 if ($storeId !== null) { 00050 $this->getSelect() 00051 ->from('', array('title' => 'IFNULL(`option_value`.`title`, `option_value_default`.`title`)')) 00052 ->joinLeft(array('option_value' => $this->getTable('bundle/option_value')), 00053 '`main_table`.`option_id` = `option_value`.`option_id` and `option_value`.`store_id` = "' . $storeId . '"', 00054 array()); 00055 } 00056 return $this; 00057 }
setIdFilter | ( | $ | ids | ) |
Definition at line 119 of file Collection.php.
00120 { 00121 if (is_array($ids)) { 00122 $this->addFieldToFilter('`main_table`.`option_id`', array('in' => $ids)); 00123 } else if ($ids != '') { 00124 $this->addFieldToFilter('`main_table`.`option_id`', $ids); 00125 } 00126 return $this; 00127 }
setPositionOrder | ( | ) |
Definition at line 65 of file Collection.php.
00066 { 00067 $this->getSelect()->order('main_table.position asc') 00068 ->order('main_table.option_id asc'); 00069 return $this; 00070 }
setProductIdFilter | ( | $ | productId | ) |
Definition at line 59 of file Collection.php.
00060 { 00061 $this->addFieldToFilter('`main_table`.`parent_id`', $productId); 00062 return $this; 00063 }
$_selectionsAppended = false [protected] |
Definition at line 36 of file Collection.php.