当前位置: 首页>>代码示例>>PHP>>正文


PHP InjectableFixture::getPrice方法代码示例

本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getPrice方法的具体用法?PHP InjectableFixture::getPrice怎么用?PHP InjectableFixture::getPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Mtf\Fixture\InjectableFixture的用法示例。


在下文中一共展示了InjectableFixture::getPrice方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAssert

 /**
  * Assert that duplicated product can be found in grid by type, template, status and stock status.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid)
 {
     $config = $product->getDataConfig();
     $filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
     $productGrid->open()->getProductGrid()->search($filter);
     \PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false, false), 'Product duplicate is absent in Products grid.');
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:AssertProductDuplicatedInGrid.php

示例2: getProductPrice

 /**
  * Get configurable product price.
  *
  * @param InjectableFixture $product
  * @return int
  */
 protected function getProductPrice(InjectableFixture $product)
 {
     $price = $product->getPrice();
     if (!$this->productsIsConfigured) {
         return $price;
     }
     $checkoutData = $product->getCheckoutData();
     if ($checkoutData === null) {
         return 0;
     }
     $attributesData = $product->getConfigurableOptions()['attributes_data'];
     foreach ($checkoutData['options']['configurable_options'] as $option) {
         $itemOption = $attributesData[$option['title']]['options'][$option['value']];
         $price += $itemOption['price_type'] == 'Fixed' ? $itemOption['price'] : $product->getPrice() / 100 * $itemOption['price'];
     }
     return $price;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:23,代码来源:AssertConfigurableProductInItemsOrderedGrid.php

示例3: verifyPrice

 /**
  * Verify displayed product price on product page(front-end) equals passed from fixture.
  *
  * @return string|null
  */
 protected function verifyPrice()
 {
     if ($this->product->hasData('price') == false) {
         return null;
     }
     $fixtureProductPrice = number_format($this->product->getPrice(), 2);
     $formProductPrice = $this->productView->getPriceBlock()->getRegularPrice();
     if ($fixtureProductPrice == $formProductPrice) {
         return null;
     }
     $error = "Displayed product price on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductPrice}, expected: {$fixtureProductPrice}.";
     $verifySpecialPriceResult = $this->verifySpecialPrice();
     if ($verifySpecialPriceResult !== null) {
         $error .= $verifySpecialPriceResult;
     }
     return $error;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:22,代码来源:AssertProductPage.php

示例4: 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

示例5: prepareAttributeData

 /**
  * Prepare attribute data.
  *
  * @param InjectableFixture $product
  * @param int $key
  * @return array
  */
 protected function prepareAttributeData(InjectableFixture $product, $key)
 {
     $data = [];
     foreach ($this->attributeProduct as $attributeKey => $attribute) {
         $value = $attribute;
         $attribute = is_numeric($attributeKey) ? $attribute : $attributeKey;
         $attributeValue = $attribute != 'price' ? $product->hasData($attribute) ? $product->getData($attribute) : 'N/A' : ($product->getDataFieldConfig('price')['source']->getPreset() !== null ? $product->getDataFieldConfig('price')['source']->getPreset() : number_format($product->getPrice(), 2));
         $data['attributeValues'][$attribute] = !is_array($attributeValue) ? strtolower($attributeValue) : $attributeValue;
         $attributeName = $value === 'name' || $value === 'price' ? 'Info' : 'MetaData';
         $data['attributeValuesFromPage'][$attribute] = $this->comparePage->getCompareProductsBlock()->{'getProduct' . $attributeName}($key + 1, $value);
     }
     return $data;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:20,代码来源:AssertProductComparePage.php

示例6: getAssignedProductPrice

 /**
  * Get assigned product price.
  *
  * @param array $dataAssignedProduct
  * @param InjectableFixture $fixtureAssignedProduct
  * @param string $optionType
  * @return float
  */
 protected function getAssignedProductPrice(array $dataAssignedProduct, InjectableFixture $fixtureAssignedProduct, $optionType)
 {
     $resultPrice = $fixtureAssignedProduct->getPrice();
     if (isset($dataAssignedProduct['selection_price_value'])) {
         $assignedItemPrice = $dataAssignedProduct['selection_price_type'] == 'Fixed' ? $dataAssignedProduct['selection_price_value'] : $this->product->getPrice() * $dataAssignedProduct['selection_price_value'] / 100;
         $resultPrice = $optionType == 'Drop-down' || $optionType == 'Radio Buttons' ? $assignedItemPrice : $assignedItemPrice * $dataAssignedProduct['selection_qty'];
     }
     return $resultPrice;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:17,代码来源:AssertBundleItemsOnProductPage.php

示例7: assertPrice

 /**
  * Verify product price on category view page.
  *
  * @param InjectableFixture $product
  * @param CatalogCategoryView $catalogCategoryView
  * @return void
  */
 protected function assertPrice(InjectableFixture $product, CatalogCategoryView $catalogCategoryView)
 {
     $price = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName())->getRegularPrice();
     \PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $price, 'Product regular price on category page is not correct.');
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:12,代码来源:AssertProductInCategory.php

示例8: 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

示例9: getProductPrice

 /**
  * Get product price.
  *
  * @param InjectableFixture $product
  * @return int
  */
 protected function getProductPrice(InjectableFixture $product)
 {
     return isset($product->getCheckoutData()['cartItem']['price']) ? $product->getCheckoutData()['cartItem']['price'] : $product->getPrice();
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:10,代码来源:AssertProductInItemsOrderedGrid.php


注:本文中的Magento\Mtf\Fixture\InjectableFixture::getPrice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。