本文整理匯總了PHP中Magento\Catalog\Model\Product\Option::getPriceType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Option::getPriceType方法的具體用法?PHP Option::getPriceType怎麽用?PHP Option::getPriceType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Model\Product\Option
的用法示例。
在下文中一共展示了Option::getPriceType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: read
/**
* {@inheritdoc}
*/
public function read(\Magento\Catalog\Model\Product\Option $option)
{
$fields = [Metadata::PRICE => $option->getPrice(), Metadata::PRICE_TYPE => $option->getPriceType(), Metadata::SKU => $option->getSku()];
$fields = array_merge($fields, $this->getCustomAttributes($option));
$value = $this->valueBuilder->populateWithArray($fields)->create();
return [$value];
}
示例2: _getPriceConfiguration
/**
* Get price configuration
*
* @param \Magento\Catalog\Model\Product\Option\Value|\Magento\Catalog\Model\Product\Option $option
* @return array
*/
protected function _getPriceConfiguration($option)
{
$optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false);
$data = ['prices' => ['oldPrice' => ['amount' => $this->pricingHelper->currency($option->getRegularPrice(), false, false), 'adjustments' => []], 'basePrice' => ['amount' => $this->_catalogData->getTaxPrice($option->getProduct(), $optionPrice, false, null, null, null, null, null, false)], 'finalPrice' => ['amount' => $this->_catalogData->getTaxPrice($option->getProduct(), $optionPrice, true, null, null, null, null, null, false)]], 'type' => $option->getPriceType(), 'name' => $option->getTitle()];
return $data;
}
示例3: validateOptionValue
/**
* Validate option type fields
*
* @param Option $option
* @return bool
*/
protected function validateOptionValue(Option $option)
{
return $this->isInRange($option->getPriceType(), $this->priceTypes) && !$this->isNegative($option->getPrice());
}
示例4: _getPriceConfiguration
/**
* Get price configuration
*
* @param \Magento\Catalog\Model\Product\Option\Value|\Magento\Catalog\Model\Product\Option $option
* @return array
*/
protected function _getPriceConfiguration($option)
{
$data = array();
$data['price'] = $this->_coreData->currency($option->getPrice(true), false, false);
$data['oldPrice'] = $this->_coreData->currency($option->getPrice(false), false, false);
$data['priceValue'] = $option->getPrice(false);
$data['type'] = $option->getPriceType();
$data['exclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price'], false);
$data['inclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price'], true);
return $data;
}