當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。