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


PHP CatalogProductView::getCustomOptionsBlock方法代碼示例

本文整理匯總了PHP中Magento\Catalog\Test\Page\Product\CatalogProductView::getCustomOptionsBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CatalogProductView::getCustomOptionsBlock方法的具體用法?PHP CatalogProductView::getCustomOptionsBlock怎麽用?PHP CatalogProductView::getCustomOptionsBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Catalog\Test\Page\Product\CatalogProductView的用法示例。


在下文中一共展示了CatalogProductView::getCustomOptionsBlock方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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)
 {
     $this->openProductPage($product, $browser);
     // Prepare data
     $formCustomOptions = $catalogProductView->getCustomOptionsBlock()->getOptions($product);
     $actualPrice = $this->isPrice ? $this->getProductPrice($catalogProductView) : null;
     $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice);
     $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:AssertProductCustomOptionsOnProductPage.php

示例2: processAssert

 /**
  * Assert configurable product, corresponds to the product in the cart
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductConfigurable $configurable
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, Browser $browser, CheckoutCart $checkoutCart)
 {
     //Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html');
     $configurableData = $configurable->getConfigurableAttributesData();
     if (!empty($configurableData)) {
         $configurableOption = $catalogProductView->getCustomOptionsBlock();
         foreach ($configurableData['attributes_data'] as $attribute) {
             $configurableOption->selectProductCustomOption($attribute['title']);
         }
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     $this->assertOnShoppingCart($configurable, $checkoutCart);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:23,代碼來源:AssertConfigurableInCart.php

示例3: processAssert

 /**
  * Assert configurable product, corresponds to the product in the cart
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductConfigurable $configurable
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, CheckoutCart $checkoutCart)
 {
     //Add product to cart
     $catalogProductView->init($configurable);
     $catalogProductView->open();
     $configurableData = $configurable->getConfigurableAttributesData();
     if (!empty($configurableData)) {
         $configurableOption = $catalogProductView->getCustomOptionsBlock();
         foreach ($configurableData['attributes_data'] as $attribute) {
             $configurableOption->selectProductCustomOption(reset($attribute['options'])['name']);
         }
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     $this->assertOnShoppingCart($configurable, $checkoutCart);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:23,代碼來源:AssertConfigurableInCart.php

示例4: 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');
     $productOptions = $product->getCustomOptions();
     if ($productOptions) {
         $customOption = $catalogProductView->getCustomOptionsBlock();
         $options = $customOption->getOptions();
         $key = $productOptions[0]['title'];
         $customOption->selectProductCustomOption($options[$key]['title']);
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:24,代碼來源:AssertProductInCart.php

示例5: processAssert

 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $catalogProductView->init($product);
     $catalogProductView->open();
     $productOptions = $product->getCustomOptions();
     if ($productOptions) {
         $customOption = $catalogProductView->getCustomOptionsBlock();
         $options = $customOption->getOptions();
         $key = $productOptions[0]['title'];
         $customOption->selectProductCustomOption(reset($options[$key]['value']));
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:24,代碼來源:AssertProductInCart.php

示例6: processAssert

 /**
  * Assertion that commodity options are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     $this->product = $product;
     // TODO fix initialization url for frontend page
     // Open product view page
     $catalogProductView->init($this->product);
     $catalogProductView->open();
     // Prepare data
     $customOptions = $catalogProductView->getCustomOptionsBlock()->getOptions();
     foreach ($customOptions as &$option) {
         unset($option['value']);
     }
     unset($option);
     $compareOptions = $this->prepareOptionArray($this->product->getCustomOptions());
     $customOptions = $this->dataSortByKey($customOptions);
     $compareOptions = $this->dataSortByKey($compareOptions);
     \PHPUnit_Framework_Assert::assertEquals($customOptions, $compareOptions, 'Incorrect display of custom product options on the product page.');
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:25,代碼來源:AssertCustomOptionsOnProductPage.php

示例7: addToCart

 /**
  * Fill bundle option on frontend add click "Add to cart" button
  *
  * @param CatalogProductBundle $product
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function addToCart(CatalogProductBundle $product, CatalogProductView $catalogProductView)
 {
     $fillData = $product->getDataFieldConfig('checkout_data')['source']->getPreset();
     if (isset($fillData['bundle_options'])) {
         $this->fillBundleOptions($fillData['bundle_options']);
     }
     if (isset($fillData['custom_options'])) {
         $catalogProductView->getCustomOptionsBlock()->fillCustomOptions($product, $fillData['custom_options']);
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:Bundle.php


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