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


PHP FixtureInterface::getAssociated方法代码示例

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


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

示例1: findCartItems

 /**
  * Find cart item blocks for associated products.
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function findCartItems(FixtureInterface $product)
 {
     $cartItems = [];
     /** @var GroupedProduct $product */
     $associatedProducts = $product->getAssociated()['products'];
     foreach ($associatedProducts as $product) {
         $cartItems[$product->getSku()] = parent::getCartItem($product);
     }
     return $cartItems;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:16,代码来源:Sidebar.php

示例2: prepareOptions

 /**
  * Prepare options
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function prepareOptions(FixtureInterface $product)
 {
     /** @var GroupedProduct $product */
     $productOptions = [];
     $checkoutData = $product->getCheckoutData()['options'];
     if (count($checkoutData)) {
         $associated = $product->getAssociated();
         foreach ($checkoutData as $optionData) {
             $productKey = str_replace('product_key_', '', $optionData['name']);
             $productOptions[] = ['option_name' => $associated['assigned_products'][$productKey]['name'], 'value' => $optionData['qty']];
         }
     }
     return $productOptions;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:AssertGroupedProductInCustomerWishlistOnBackendGrid.php

示例3: __construct

 /**
  * @constructor
  * @param FixtureInterface $product
  */
 public function __construct(FixtureInterface $product)
 {
     /** @var GroupedProduct $product */
     $checkoutData = $product->getCheckoutData();
     $this->data = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : [];
     $associatedProducts = [];
     $cartItem = [];
     foreach ($product->getAssociated()['products'] as $key => $product) {
         $key = 'product_key_' . $key;
         $associatedProducts[$key] = $product;
     }
     // Replace key in checkout data
     foreach ($this->data as $fieldName => $fieldValues) {
         foreach ($fieldValues as $key => $value) {
             $product = $associatedProducts[$key];
             $cartItem[$fieldName][$product->getSku()] = $value;
         }
     }
     // Add empty "options" field
     foreach ($associatedProducts as $product) {
         $cartItem['options'][] = ['title' => $product->getName(), 'value' => $cartItem['qty'][$product->getSku()]];
     }
     $this->data = $cartItem;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:28,代码来源:Item.php

示例4: getOptions

 /**
  * Return product options on view page.
  *
  * @param FixtureInterface $product
  * @return array
  */
 public function getOptions(FixtureInterface $product)
 {
     /** @var GroupedProduct $product */
     $associatedProducts = $product->getAssociated()['products'];
     $options = [];
     foreach ($associatedProducts as $subProduct) {
         /** @var CatalogProductSimple $subProduct */
         $subProductBlock = $this->_rootElement->find(sprintf($this->subProductByName, $subProduct->getName()), Locator::SELECTOR_XPATH);
         $options[] = ['name' => $subProductBlock->find($this->productName)->getText(), 'price' => $subProductBlock->find($this->price)->getText(), 'qty' => $subProductBlock->find($this->qty)->getValue()];
     }
     return $options;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:18,代码来源:Grouped.php


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