本文整理汇总了PHP中Magento\Mtf\Fixture\FixtureInterface::getGroupPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP FixtureInterface::getGroupPrice方法的具体用法?PHP FixtureInterface::getGroupPrice怎么用?PHP FixtureInterface::getGroupPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getGroupPrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertOnShoppingCart
/**
* Assert prices on the shopping cart
*
* @param FixtureInterface $product
* @param CheckoutCart $checkoutCart
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function assertOnShoppingCart(FixtureInterface $product, CheckoutCart $checkoutCart)
{
$checkoutCart->open();
/** @var CatalogProductSimple $product */
$customOptions = $product->getCustomOptions();
$checkoutData = $product->getCheckoutData();
$checkoutCartItem = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : [];
$checkoutCustomOptions = isset($checkoutData['options']['custom_options']) ? $checkoutData['options']['custom_options'] : [];
$fixturePrice = $product->getPrice();
$groupPrice = $product->getGroupPrice();
$specialPrice = $product->getSpecialPrice();
$cartItem = $checkoutCart->getCartBlock()->getCartItem($product);
$formPrice = $cartItem->getPrice();
if ($groupPrice) {
$groupPrice = reset($groupPrice);
$fixturePrice = $groupPrice['price'];
}
if ($specialPrice) {
$fixturePrice = $specialPrice;
}
if (isset($checkoutCartItem['price'])) {
$fixturePrice = $checkoutCartItem['price'];
}
$fixtureActualPrice = $fixturePrice;
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']) {
$fixtureActualPrice += $option['price'];
} else {
$fixtureActualPrice += $fixturePrice / 100 * $option['price'];
}
}
\PHPUnit_Framework_Assert::assertEquals($fixtureActualPrice, $formPrice, 'Product price in shopping cart is not correct.');
}