本文整理匯總了PHP中Magento\Catalog\Test\Fixture\CatalogProductSimple::getSpecialPrice方法的典型用法代碼示例。如果您正苦於以下問題:PHP CatalogProductSimple::getSpecialPrice方法的具體用法?PHP CatalogProductSimple::getSpecialPrice怎麽用?PHP CatalogProductSimple::getSpecialPrice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Test\Fixture\CatalogProductSimple
的用法示例。
在下文中一共展示了CatalogProductSimple::getSpecialPrice方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: assertOnProductView
/**
* Assert data on the product view page
*
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @return void
*/
protected function assertOnProductView(CatalogProductSimple $product, CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getPriceBlock()->getPrice();
$name = $viewBlock->getProductName();
$sku = $viewBlock->getProductSku();
\PHPUnit_Framework_Assert::assertEquals($product->getName(), $name, 'Product name on product view page is not correct.');
\PHPUnit_Framework_Assert::assertEquals($product->getSku(), $sku, 'Product sku on product view page is not correct.');
if (isset($price['price_regular_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $price['price_regular_price'], 'Product regular price on product view page is not correct.');
}
$priceComparing = false;
if ($specialPrice = $product->getSpecialPrice()) {
$priceComparing = $specialPrice;
}
if ($priceComparing && isset($price['price_special_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($priceComparing, 2), $price['price_special_price'], 'Product special price on product view page is not correct.');
}
}