Exemple #1
0
 /**
  * Find cart item blocks for associated products
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function findCartItems(FixtureInterface $product)
 {
     $cartItems = [];
     /** @var GroupedProductInjectable $product */
     $associatedProducts = $product->getAssociated()['products'];
     foreach ($associatedProducts as $product) {
         $cartItems[$product->getSku()] = parent::getCartItem($product);
     }
     return $cartItems;
 }
Exemple #2
0
 /**
  * Return product options on view page
  *
  * @param FixtureInterface $product
  * @return array
  */
 public function getOptions(FixtureInterface $product)
 {
     $options = [];
     if ($product instanceof InjectableFixture) {
         /** @var GroupedProductInjectable $product */
         $associatedProducts = $product->getAssociated()['products'];
     } else {
         // TODO: Removed after refactoring(removed) old product fixture.
         /** @var GroupedProduct $product */
         $associatedProducts = $product->getAssociatedProducts();
     }
     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;
 }