File tree Expand file tree Collapse file tree 3 files changed +69
-13
lines changed
Plugin/Frontend/Codazon/ThemeLayoutPro/Helper
view/frontend/templates/product Expand file tree Collapse file tree 3 files changed +69
-13
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 1- <?xml version =" 1.0" ?>
1+ <?xml version =" 1.0" ?>
22<!--
33/**
44 * Copyright © Magefan (support@magefan.com). All rights reserved.
77-->
88
99<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
10- <type name =" Magento\Catalog\Block\Product\Image" >
11- <plugin name =" wrap_image_with_mf_comments" type =" Magefan\ProductLabel\Plugin\Frontend\Magento\Catalog\Block\Product\Image" sortOrder =" 10" disabled =" false" />
12- </type >
13- <type name =" Magento\Framework\Controller\ResultInterface" >
14- <plugin name =" replace_mf_comments_on_product_labels" type =" Magefan\ProductLabel\Plugin\Frontend\Magento\Framework\Controller\ResultInterface" sortOrder =" -21" disabled =" false" />
15- </type >
16- <type name =" Magento\Catalog\Block\Product\View\Gallery" >
17- <plugin name =" wrap_gallery_image_with_mf_comments" type =" Magefan\ProductLabel\Plugin\Frontend\Magento\Catalog\Block\Product\View\Gallery" sortOrder =" 10" disabled =" false" />
18- </type >
10+ <virtualType name =" Magefan\ProductLabel\ImageUpload" type =" Magefan\ProductLabel\Model\ImageUploader" >
11+ <arguments >
12+ <argument name =" baseTmpPath" xsi : type =" string" >magefan_product_label/tmp</argument >
13+ <argument name =" basePath" xsi : type =" string" >magefan_product_label</argument >
14+ <argument name =" allowedExtensions" xsi : type =" array" >
15+ <item name =" jpg" xsi : type =" string" >jpg</item >
16+ <item name =" jpeg" xsi : type =" string" >jpeg</item >
17+ <item name =" gif" xsi : type =" string" >gif</item >
18+ <item name =" png" xsi : type =" string" >png</item >
19+ </argument >
20+ </arguments >
21+ </virtualType >
1922
20- <type name =" MageSuite\ProductTile\Block\Tile\Container" >
21- <plugin name =" add_mf_comments_to_mage_suite_product_tile" type =" Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile\Container" sortOrder =" 10" disabled =" false" />
23+ <type name =" Magefan\ProductLabel\Controller\Adminhtml\Rule\Upload" >
24+ <arguments >
25+ <argument name =" imageUploader" xsi : type =" object" >Magefan\ProductLabel\ImageUpload</argument >
26+ </arguments >
2227 </type >
2328</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