- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018
06:56 AM
11-22-2018
06:56 AM
How to override plugin template via XML?
Hey,
I downloaded MageFan Awesome Blog plugin for Magento 2.2 and I want to override a template file.
I've added my own plugin to try and do this:
app/code/Company/BlogOverride
I have this file tree:
|-etc |-----module.xml |-registration.php |-view |-----frontend |---------layout |-------------catalog_product_view.xml |---------templates |-------------catalog |-----------------product |---------------------relatedposts.phtml
the contents of my catalog_product_view.xml file:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <referenceBlock name="content.aside"> <action method="setTemplate"> <argument name="template" xsi:type="string">Company_BlogOverride::catalog/product/relatedposts.phtml</argument> </action> </referenceBlock> </page>
I then run:
$ php bin/magento setup:upgrade $ php bin/magento setup:di:compile $ php bin/magento setup:static-content:deploy -f $ php bin/magento cache:flush
but it still uses the default plugin template. How do I override it? I've raised an issue on Magento SE too: https://magento.stackexchange.com/questions/250857/how-do-i-override-plugin-phtml-file-added-by-xml
Thanks
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018
09:43 PM
11-22-2018
09:43 PM
Re: How to override plugin template via XML?
Please show your
catalog_product_view.xml
Xml code of module to check in more details.
Or You can override templates file at theme level without create module.
app/design/frontend/{Packagename}/{themename}/Magefan_Blog/templates/catalog/product/relatedpost.phtml
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial
Magento 2 Blogs/Tutorial