本文整理汇总了PHP中Magento\Catalog\Model\Product\Option::getRegularPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::getRegularPrice方法的具体用法?PHP Option::getRegularPrice怎么用?PHP Option::getRegularPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product\Option
的用法示例。
在下文中一共展示了Option::getRegularPrice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetRegularPrice
public function testGetRegularPrice()
{
$priceInfoMock = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\PriceInfoInterface', [], '', false, false, true, ['getAmount', 'getPrice']);
$priceInfoMock->expects($this->once())->method('getPrice')->willReturnSelf();
$amountMock = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Amount\\AmountInterface');
$priceInfoMock->expects($this->once())->method('getAmount')->willReturn($amountMock);
$this->productMock->expects($this->once())->method('getPriceInfo')->willReturn($priceInfoMock);
$amountMock->expects($this->once())->method('getValue')->willReturn(50);
$this->model->setPrice(50);
$this->model->setPriceType(\Magento\Catalog\Model\Product\Option\Value::TYPE_PERCENT);
$this->assertEquals(25, $this->model->getRegularPrice());
$this->model->setPriceType(null);
$this->assertEquals(50, $this->model->getRegularPrice());
}
示例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;
}