コード例 #1
0
 /**
  * @return void
  */
 public function testExpandItemsMustAddProductNameToCartItems()
 {
     $changeTransfer = $this->getChangeTransfer();
     $productConcreteTransfer = new ProductConcreteTransfer();
     $productConcreteTransfer->setName(self::PRODUCT_NAME);
     $productManager = $this->getProductManager($productConcreteTransfer);
     $result = $productManager->expandItems($changeTransfer);
     $changedItemTransfer = $result->getItems()[0];
     $this->assertSame($productConcreteTransfer->getName(), $changedItemTransfer->getName());
 }
コード例 #2
0
ファイル: WishlistStorage.php プロジェクト: spryker/Wishlist
 /**
  * @param \Generated\Shared\Transfer\WishlistTransfer $wishlist
  *
  * @return void
  */
 public function expandProductDetails(WishlistTransfer $wishlist)
 {
     foreach ($wishlist->getItems() as $item) {
         $productData = $this->productClient->getProductAbstractFromStorageByIdForCurrentLocale($item->getIdProductAbstract());
         foreach ($productData['product_concrete_collection'] as $product) {
             if ($product['sku'] !== $item->getSku()) {
                 continue;
             }
             $productConcrete = new ProductConcreteTransfer();
             $productConcrete->setName($product['name']);
             $productConcrete->setSku($product['sku']);
             $productConcrete->setAttributes($product['attributes']);
             $item->setProductConcrete($productConcrete);
         }
     }
 }