本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getSpecialPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getSpecialPrice方法的具体用法?PHP InjectableFixture::getSpecialPrice怎么用?PHP InjectableFixture::getSpecialPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\InjectableFixture
的用法示例。
在下文中一共展示了InjectableFixture::getSpecialPrice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verifySpecialPrice
/**
* Verify displayed product special price on product page(front-end) equals passed from fixture.
*
* @return string|null
*/
protected function verifySpecialPrice()
{
$fixtureProductSpecialPrice = $this->product->getSpecialPrice();
if (!$fixtureProductSpecialPrice) {
return null;
}
$fixtureProductSpecialPrice = number_format($fixtureProductSpecialPrice, 2);
$formProductSpecialPrice = $this->productView->getPriceBlock()->getSpecialPrice();
if ($fixtureProductSpecialPrice == $formProductSpecialPrice) {
return null;
}
return "\nDisplayed product special price on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductSpecialPrice}, expected: {$fixtureProductSpecialPrice}.";
}
示例2: getProductActualPrice
/**
* Get product actual price.
*
* @param InjectableFixture $product
* @return int
*/
protected function getProductActualPrice(InjectableFixture $product)
{
return $product->hasData('special_price') ? $product->getSpecialPrice() : $product->getPrice();
}
示例3: prepareFixturePrice
/**
* Prepare product price from fixture.
*
* @param InjectableFixture $product
* @return float
*/
protected function prepareFixturePrice(InjectableFixture $product)
{
/** @var CatalogProductSimple $product */
$customOptions = $product->getCustomOptions();
$checkoutData = $product->getCheckoutData();
$checkoutCustomOptions = isset($checkoutData['options']['custom_options']) ? $checkoutData['options']['custom_options'] : [];
if (isset($checkoutData['cartItem'])) {
$fixturePrice = $checkoutData['cartItem']['price'];
} else {
$fixturePrice = $product->getPrice();
$groupPrice = $product->getGroupPrice();
$specialPrice = $product->getSpecialPrice();
if ($groupPrice) {
$groupPrice = reset($groupPrice);
$fixturePrice = $groupPrice['price'];
}
if ($specialPrice) {
$fixturePrice = $specialPrice;
}
foreach ($checkoutCustomOptions as $checkoutOption) {
$attributeKey = str_replace('attribute_key_', '', $checkoutOption['title']);
$optionKey = str_replace('option_key_', '', $checkoutOption['value']);
$option = $customOptions[$attributeKey]['options'][$optionKey];
if ('Fixed' == $option['price_type']) {
$fixturePrice += $option['price'];
} else {
$fixturePrice += $fixturePrice / 100 * $option['price'];
}
}
}
return $fixturePrice;
}
示例4: assertPrice
/**
* Verify product special price on product view page.
*
* @param InjectableFixture $product
* @param View $productViewBlock
* @return void
*/
public function assertPrice(InjectableFixture $product, View $productViewBlock)
{
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getSpecialPrice(), 2), $productViewBlock->getPriceBlock()->getSpecialPrice(), $this->errorMessage);
}