skip to Main Content

I want to override htdocsshopvendormagentomodule-catalogviewadminhtmltemplatescatalog.phtml

to

htdocsshopappdesignadminhtmlMagento_Catalogviewadminhtmltemplatescatalog.phtml

but i am not sure how to do this

2

Answers


  1. The Path should be

    htdocsshopappdesignfrontendtheme_Namespace theme_NameMagento_Catalogtemplatescatalog.phtml
    
    Login or Signup to reply.
  2. You need to create an admin theme and assign for the admin area

    so first, we will create new admin theme.

    Step1: Create a theme directory in the app/design/adminhtml/[Theme-Namespace]/[themename] and create theme.xml file. Put below code in theme.xml

    <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
        <title>Admin Custom Theme for Magento 2</title> <!-- your Custom theme's name -->
        <parent>Magento/backend</parent> <!-- it must be parent theme. Example: Magento/backend -->
    </theme>
    

    Step2: Create registration.php in appdesignadminhtml[Theme-Namespace][themename] and add following code

    <?php
        use MagentoFrameworkComponentComponentRegistrar;
        ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/[Theme-Namespace]/[themename]', __DIR__); 
    ?>
    

    Step3: Create folder Magento_Catalog in appdesignadminhtml[Theme-Namespace][themename]Magento_Catalog and

    Step4: Create folder template in appdesignadminhtml[Theme-Namespace][themename]Magento_Catalogtemplates and
    add this your file catalog.phtml

    Now we need to assign new theme to admin area

    Step1: Create a new module and create di.xml file app/code/Vendor/Module-Name/etc/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="MagentoThemeModelViewDesign">
                <arguments>
                    <argument name="themes" xsi:type="array">
                        <item name="adminhtml" xsi:type="string">[Theme-Namespace]/[themename]</item>
                    </argument>
                </arguments>
            </type>
        </config>
    

    Step2: Create module.xml

    <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
            <module name="Vendor _ Module-Name" setup_version="1.0.0"/>
        </config>
    

    Step3: Create registration.php file

    <?php
            MagentoFrameworkComponentComponentRegistrar::register(
                MagentoFrameworkComponentComponentRegistrar::MODULE,
                'Vendor _ Module-Name',
                __DIR__
            );
    

    Now run all command and check you changes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search