문제

So just to clarify an extension in app/code (or via composer) not a theme app/design which would need to be applied.

I've read https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-create.html

Reason I ask is because if you want to generate a layout that could be universal to different projects i.e. a subcategory view - so something that is independent of the chosen theme.

I've seen others approach with the use of category attributes e.g.

https://www.magebees.com/subcategory-listing-extension-for-magento-2.html

enter image description here

But that to me seems a workaround.

Can you add page layout via extension?

Not theme.

도움이 되었습니까?

해결책 2

Finally got round to working on a solution

I've created an extension to this

https://github.com/DominicWatts/Subcategory

Adding page layout via extension. Only changes within theme are covered in development docs (https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-create.html) and I've seen some creative solutions online to a relatively simple issue.

I've created a generic extension which can be used on multiple themes.

다른 팁

The answer is yes, and I think you have the answer of how to do it in the link you provided yourself from the devdocs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top