0

The problem is I have the vendor name capitalized, and then, don't know why the overrides don't work. Only when you want to change the template but still using default block. For example:

Override the catalog_product_view (single product page - the image)

Folders structure:

app\code\GST
└───Override
    │   registration.php
    │
    ├───etc
    │       module.xml
    │
    └───view
        └───frontend
            ├───layout
            │       catalog_product_view.xml
            │
            └───templates
                └───product
                    └───view
                            gallery.phtml

registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'GST_Override',
__DIR__
);

module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="GST_Override" setup_version="1.0.0"/>
</config>

catalog_product_view.xml

<?xml version="1.0"?>
<page 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" template="GST_Override::product/view/gallery.phtml"/>
    </body>
</page>

gallery.phtml

<p> test </p>

Expected result: No image shown and display 'test'

Actual result: Default magento view


What I've tried:

1) If I use remove attribute on layout:

<referenceBlock name="product.info.media.image" template="GST_Override::product/view/gallery.phtml" remove="true"/>

The image is removed.


2) If I use custom block on layout:

<referenceBlock class="GST\Override\Block\Product\View\Gallery" name="product.info.media.image" template="GST_Override::product/view/gallery.phtml" remove="true"/>

It works.


3) Definately, if I use a 'normal' vendor name like Test it works.


Is this a kind of bug? should I never use all capital leters to name vendor or module? Did I make a mistake? Can you reproduce this error or it's just me?

0

Capitalizing vendor name is not a problem. But for our own convenience we will be using first letter as capital.

  • Yep, but now I have made enough modules with this namespacing. And the thing is, I have some overrides like this that aren't working, I'd need to create another vendor or something else bc I cannot solve this. – slayerbleast Dec 13 '16 at 15:40
0

Looks like the problem not in module name and in module load sequence.

Try add to module.xml

    <sequence>
        <module name="Magento_Catalog"/>
        <module name="Magento_ProductVideo"/>
    </sequence>
  • Tried, doesn't work. – slayerbleast Dec 15 '16 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.