File tree Expand file tree Collapse file tree 3 files changed +57
-2
lines changed
Plugin/Frontend/Codazon/ThemeLayoutPro/Helper
view/frontend/templates/product Expand file tree Collapse file tree 3 files changed +57
-2
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magefan (support@magefan.com). All rights reserved.
4+ * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
5+ */
6+
7+ declare (strict_types=1 );
8+
9+ namespace Magefan \ProductLabel \Plugin \Frontend \Codazon \ThemeLayoutPro \Helper ;
10+
11+ use Magefan \ProductLabel \Model \Config ;
12+ use Magefan \ProductLabel \Model \Parser \Html ;
13+
14+ class Data
15+ {
16+ /**
17+ * @var Config
18+ */
19+ protected $ config ;
20+
21+ /**
22+ * @param Config $config
23+ */
24+ public function __construct (
25+ Config $ config
26+ ) {
27+ $ this ->config = $ config ;
28+ }
29+
30+ /**
31+ * @param $subject
32+ * @param $result
33+ * @param $product
34+ * @return mixed|string
35+ */
36+ public function afterGetProductImageHtml ($ subject , $ result , $ product )
37+ {
38+ return ($ result && $ this ->config ->isEnabled ())
39+ ? $ result . Html::COMMENT_PREFIX . $ product ->getId () . Html::COMMENT_SUFFIX
40+ : $ result ;
41+ }
42+ }
Original file line number Diff line number Diff line change 1717 <plugin name =" wrap_gallery_image_with_mf_comments" type =" Magefan\ProductLabel\Plugin\Frontend\Magento\Catalog\Block\Product\View\Gallery" sortOrder =" 10" disabled =" false" />
1818 </type >
1919
20- <type name =" MageSuite\ProductTile\Block\Tile\Container" >
20+ <type name =" MageSuite\ProductTile\Block\Tile\Container" >
2121 <plugin name =" add_mf_comments_to_mage_suite_product_tile" type =" Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile\Container" sortOrder =" 10" disabled =" false" />
2222 </type >
23+
24+ <type name =" Codazon\ThemeLayoutPro\Helper\Data" >
25+ <plugin name =" add_mf_comments_to_codazon_theme_layout_pro_data_helper" type =" Magefan\ProductLabel\Plugin\Frontend\Codazon\ThemeLayoutPro\Helper\Data" sortOrder =" 10" disabled =" false" />
26+ </type >
2327</config >
Original file line number Diff line number Diff line change 2222 <?php $ script = "
2323 require(['jquery'], function ($) {
2424 $('[data-gallery-role=gallery-placeholder]').on('gallery:loaded', function () {
25- $(this).parent().find('.mf-label-container').prependTo(' " . $ escaper ->escapeHtml ($ block ->getConfig ()->getProductPageContainerSelector ()) . "')
25+
26+ let mfLabelContainer = $(this).parent().find('.mf-label-container');
27+
28+ if (!mfLabelContainer.length) {
29+ mfLabelContainer = $('.product.media .mf-label-container');
30+ }
31+
32+ if (mfLabelContainer.length) {
33+ mfLabelContainer.prependTo(' " . $ escaper ->escapeHtml ($ block ->getConfig ()->getProductPageContainerSelector ()) . "')
34+ }
2635 });
2736 });
2837 " ; ?>
You can’t perform that action at this time.
0 commit comments