本文整理汇总了PHP中Mage_Catalog_Model_Product_Option::getValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Product_Option::getValues方法的具体用法?PHP Mage_Catalog_Model_Product_Option::getValues怎么用?PHP Mage_Catalog_Model_Product_Option::getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Product_Option
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Product_Option::getValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionArray
public function getOptionArray(Mage_Catalog_Model_Product_Option $option)
{
$commonArgs = array('is_delete', 'previous_type', 'previous_group', 'title', 'type', 'is_require', 'sort_order', 'values');
$priceArgs = array('price_type', 'price', 'sku');
$txtArgs = array('max_characters');
$fileArgs = array('file_extension', 'image_size_x', 'image_size_y');
$multiArgs = array('is_delete', 'title', 'sort_order');
$multi = array('drop_down', 'radio', 'checkbox', 'multiple');
$valueArgs = array_merge($multiArgs, $priceArgs);
$type = $option->getType();
switch ($type) {
case 'file':
$optionArgs = array_merge($commonArgs, $priceArgs, $fileArgs);
break;
case 'field':
case 'area':
$optionArgs = array_merge($commonArgs, $priceArgs, $txtArgs);
break;
case 'date':
case 'date_time':
case 'time':
$optionArgs = array_merge($commonArgs, $priceArgs);
break;
default:
$optionArgs = $commonArgs;
break;
}
$optionArray = $option->toArray($optionArgs);
if (in_array($type, $multi)) {
$optionArray['values'] = array();
foreach ($option->getValues() as $value) {
$optionArray['values'][] = $value->toArray($valueArgs);
}
}
return $optionArray;
}
示例2: _getCustomOptionValuesPrices
/**
* Get all custom option values prices
*
* @param Mage_Catalog_Model_Product_Option $option
* @return array
*/
protected function _getCustomOptionValuesPrices($option)
{
$values = $option->getValues();
$prices = array();
if ($values) {
foreach ($values as $value) {
/* @var $value Mage_Catalog_Model_Product_Option_Value */
$prices[] = $value->getPrice(true);
}
}
return $prices;
}
示例3: _getOptionValues
/**
* Retrieve option values or false for options which has no values
*
* @param Mage_Catalog_Model_Product_Option $option
* @return array|bool
*/
protected function _getOptionValues(Mage_Catalog_Model_Product_Option $option)
{
$values = $option->getValues();
if (!empty($values)) {
$result = array();
/** @var $value Mage_Catalog_Model_Product_Option_Value */
foreach ($values as $value) {
$optionData = array();
foreach ($this->_assertOptionValues as $assertKey) {
if ($value->hasData($assertKey)) {
$optionData[$assertKey] = $value->getData($assertKey);
}
}
$result[] = $optionData;
}
return $result;
}
return false;
}
示例4: _processProductOption
/**
* Check whether required option is not missed, add values to configuration
*
* @param array $skuParts
* @param Mage_Catalog_Model_Product_Option $option
* @return bool
*/
protected function _processProductOption(array &$skuParts, Mage_Catalog_Model_Product_Option $option)
{
$missedRequired = true;
$optionValues = $option->getValues();
if (empty($optionValues)) {
if ($option->hasSku()) {
$found = array_search($option->getSku(), $skuParts);
if ($found !== false) {
unset($skuParts[$found]);
}
}
// we are not able to configure such option automatically
return !$missedRequired;
}
foreach ($optionValues as $optionValue) {
$found = array_search($optionValue->getSku(), $skuParts);
if ($found !== false) {
$this->_addSuccessOption($option, $optionValue);
unset($skuParts[$found]);
// we've found the value of required option
$missedRequired = false;
if (!$this->_isOptionMultiple($option)) {
break 1;
}
}
}
return !$missedRequired;
}