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