1

Our designer works in our own custom layout, located in:

/app/design/frontend/Vendor/Namespace

There we modify the default layout Magento_LayeredNavigation::view.phtml

Now we want to add a custom block to this file:

$block->something();

inside the structure of filter.phtml

We wrote a custom module (app/code/vendor/namespace) with a block and we add this information in:

app/code/vendor/namespace/view/frontend/layout/catalog_category_layered.xml
app/code/vendor/namespace/view/frontend/layout/catalog_category_view.xml

Now our question:

Is it correct that we add this new block in the custom design structure of view.phtml? - Or do we have to move the whole file (view.phtml) into the custom module ( which is bad for the designers .. cause the layout infos are mixed in several modules then! )

1 Answer 1

1

You have to move your filter.phtml file into your custom module. This way is good for you. Because you have already create new module for your custom file template.This is the proper way to use magento specific way because in future if you remove your extra changes from filter file at that time you have to just disable or remove that module and your functionality is close and default functionality is working.

If you want to change inside theme filter.phtml file this is mot create any problem for you but you have create already module then use inside module tempate file is best way.

13
  • Hi .. i dont know if i understand your answer. When i move the whole phtml into my custom module than the designers have to add the layout changes there .. i think this is not a good way. I hoped thar a can leave the phtml in the design folder and use xml to place the new block and adress it in the layout folder. Aug 27, 2016 at 9:37
  • You have to ask your designer for that, files comes from this module, This is proper way but you can use customize inside your theme also Aug 27, 2016 at 9:39
  • You have to think site performance level not for your designer and designer can also design inside module file. Most of extension are follow this way not doing inside theme. Aug 27, 2016 at 9:40
  • Plz let me know if any issues. Aug 27, 2016 at 9:50
  • Ok, i now move the view.phtml to my custom module and add a static content .. works fine. A also add a new Block to the structure (without a template) .. i only want to return a value! Aug 27, 2016 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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