Magento 2.2 problem with .phtml overwriting using moduleHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento2: How to rename the Details tab on the product details page, via overwriting layout file?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Problem with custom moduleMagento 2.2: Problem with varnish.vcl generatedMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsHelp with overwriting .phtml file in Magento 2.2.7

How can I use my cell phone's light as a reading light?

When do flights get cancelled due to fog?

Is conquering your neighbors to fight a greater enemy a valid strategy?

In layman's terms, does the Luckstone just give a passive +1 to all d20 rolls and saves except for death saves?

Why am I getting unevenly-spread results when using $RANDOM?

How can I review my manager, who is fine?

Can we share mixing jug/beaker for developer, fixer and stop bath?

Need a non-volatile memory IC with near unlimited read/write operations capability

Diagram with cylinder shapes and rectangles

What does "frozen" mean (e.g. for catcodes)?

What factors could lead to bishops establishing monastic armies?

What is the highest level of accuracy in motion control a Victorian society could achieve?

What exactly is a "murder hobo"?

Which is a better conductor, a very thick rubber wire or a very thin copper wire?

Function that detects repetitions

What are the effects of abstaining from eating a certain flavor?

NOLOCK or Read Uncommitted locking / latching behaviours

What is this burst transmission sequence across the entire band?

Was it ever illegal to name a pig "Napoleon" in France?

Computer name naming convention for security

Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?

QR codes, do people use them?

Alice's First Code Review

How should I ask for a "pint" in countries that use metric?



Magento 2.2 problem with .phtml overwriting using module


How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento2: How to rename the Details tab on the product details page, via overwriting layout file?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Problem with custom moduleMagento 2.2: Problem with varnish.vcl generatedMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsHelp with overwriting .phtml file in Magento 2.2.7






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to overwrite gallery.phtml block from single product page.
Magento 2 file catalog_product_view.xml



 <?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoCatalogBlockProductView" name="product.detail.info" as="product_detail_info" template="product/view/detail_layout.phtml" after="-" >
<block class="MagentoCatalogBlockProductViewGallery" name="product.info.media.image" template="Magento_Catalog::product/view/gallery.phtml"/>
</block>
</referenceContainer>
</body>
</page>


I want to replace gallery.phtml file.
Here's my two method:



1st - layout.xml method
catalog_product_view.xml



<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.media.image">
<arguments>
<argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
</arguments>
</referenceBlock>
</body>
</page>



2nd method - di.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogBlockProductView">
<plugin name="custom_widget_name" type="UNBXDProductAttributesPluginCatalogBlockProductViewGallery" />
</type>
</config>


Gallery.php



<?php
namespace UNBXDProductAttributesPluginCatalogBlockProductView;
class Gallery

public function after_construct(MagentoCatalogBlockProductView $result)


$result->setTemplate('UNBXD_ProductAttributes::catalog/product/view/gallery.phtml');
return $result;


?>


Nothing seems to work. I know this block in nested in another block. Is referenceBlock name 'product.info.media.image' correct in this case?










share|improve this question




























    0















    I want to overwrite gallery.phtml block from single product page.
    Magento 2 file catalog_product_view.xml



     <?xml version="1.0"?>
    <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceContainer name="content">
    <block class="MagentoCatalogBlockProductView" name="product.detail.info" as="product_detail_info" template="product/view/detail_layout.phtml" after="-" >
    <block class="MagentoCatalogBlockProductViewGallery" name="product.info.media.image" template="Magento_Catalog::product/view/gallery.phtml"/>
    </block>
    </referenceContainer>
    </body>
    </page>


    I want to replace gallery.phtml file.
    Here's my two method:



    1st - layout.xml method
    catalog_product_view.xml



    <?xml version="1.0"?>
    <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceBlock name="product.info.media.image">
    <arguments>
    <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
    </arguments>
    </referenceBlock>
    </body>
    </page>



    2nd method - di.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoCatalogBlockProductView">
    <plugin name="custom_widget_name" type="UNBXDProductAttributesPluginCatalogBlockProductViewGallery" />
    </type>
    </config>


    Gallery.php



    <?php
    namespace UNBXDProductAttributesPluginCatalogBlockProductView;
    class Gallery

    public function after_construct(MagentoCatalogBlockProductView $result)


    $result->setTemplate('UNBXD_ProductAttributes::catalog/product/view/gallery.phtml');
    return $result;


    ?>


    Nothing seems to work. I know this block in nested in another block. Is referenceBlock name 'product.info.media.image' correct in this case?










    share|improve this question
























      0












      0








      0








      I want to overwrite gallery.phtml block from single product page.
      Magento 2 file catalog_product_view.xml



       <?xml version="1.0"?>
      <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceContainer name="content">
      <block class="MagentoCatalogBlockProductView" name="product.detail.info" as="product_detail_info" template="product/view/detail_layout.phtml" after="-" >
      <block class="MagentoCatalogBlockProductViewGallery" name="product.info.media.image" template="Magento_Catalog::product/view/gallery.phtml"/>
      </block>
      </referenceContainer>
      </body>
      </page>


      I want to replace gallery.phtml file.
      Here's my two method:



      1st - layout.xml method
      catalog_product_view.xml



      <?xml version="1.0"?>
      <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceBlock name="product.info.media.image">
      <arguments>
      <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
      </arguments>
      </referenceBlock>
      </body>
      </page>



      2nd method - di.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <type name="MagentoCatalogBlockProductView">
      <plugin name="custom_widget_name" type="UNBXDProductAttributesPluginCatalogBlockProductViewGallery" />
      </type>
      </config>


      Gallery.php



      <?php
      namespace UNBXDProductAttributesPluginCatalogBlockProductView;
      class Gallery

      public function after_construct(MagentoCatalogBlockProductView $result)


      $result->setTemplate('UNBXD_ProductAttributes::catalog/product/view/gallery.phtml');
      return $result;


      ?>


      Nothing seems to work. I know this block in nested in another block. Is referenceBlock name 'product.info.media.image' correct in this case?










      share|improve this question














      I want to overwrite gallery.phtml block from single product page.
      Magento 2 file catalog_product_view.xml



       <?xml version="1.0"?>
      <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceContainer name="content">
      <block class="MagentoCatalogBlockProductView" name="product.detail.info" as="product_detail_info" template="product/view/detail_layout.phtml" after="-" >
      <block class="MagentoCatalogBlockProductViewGallery" name="product.info.media.image" template="Magento_Catalog::product/view/gallery.phtml"/>
      </block>
      </referenceContainer>
      </body>
      </page>


      I want to replace gallery.phtml file.
      Here's my two method:



      1st - layout.xml method
      catalog_product_view.xml



      <?xml version="1.0"?>
      <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceBlock name="product.info.media.image">
      <arguments>
      <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
      </arguments>
      </referenceBlock>
      </body>
      </page>



      2nd method - di.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <type name="MagentoCatalogBlockProductView">
      <plugin name="custom_widget_name" type="UNBXDProductAttributesPluginCatalogBlockProductViewGallery" />
      </type>
      </config>


      Gallery.php



      <?php
      namespace UNBXDProductAttributesPluginCatalogBlockProductView;
      class Gallery

      public function after_construct(MagentoCatalogBlockProductView $result)


      $result->setTemplate('UNBXD_ProductAttributes::catalog/product/view/gallery.phtml');
      return $result;


      ?>


      Nothing seems to work. I know this block in nested in another block. Is referenceBlock name 'product.info.media.image' correct in this case?







      magento2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 28 at 9:40









      AmigaAmiga

      113 bronze badges




      113 bronze badges




















          3 Answers
          3






          active

          oldest

          votes


















          0














          Try This :-



          <referenceBlock name="product.info.media.image">
          <action method="setTemplate">
          <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
          </action>
          </referenceBlock>





          share|improve this answer























          • Still nothing:/

            – Amiga
            Jun 28 at 10:05











          • check your file path and after code clean cache and then try

            – Rk Rathod
            Jun 28 at 10:08











          • path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

            – Amiga
            Jun 28 at 10:15


















          0














          If I add remove='true'



          <?xml version="1.0"?>
          <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
          <body>
          <referenceBlock name="product.info.media.image" remove="true">
          <action method="setTemplate">
          <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
          </action>
          </referenceBlock>
          </body>
          </page>


          image is removed so reference name is correct but new template isn't injected....






          share|improve this answer






























            0














            a busy cat



            path looks ok. All cache cleaned, recompilled files ect...






            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280042%2fmagento-2-2-problem-with-phtml-overwriting-using-module%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Try This :-



              <referenceBlock name="product.info.media.image">
              <action method="setTemplate">
              <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
              </action>
              </referenceBlock>





              share|improve this answer























              • Still nothing:/

                – Amiga
                Jun 28 at 10:05











              • check your file path and after code clean cache and then try

                – Rk Rathod
                Jun 28 at 10:08











              • path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

                – Amiga
                Jun 28 at 10:15















              0














              Try This :-



              <referenceBlock name="product.info.media.image">
              <action method="setTemplate">
              <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
              </action>
              </referenceBlock>





              share|improve this answer























              • Still nothing:/

                – Amiga
                Jun 28 at 10:05











              • check your file path and after code clean cache and then try

                – Rk Rathod
                Jun 28 at 10:08











              • path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

                – Amiga
                Jun 28 at 10:15













              0












              0








              0







              Try This :-



              <referenceBlock name="product.info.media.image">
              <action method="setTemplate">
              <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
              </action>
              </referenceBlock>





              share|improve this answer













              Try This :-



              <referenceBlock name="product.info.media.image">
              <action method="setTemplate">
              <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
              </action>
              </referenceBlock>






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jun 28 at 9:51









              Rk RathodRk Rathod

              2,5433 silver badges22 bronze badges




              2,5433 silver badges22 bronze badges












              • Still nothing:/

                – Amiga
                Jun 28 at 10:05











              • check your file path and after code clean cache and then try

                – Rk Rathod
                Jun 28 at 10:08











              • path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

                – Amiga
                Jun 28 at 10:15

















              • Still nothing:/

                – Amiga
                Jun 28 at 10:05











              • check your file path and after code clean cache and then try

                – Rk Rathod
                Jun 28 at 10:08











              • path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

                – Amiga
                Jun 28 at 10:15
















              Still nothing:/

              – Amiga
              Jun 28 at 10:05





              Still nothing:/

              – Amiga
              Jun 28 at 10:05













              check your file path and after code clean cache and then try

              – Rk Rathod
              Jun 28 at 10:08





              check your file path and after code clean cache and then try

              – Rk Rathod
              Jun 28 at 10:08













              path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

              – Amiga
              Jun 28 at 10:15





              path is correct /app/code/UNBXD/ProductAttributes/view/frontend/templates/catalog/product/view/gallery.phtml

              – Amiga
              Jun 28 at 10:15













              0














              If I add remove='true'



              <?xml version="1.0"?>
              <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
              <body>
              <referenceBlock name="product.info.media.image" remove="true">
              <action method="setTemplate">
              <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
              </action>
              </referenceBlock>
              </body>
              </page>


              image is removed so reference name is correct but new template isn't injected....






              share|improve this answer



























                0














                If I add remove='true'



                <?xml version="1.0"?>
                <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                <body>
                <referenceBlock name="product.info.media.image" remove="true">
                <action method="setTemplate">
                <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
                </action>
                </referenceBlock>
                </body>
                </page>


                image is removed so reference name is correct but new template isn't injected....






                share|improve this answer

























                  0












                  0








                  0







                  If I add remove='true'



                  <?xml version="1.0"?>
                  <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                  <body>
                  <referenceBlock name="product.info.media.image" remove="true">
                  <action method="setTemplate">
                  <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
                  </action>
                  </referenceBlock>
                  </body>
                  </page>


                  image is removed so reference name is correct but new template isn't injected....






                  share|improve this answer













                  If I add remove='true'



                  <?xml version="1.0"?>
                  <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                  <body>
                  <referenceBlock name="product.info.media.image" remove="true">
                  <action method="setTemplate">
                  <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
                  </action>
                  </referenceBlock>
                  </body>
                  </page>


                  image is removed so reference name is correct but new template isn't injected....







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 28 at 10:08









                  AmigaAmiga

                  113 bronze badges




                  113 bronze badges





















                      0














                      a busy cat



                      path looks ok. All cache cleaned, recompilled files ect...






                      share|improve this answer



























                        0














                        a busy cat



                        path looks ok. All cache cleaned, recompilled files ect...






                        share|improve this answer

























                          0












                          0








                          0







                          a busy cat



                          path looks ok. All cache cleaned, recompilled files ect...






                          share|improve this answer













                          a busy cat



                          path looks ok. All cache cleaned, recompilled files ect...







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 28 at 10:14









                          AmigaAmiga

                          113 bronze badges




                          113 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280042%2fmagento-2-2-problem-with-phtml-overwriting-using-module%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form