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


PHP CatalogProductView::getViewBlock方法代码示例

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


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

示例1: run

 /**
  * Open product on frontend and click Checkout with PayPal button.
  *
  * @return void
  */
 public function run()
 {
     $product = reset($this->products);
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $parentWindow = $this->catalogProductView->getViewBlock()->braintreePaypalCheckout();
     $this->catalogProductView->getBraintreePaypalBlock()->process($parentWindow);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CheckoutWithPaypalFromMinicartStep.php

示例2: processAssert

 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->fillOptions($product);
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:18,代码来源:AssertProductInCart.php

示例3: run

 /**
  * Add products to the cart
  *
  * @return void
  */
 public function run()
 {
     // Ensure that shopping cart is empty
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     foreach ($this->products as $product) {
         $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->addToCart($product);
         $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AddProductsToTheCartStep.php

示例4: run

 /**
  * Add products to the wish list
  *
  * @return void
  */
 public function run()
 {
     foreach ($this->products as $product) {
         $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         if ($this->configure) {
             $this->catalogProductView->getViewBlock()->addToWishlist($product);
         } else {
             $this->catalogProductView->getViewBlock()->clickAddToWishlist();
         }
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:16,代码来源:AddProductsToWishlistStep.php

示例5: processAssert

 /**
  * Assertion that commodity options are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $actualPrice = null;
     if ($this->isPrice) {
         $prices = $catalogProductView->getViewBlock()->getPriceBlock()->getPrice();
         $actualPrice = isset($prices['price_special_price']) ? $prices['price_special_price'] : $prices['price_regular_price'];
     }
     $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice);
     $formCustomOptions = $catalogProductView->getViewBlock()->getOptions($product)['custom_options'];
     $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:21,代码来源:AssertProductCustomOptionsOnProductPage.php

示例6: assertOnProductView

 /**
  * Assert prices on the product view Page
  *
  * @param CatalogProductConfigurable $configurable
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 protected function assertOnProductView(CatalogProductConfigurable $configurable, CatalogProductView $catalogProductView)
 {
     /** @var \Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable\Price $priceFixture */
     $priceFixture = $configurable->getDataFieldConfig('price')['source'];
     $pricePresetData = $priceFixture->getPreset();
     if (isset($pricePresetData['product_special_price'])) {
         $regularPrice = $catalogProductView->getViewBlock()->getProductPriceBlock()->getRegularPrice();
         \PHPUnit_Framework_Assert::assertEquals($pricePresetData['product_price'], $regularPrice, 'Product regular price on product view page is not correct.');
         $specialPrice = $catalogProductView->getViewBlock()->getProductPriceBlock()->getSpecialPrice();
         \PHPUnit_Framework_Assert::assertEquals($pricePresetData['product_special_price'], $specialPrice, 'Product special price on product view page is not correct.');
     } else {
         //Price verification
         $price = $catalogProductView->getViewBlock()->getProductPriceBlock($configurable->getName())->getPrice();
         \PHPUnit_Framework_Assert::assertEquals($price['price_regular_price'], $pricePresetData['product_price'], 'Product price on category page is not correct.');
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:23,代码来源:AssertConfigurableView.php

示例7: processAssert

 /**
  * Assert that In Stock status is displayed on product page
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     // TODO fix initialization url for frontend page
     $catalogProductView->init($product);
     $catalogProductView->open();
     \PHPUnit_Framework_Assert::assertEquals(self::STOCK_AVAILABILITY, $catalogProductView->getViewBlock()->stockAvailability(), 'Control \'' . self::STOCK_AVAILABILITY . '\' is not visible.');
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:14,代码来源:AssertProductInStock.php

示例8: addToCardPresentOnProduct

 /**
  * "Add to cart" button is display on Product page
  *
  * @return void
  */
 protected function addToCardPresentOnProduct()
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategoryByName($this->product->getCategoryIds()[0]);
     $this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->product->getName());
     \PHPUnit_Framework_Assert::assertTrue($this->catalogProductView->getViewBlock()->checkAddToCardButton(), "Button 'Add to Card' is absent on Product page.");
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:AssertAddToCartButtonPresent.php

示例9: assertPrice

 /**
  * Assert prices on the product view page and shopping cart page.
  *
  * @param BundleProduct $product
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCartView
  * @param BundleProduct $originalProduct [optional]
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function assertPrice(BundleProduct $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCartView, BundleProduct $originalProduct = null)
 {
     $customerGroup = 'NOT LOGGED IN';
     $bundleData = $product->getData();
     $this->productPriceType = $originalProduct !== null ? $originalProduct->getPriceType() : $product->getPriceType();
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCartView->open();
     $cartItem = $checkoutCartView->getCartBlock()->getCartItem($product);
     $specialPrice = 0;
     if (isset($bundleData['group_price'])) {
         $specialPrice = $bundleData['group_price'][array_search($customerGroup, $bundleData['group_price'])]['price'] / 100;
     }
     $optionPrice = [];
     $fillData = $product->getCheckoutData();
     foreach ($fillData['options']['bundle_options'] as $key => $data) {
         $subProductPrice = 0;
         foreach ($bundleData['bundle_selections']['products'][$key] as $productKey => $itemProduct) {
             if (strpos($itemProduct->getName(), $data['value']['name']) !== false) {
                 $data['value']['key'] = $productKey;
                 $subProductPrice = $itemProduct->getPrice();
             }
         }
         $optionPrice[$key]['price'] = $this->productPriceType == 'Fixed' ? number_format($bundleData['bundle_selections']['bundle_options'][$key]['assigned_products'][$data['value']['key']]['data']['selection_price_value'], 2) : number_format($subProductPrice, 2);
     }
     foreach ($optionPrice as $index => $item) {
         $item['price'] -= $item['price'] * $specialPrice;
         \PHPUnit_Framework_Assert::assertEquals(number_format($item['price'], 2), $cartItem->getPriceBundleOptions($index + 1), 'Bundle item ' . ($index + 1) . ' options on frontend don\'t equal to fixture.');
     }
     $sumOptionsPrice = $product->getDataFieldConfig('price')['source']->getPriceData()['cart_price'];
     $subTotal = number_format($cartItem->getPrice(), 2);
     \PHPUnit_Framework_Assert::assertEquals($sumOptionsPrice, $subTotal, 'Bundle unit price on frontend doesn\'t equal to fixture.');
 }
开发者ID:nja78,项目名称:magento2,代码行数:44,代码来源:AssertBundlePriceType.php

示例10: processAssert

 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param ConfigurableProductInjectable $product
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, ConfigurableProductInjectable $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutData = $product->getCheckoutData();
     $price = $checkoutCart->getCartBlock()->getCartItem($product)->getPrice();
     \PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:17,代码来源:AssertConfigurableProductInCart.php

示例11: processAssert

 /**
  * Check whether there is an opportunity to compare products using given attribute.
  *
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductCompare $catalogProductCompare
  */
 public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCompare();
     $catalogProductCompare->open();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogProductCompare->getCompareProductsBlock()->getComparableAttributes()), 'Attribute is absent on product compare page.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AssertProductAttributeIsComparable.php

示例12: processAssert

 /**
  * Assert that displayed product data on product page(front-end) equals passed from fixture:
  * 1. Product Name
  * 2. Price
  * 3. Special price
  * 4. SKU
  * 5. Description
  * 6. Short Description
  *
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->product = $product;
     $this->productView = $catalogProductView->getViewBlock();
     $errors = $this->verify();
     \PHPUnit_Framework_Assert::assertEmpty($errors, "\nFound the following errors:\n" . implode(" \n", $errors));
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:22,代码来源:AssertProductPage.php

示例13: processAssert

 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     // TODO fix initialization url for frontend page
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     //Process assertions
     $this->assertPrice($product, $catalogProductView->getViewBlock());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AssertProductTierPriceOnProductPage.php

示例14: addProducts

 /**
  * Add products to compare list
  *
  * @param array $products
  * @return void
  */
 protected function addProducts(array $products)
 {
     foreach ($products as $itemProduct) {
         $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->clickAddToCompare();
         $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:AssertWidgetRecentlyComparedProducts.php

示例15: addToCart

 /**
  * Fill options get price and add to cart
  *
  * @param CatalogProductSimple $product
  * @param array $actualPrices
  * @return array
  */
 protected function addToCart(CatalogProductSimple $product, $actualPrices)
 {
     $this->catalogProductView->getViewBlock()->fillOptions($product);
     $actualPrices['product_page_price'] = $this->catalogProductView->getViewBlock()->getPriceBlock()->getPrice();
     $this->catalogProductView->getViewBlock()->clickAddToCart();
     $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
     return $actualPrices;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:AbstractAssertTaxWithCrossBorderApplying.php


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