当前位置: 首页>>代码示例>>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;未经允许,请勿转载。