
Public Member Functions | |
| addValue ($value) | |
| getValues () | |
| setValues ($values) | |
| unsetValues () | |
| setOption (Mage_Catalog_Model_Product_Option $option) | |
| unsetOption () | |
| getOption () | |
| setProduct ($product) | |
| getProduct () | |
| saveValues () | |
| getPrice ($flag=false) | |
| getValuesCollection (Mage_Catalog_Model_Product_Option $option) | |
| getValuesByOption ($optionIds, $option_id, $store_id) | |
| deleteValue ($option_id) | |
| deleteValues ($option_type_id) | |
| prepareValueForDuplicate () | |
| duplicate ($oldOptionId, $newOptionId) | |
Protected Member Functions | |
| _construct () | |
Protected Attributes | |
| $_values = array() | |
| $_product | |
| $_option | |
Definition at line 34 of file Value.php.
| _construct | ( | ) | [protected] |
Enter description here...
Reimplemented from Varien_Object.
Definition at line 42 of file Value.php.
00043 { 00044 $this->_init('catalog/product_option_value'); 00045 }
| addValue | ( | $ | value | ) |
| deleteValue | ( | $ | option_id | ) |
Definition at line 172 of file Value.php.
00173 { 00174 $this->getResource()->deleteValue($option_id); 00175 return $this; 00176 }
| deleteValues | ( | $ | option_type_id | ) |
Definition at line 178 of file Value.php.
00179 { 00180 $this->getResource()->deleteValues($option_type_id); 00181 return $this; 00182 }
| duplicate | ( | $ | oldOptionId, | |
| $ | newOptionId | |||
| ) |
Duplicate product options value
| int | $oldOptionId | |
| int | $newOptionId |
Definition at line 204 of file Value.php.
00205 { 00206 $this->getResource()->duplicate($this, $oldOptionId, $newOptionId); 00207 return $this; 00208 }
| getPrice | ( | $ | flag = false |
) |
Return price. If $flag is true and price is percent return converted percent to price
| bool | $flag |
Definition at line 138 of file Value.php.
00139 { 00140 if ($flag && $this->getPriceType() == 'percent') { 00141 $basePrice = $this->getOption()->getProduct()->getFinalPrice(); 00142 $price = $basePrice*($this->_getData('price')/100); 00143 return $price; 00144 } 00145 return $this->_getData('price'); 00146 }
| getProduct | ( | ) |
| getValuesByOption | ( | $ | optionIds, | |
| $ | option_id, | |||
| $ | store_id | |||
| ) |
Definition at line 163 of file Value.php.
00164 { 00165 $collection = Mage::getResourceModel('catalog/product_option_value_collection') 00166 ->addFieldToFilter('option_id', $option_id) 00167 ->getValuesByOption($optionIds, $store_id); 00168 00169 return $collection; 00170 }
| getValuesCollection | ( | Mage_Catalog_Model_Product_Option $ | option | ) |
Enter description here...
| Mage_Catalog_Model_Product_Option | $option |
Definition at line 154 of file Value.php.
00155 { 00156 $collection = Mage::getResourceModel('catalog/product_option_value_collection') 00157 ->addFieldToFilter('option_id', $option->getId()) 00158 ->getValues($option->getStoreId()); 00159 00160 return $collection; 00161 }
| prepareValueForDuplicate | ( | ) |
| saveValues | ( | ) |
Definition at line 106 of file Value.php.
00107 { 00108 foreach ($this->getValues() as $value) { 00109 $this->setData($value) 00110 ->setData('option_id', $this->getOption()->getId()) 00111 ->setData('store_id', $this->getOption()->getStoreId()); 00112 00113 if ($this->getData('option_type_id') == '-1') {//change to 0 00114 $this->unsetData('option_type_id'); 00115 } else { 00116 $this->setId($this->getData('option_type_id')); 00117 } 00118 00119 if ($this->getData('is_delete') == '1') { 00120 if ($this->getId()) { 00121 $this->deleteValues($this->getId()); 00122 $this->delete(); 00123 } 00124 } else { 00125 $this->save(); 00126 } 00127 }//eof foreach() 00128 return $this; 00129 }
| setOption | ( | Mage_Catalog_Model_Product_Option $ | option | ) |
| setProduct | ( | $ | product | ) |
| setValues | ( | $ | values | ) |
| unsetOption | ( | ) |
| unsetValues | ( | ) |
1.5.8