diff --git a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php b/app/code/Magento/Catalog/Block/Product/ImageBuilder.php index b752000f5a19d..f1149f15c41d3 100644 --- a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php +++ b/app/code/Magento/Catalog/Block/Product/ImageBuilder.php @@ -146,6 +146,7 @@ public function create() 'custom_attributes' => $this->getCustomAttributes(), 'resized_image_width' => $imagesize[0], 'resized_image_height' => $imagesize[1], + 'product_id' => $this->product->getId() ], ]; diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php index dc152aaf05867..3094b423a4be4 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php @@ -252,6 +252,7 @@ private function getTestDataWithoutAttributes(): array 'custom_attributes' => '', 'resized_image_width' => 100, 'resized_image_height' => 100, + 'product_id' => null ], ], ]; @@ -286,6 +287,7 @@ private function getTestDataWithAttributes(): array 'custom_attributes' => 'name_1="value_1" name_2="value_2"', 'resized_image_width' => 120, 'resized_image_height' => 70, + 'product_id' => null ], ], ];