當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InjectableFixture::getSpecialPrice方法代碼示例

本文整理匯總了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}.";
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:18,代碼來源:AssertProductPage.php

示例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();
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:10,代碼來源:AssertProductCustomOptionsOnProductPage.php

示例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;
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:38,代碼來源:AssertProductInCart.php

示例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);
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:11,代碼來源:AssertProductSpecialPriceOnProductPage.php


注:本文中的Magento\Mtf\Fixture\InjectableFixture::getSpecialPrice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。