From eea948d095a6b42713372bc69774e035d9b058e2 Mon Sep 17 00:00:00 2001 From: Kishan Date: Thu, 24 May 2018 12:01:34 +0530 Subject: [PATCH 1/2] Variant product image in sidebar wishlist block --- app/code/Magento/Wishlist/CustomerData/Wishlist.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php index 9583a83a39428..6abed36690864 100644 --- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php +++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php @@ -149,6 +149,13 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem) */ protected function getImageData($product) { + /* Set variant product if it is configurable product. It will show variant product image in sidebar instead of configurable product image. */ + $simpleOption = $product->getCustomOption('simple_product'); + if ($simpleOption !== null) { + $optionProduct = $simpleOption->getProduct(); + $product = $optionProduct; + } + /** @var \Magento\Catalog\Helper\Image $helper */ $helper = $this->imageHelperFactory->create() ->init($product, 'wishlist_sidebar_block'); From fb913ad8e5bc90fafebb1f343fffec1a83bd82be Mon Sep 17 00:00:00 2001 From: kishanpatadia Date: Thu, 24 May 2018 13:39:14 +0530 Subject: [PATCH 2/2] Update Wishlist.php --- app/code/Magento/Wishlist/CustomerData/Wishlist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php index 6abed36690864..50a5259f76c44 100644 --- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php +++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php @@ -149,7 +149,8 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem) */ protected function getImageData($product) { - /* Set variant product if it is configurable product. It will show variant product image in sidebar instead of configurable product image. */ + /*Set variant product if it is configurable product. + It will show variant product image in sidebar instead of configurable product image.*/ $simpleOption = $product->getCustomOption('simple_product'); if ($simpleOption !== null) { $optionProduct = $simpleOption->getProduct();