Load custom block in category list page magento2
I am trying to add custom template file in category list page.
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_category_view.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Magento_Catalog::product/myCustomFile.phtml" />
</referenceContainer>
This is loading the template in list page.
But i need to load it from my custom module.
I used below code to implement it.
app/code/Vendor/Module/view/frontend/layout/module_index_index.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" />
</referenceContainer>
This is not loading my template in category list page. After using layout update also.
Can anyone help me on this please
magento2 layout category-listing
|
show 6 more comments
I am trying to add custom template file in category list page.
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_category_view.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Magento_Catalog::product/myCustomFile.phtml" />
</referenceContainer>
This is loading the template in list page.
But i need to load it from my custom module.
I used below code to implement it.
app/code/Vendor/Module/view/frontend/layout/module_index_index.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" />
</referenceContainer>
This is not loading my template in category list page. After using layout update also.
Can anyone help me on this please
magento2 layout category-listing
Can you try to add it atapp/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?
– amitshree
Dec 31 '18 at 10:23
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53
|
show 6 more comments
I am trying to add custom template file in category list page.
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_category_view.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Magento_Catalog::product/myCustomFile.phtml" />
</referenceContainer>
This is loading the template in list page.
But i need to load it from my custom module.
I used below code to implement it.
app/code/Vendor/Module/view/frontend/layout/module_index_index.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" />
</referenceContainer>
This is not loading my template in category list page. After using layout update also.
Can anyone help me on this please
magento2 layout category-listing
I am trying to add custom template file in category list page.
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_category_view.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Magento_Catalog::product/myCustomFile.phtml" />
</referenceContainer>
This is loading the template in list page.
But i need to load it from my custom module.
I used below code to implement it.
app/code/Vendor/Module/view/frontend/layout/module_index_index.xml
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" />
</referenceContainer>
This is not loading my template in category list page. After using layout update also.
Can anyone help me on this please
magento2 layout category-listing
magento2 layout category-listing
asked Dec 31 '18 at 10:06
jafar pinjar
618412
618412
Can you try to add it atapp/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?
– amitshree
Dec 31 '18 at 10:23
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53
|
show 6 more comments
Can you try to add it atapp/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?
– amitshree
Dec 31 '18 at 10:23
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53
Can you try to add it at
app/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?– amitshree
Dec 31 '18 at 10:23
Can you try to add it at
app/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?– amitshree
Dec 31 '18 at 10:23
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53
|
show 6 more comments
2 Answers
2
active
oldest
votes
create catalog_category_view.xml in your layout folder
app/code/Vendor/Module/view/frontend/layout/catalog_category_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">
<head>
<css src="Addify_ProductSold::css/sales_style.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" before="-" />
</referenceBlock>
</body>
</page>
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
add a comment |
You need to add code like below.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_ModuleName::product/myCustomFile.phtml" />
</referenceContainer>
</body>
</page>
Thanks
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256243%2fload-custom-block-in-category-list-page-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
create catalog_category_view.xml in your layout folder
app/code/Vendor/Module/view/frontend/layout/catalog_category_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">
<head>
<css src="Addify_ProductSold::css/sales_style.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" before="-" />
</referenceBlock>
</body>
</page>
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
add a comment |
create catalog_category_view.xml in your layout folder
app/code/Vendor/Module/view/frontend/layout/catalog_category_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">
<head>
<css src="Addify_ProductSold::css/sales_style.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" before="-" />
</referenceBlock>
</body>
</page>
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
add a comment |
create catalog_category_view.xml in your layout folder
app/code/Vendor/Module/view/frontend/layout/catalog_category_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">
<head>
<css src="Addify_ProductSold::css/sales_style.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" before="-" />
</referenceBlock>
</body>
</page>
create catalog_category_view.xml in your layout folder
app/code/Vendor/Module/view/frontend/layout/catalog_category_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">
<head>
<css src="Addify_ProductSold::css/sales_style.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_Module::product/myCustomFile.phtml" before="-" />
</referenceBlock>
</body>
</page>
answered Dec 31 '18 at 11:58
Addify
6845
6845
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
add a comment |
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
it worked thanks
– jafar pinjar
Dec 31 '18 at 12:13
add a comment |
You need to add code like below.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_ModuleName::product/myCustomFile.phtml" />
</referenceContainer>
</body>
</page>
Thanks
New contributor
add a comment |
You need to add code like below.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_ModuleName::product/myCustomFile.phtml" />
</referenceContainer>
</body>
</page>
Thanks
New contributor
add a comment |
You need to add code like below.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_ModuleName::product/myCustomFile.phtml" />
</referenceContainer>
</body>
</page>
Thanks
New contributor
You need to add code like below.
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="custom.block" template="Vendor_ModuleName::product/myCustomFile.phtml" />
</referenceContainer>
</body>
</page>
Thanks
New contributor
edited Dec 31 '18 at 10:53
Ashish Viradiya
452219
452219
New contributor
answered Dec 31 '18 at 10:47
Sanket Kulkarni
312
312
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256243%2fload-custom-block-in-category-list-page-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you try to add it at
app/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml
?– amitshree
Dec 31 '18 at 10:23
@amitshree, yes i need to add custom block in category page. yes tried it, that didn't work
– jafar pinjar
Dec 31 '18 at 10:36
This should work. Check here magento.stackexchange.com/a/181719/9169
– amitshree
Dec 31 '18 at 10:40
@amitshree, yes now it worked, thanks, the content of that phtml is like below, can we implement it there, magento.stackexchange.com/questions/256230/…
– jafar pinjar
Dec 31 '18 at 10:49
Yes you can do that with some customisation. You need to call current category and sub-categories and render them as per your need.
– amitshree
Dec 31 '18 at 10:53