本文整理汇总了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;
}
示例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;
}
示例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;
}