File tree Expand file tree Collapse file tree 2 files changed +26
-19
lines changed
ConfigurableProduct/Model/Product/Configuration/Item
GroupedProduct/Model/Product/Configuration/Item Expand file tree Collapse file tree 2 files changed +26
-19
lines changed Original file line number Diff line number Diff line change @@ -47,17 +47,19 @@ public function getFinalProduct(ItemInterface $item) : ProductInterface
47
47
* or if child thumbnail is not available.
48
48
*/
49
49
$ parentProduct = $ item ->getProduct ();
50
- $ configValue = $ this ->scopeConfig ->getValue (
51
- self ::CONFIG_THUMBNAIL_SOURCE ,
52
- \Magento \Store \Model \ScopeInterface::SCOPE_STORE
53
- );
54
-
50
+ $ finalProduct = $ parentProduct ;
55
51
$ childProduct = $ this ->getChildProduct ($ item );
56
- $ childThumb = $ childProduct ->getData ('thumbnail ' );
57
- $ finalProduct =
58
- ($ configValue == Thumbnail::OPTION_USE_PARENT_IMAGE ) || (!$ childThumb || $ childThumb == 'no_selection ' )
59
- ? $ parentProduct
60
- : $ childProduct ;
52
+ if ($ childProduct !== $ parentProduct ) {
53
+ $ configValue = $ this ->scopeConfig ->getValue (
54
+ self ::CONFIG_THUMBNAIL_SOURCE ,
55
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
56
+ );
57
+ $ childThumb = $ childProduct ->getData ('thumbnail ' );
58
+ $ finalProduct =
59
+ ($ configValue == Thumbnail::OPTION_USE_PARENT_IMAGE ) || (!$ childThumb || $ childThumb == 'no_selection ' )
60
+ ? $ parentProduct
61
+ : $ childProduct ;
62
+ }
61
63
return $ finalProduct ;
62
64
}
63
65
Original file line number Diff line number Diff line change @@ -46,17 +46,22 @@ public function getFinalProduct(ItemInterface $item) : ProductInterface
46
46
* Show grouped product thumbnail if it must be always shown according to the related setting in system config
47
47
* or if child product thumbnail is not available.
48
48
*/
49
- $ configValue = $ this ->scopeConfig ->getValue (
50
- self ::CONFIG_THUMBNAIL_SOURCE ,
51
- \Magento \Store \Model \ScopeInterface::SCOPE_STORE
52
- );
49
+
53
50
$ childProduct = $ item ->getProduct ();
54
- $ childThumb = $ childProduct ->getData ('thumbnail ' );
51
+ $ finalProduct = $ childProduct ;
52
+ $ parentProduct = $ this ->getParentProduct ($ item );
53
+ if ($ childProduct !== $ parentProduct ) {
54
+ $ configValue = $ this ->scopeConfig ->getValue (
55
+ self ::CONFIG_THUMBNAIL_SOURCE ,
56
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
57
+ );
58
+ $ childThumb = $ childProduct ->getData ('thumbnail ' );
55
59
56
- $ finalProduct =
57
- ($ configValue == Thumbnail::OPTION_USE_PARENT_IMAGE ) || (!$ childThumb || $ childThumb == 'no_selection ' )
58
- ? $ this ->getParentProduct ($ item )
59
- : $ childProduct ;
60
+ $ finalProduct =
61
+ ($ configValue == Thumbnail::OPTION_USE_PARENT_IMAGE ) || (!$ childThumb || $ childThumb == 'no_selection ' )
62
+ ? $ parentProduct
63
+ : $ childProduct ;
64
+ }
60
65
return $ finalProduct ;
61
66
}
62
67
You can’t perform that action at this time.
0 commit comments