Public Member Functions | |
addSelection ($selection) | |
isSaleable () | |
getDefaultSelection () | |
isMultiSelection () | |
getSearchableData ($productId, $storeId) | |
Protected Member Functions | |
_construct () | |
Protected Attributes | |
$_defaultSelection = null |
Definition at line 34 of file Option.php.
_construct | ( | ) | [protected] |
Initialize resource model
Reimplemented from Varien_Object.
Definition at line 47 of file Option.php.
00048 { 00049 $this->_init('bundle/option'); 00050 parent::_construct(); 00051 }
addSelection | ( | $ | selection | ) |
Add selection to option
Mage_Bundle_Model_Selection | $selection |
Definition at line 59 of file Option.php.
00060 { 00061 if (!$selection) { 00062 return false; 00063 } 00064 if (!$selections = $this->getData('selections')) { 00065 $selections = array(); 00066 } 00067 array_push($selections, $selection); 00068 $this->setSelections($selections); 00069 return $this; 00070 }
getDefaultSelection | ( | ) |
Retrieve default Selection object
if (!$this->_defaultSelection && $this->getSelections()) { $_selections = array(); foreach ($this->getSelections() as $selection) { if ($selection->getIsDefault()) { $_selections[] = $selection; } } if (!empty($_selections)) { $this->_defaultSelection = $_selections; } else { return null; } } return $this->_defaultSelection;
Definition at line 98 of file Option.php.
00099 { 00100 if (!$this->_defaultSelection && $this->getSelections()) { 00101 foreach ($this->getSelections() as $selection) { 00102 if ($selection->getIsDefault()) { 00103 $this->_defaultSelection = $selection; 00104 break; 00105 } 00106 } 00107 } 00108 return $this->_defaultSelection; 00109 /** 00110 * if (!$this->_defaultSelection && $this->getSelections()) { 00111 $_selections = array(); 00112 foreach ($this->getSelections() as $selection) { 00113 if ($selection->getIsDefault()) { 00114 $_selections[] = $selection; 00115 } 00116 } 00117 if (!empty($_selections)) { 00118 $this->_defaultSelection = $_selections; 00119 } else { 00120 return null; 00121 } 00122 } 00123 return $this->_defaultSelection; 00124 */ 00125 }
getSearchableData | ( | $ | productId, | |
$ | storeId | |||
) |
Retrieve options searchable data
int | $productId | |
int | $storeId |
Definition at line 148 of file Option.php.
00149 { 00150 return $this->_getResource() 00151 ->getSearchableData($productId, $storeId); 00152 }
isMultiSelection | ( | ) |
Check is multi Option selection
Definition at line 132 of file Option.php.
00133 { 00134 if ($this->getType() == 'checkbox' || $this->getType() == 'multi') { 00135 return true; 00136 } else { 00137 return false; 00138 } 00139 }
isSaleable | ( | ) |
Check Is Saleable Option
Definition at line 77 of file Option.php.
00078 { 00079 $saleable = 0; 00080 if ($this->getSelections()) { 00081 foreach ($this->getSelections() as $selection) { 00082 if ($selection->isSaleable()) { 00083 $saleable++; 00084 } 00085 } 00086 return (bool)$saleable; 00087 } 00088 else { 00089 return false; 00090 } 00091 }
$_defaultSelection = null [protected] |
Definition at line 41 of file Option.php.