diff --git a/vendor/magento/module-catalog/Block/Product/View/Gallery.php b/vendor/magento/module-catalog/Block/Product/View/Gallery.php index c791eaaec7bdb..d97d87d56ba9b 100644 --- a/vendor/magento/module-catalog/Block/Product/View/Gallery.php +++ b/vendor/magento/module-catalog/Block/Product/View/Gallery.php @@ -148,6 +148,7 @@ public function getGalleryImagesJson() 'isMain' => $this->isMainImage($image), 'type' => $mediaType !== null ? str_replace('external-', '', $mediaType) : '', 'videoUrl' => $image->getVideoUrl(), + '__disableTmpl' => true, ] ); foreach ($this->getGalleryImagesConfig()->getItems() as $imageConfig) { @@ -168,6 +169,7 @@ public function getGalleryImagesJson() 'isMain' => true, 'type' => 'image', 'videoUrl' => null, + '__disableTmpl' => true, ]; } return json_encode($imagesItems); diff --git a/vendor/magento/module-catalog/Block/Ui/ProductViewCounter.php b/vendor/magento/module-catalog/Block/Ui/ProductViewCounter.php index dabec2d54caf5..d5547440cb959 100644 --- a/vendor/magento/module-catalog/Block/Ui/ProductViewCounter.php +++ b/vendor/magento/module-catalog/Block/Ui/ProductViewCounter.php @@ -115,6 +115,26 @@ public function __construct( $this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class); } + /** + * Recursively adds __disableTmpl to every array level + * + * @param array $data + * @return array + */ + private function disableTemplating(array $data): array + { + $isAssociative = (bool) count(array_filter(array_keys($data), 'is_string')); + if ($isAssociative) { + $data['__disableTmpl'] = true; + } + foreach ($data as &$value) { + if (is_array($value)) { + $value = $this->disableTemplating($value); + } + } + return $data; + } + /** * Calculate item data, that will need to application on frontend * @@ -154,6 +174,7 @@ public function getCurrentProductData() ->collect($product, $productRender); $data = $this->hydrator->extract($productRender); $data['is_available'] = $product->isAvailable(); + $data = $this->disableTemplating($data); $currentProductData = [ 'items' => [