How can i add block to existing layout in catalog_category_view.xml?How can i rewrite TierPrice Block in Magento2In block getModel error?How to extend layout in Custom moduleMagento 2: How to move category description to main columnMagento2 Fatal error on Cart PageHow to add CMS directive block on custom module field in Magento 2Why is my Magento Catalog Block Preference ignored in di.xml?How to add custom content to block layout render by jslayoutGENERATE THIS REPORT: main.INFO: Cache file with merged layout: LAYOUT_adminhtml_STORE1_Problem in overriding ListProduct on search results
Should an arbiter claim draw at a K+R vs K+R endgame?
Cycle through MeshStyle directives in ListLinePlot
How did old MS-DOS games utilize various graphic cards?
How Often Do Health Insurance Providers Drop Coverage?
Why VGA framebuffer was limited to 64kB window?
Why didn't Voldemort recognize that Dumbledore was affected by his curse?
Is counterpoint still used today?
Preventing employees from either switching to competitors or opening their own business
Pre-1972 sci-fi short story or novel: alien(?) tunnel where people try new moves and get destroyed if they're not the correct ones
Determining fair price for profitable mobile app business
Can U.S. Tax Forms Be Legally HTMLified?
Does Disney no longer produce hand-drawn cartoon films?
What do abbreviations in movie scripts stand for?
How to forge a multi-part weapon?
Recommended tools for graphs and charts
Is using haveibeenpwned to validate password strength rational?
How can I get an unreasonable manager to approve time off?
Fixing obscure 8080 emulator bug?
C++ Arduino IDE receiving garbled `char` from function
Would the US government be able to hold control if all electronics were disabled for an indefinite amount of time?
Using "subway" as name for London Underground?
Passing multiple files through stdin (over ssh)
How do I determine which Internet Explorer version is newer based on the versioning information dialog?
How to deal with apathetic co-worker?
How can i add block to existing layout in catalog_category_view.xml?
How can i rewrite TierPrice Block in Magento2In block getModel error?How to extend layout in Custom moduleMagento 2: How to move category description to main columnMagento2 Fatal error on Cart PageHow to add CMS directive block on custom module field in Magento 2Why is my Magento Catalog Block Preference ignored in di.xml?How to add custom content to block layout render by jslayoutGENERATE THIS REPORT: main.INFO: Cache file with merged layout: LAYOUT_adminhtml_STORE1_Problem in overriding ListProduct on search results
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want change layout of catalaog_category_view.xml but i can't. I override block category.products and it's work but how can i add my own block to existing category.products block? Because i want add my own element above of category.products element. I was trying add block and move element, add to referenceContainer content and move before category.products and nothing happened. Still the same page exists. Can you help me how can i add block inside category.products or above category.products.
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
<container name="category.product.list.additional" as="additional" />
<block class="MagentoFrameworkViewElementRendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="MagentoFrameworkViewElementTemplate" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="MagentoCatalogBlockProductProductListItemContainer" name="category.product.addto" as="addto">
<block class="MagentoCatalogBlockProductProductListItemAddToCompare"
name="category.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
<block class="MagentoCatalogBlockProductProductListToolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="MagentoThemeBlockHtmlPager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
</block>
This is block category.products from Magento_Catalog. I want add my block above this one:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
Or:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml"><!-- Before category.products.list -->
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
Anyone can help me? I will be really grateful!
magento2 module layout magento-2.2.5 development
|
show 8 more comments
I want change layout of catalaog_category_view.xml but i can't. I override block category.products and it's work but how can i add my own block to existing category.products block? Because i want add my own element above of category.products element. I was trying add block and move element, add to referenceContainer content and move before category.products and nothing happened. Still the same page exists. Can you help me how can i add block inside category.products or above category.products.
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
<container name="category.product.list.additional" as="additional" />
<block class="MagentoFrameworkViewElementRendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="MagentoFrameworkViewElementTemplate" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="MagentoCatalogBlockProductProductListItemContainer" name="category.product.addto" as="addto">
<block class="MagentoCatalogBlockProductProductListItemAddToCompare"
name="category.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
<block class="MagentoCatalogBlockProductProductListToolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="MagentoThemeBlockHtmlPager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
</block>
This is block category.products from Magento_Catalog. I want add my block above this one:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
Or:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml"><!-- Before category.products.list -->
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
Anyone can help me? I will be really grateful!
magento2 module layout magento-2.2.5 development
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?
– FocuSsmok
May 30 at 12:53
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
I solved this problem with your tips :)<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07
|
show 8 more comments
I want change layout of catalaog_category_view.xml but i can't. I override block category.products and it's work but how can i add my own block to existing category.products block? Because i want add my own element above of category.products element. I was trying add block and move element, add to referenceContainer content and move before category.products and nothing happened. Still the same page exists. Can you help me how can i add block inside category.products or above category.products.
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
<container name="category.product.list.additional" as="additional" />
<block class="MagentoFrameworkViewElementRendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="MagentoFrameworkViewElementTemplate" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="MagentoCatalogBlockProductProductListItemContainer" name="category.product.addto" as="addto">
<block class="MagentoCatalogBlockProductProductListItemAddToCompare"
name="category.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
<block class="MagentoCatalogBlockProductProductListToolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="MagentoThemeBlockHtmlPager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
</block>
This is block category.products from Magento_Catalog. I want add my block above this one:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
Or:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml"><!-- Before category.products.list -->
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
Anyone can help me? I will be really grateful!
magento2 module layout magento-2.2.5 development
I want change layout of catalaog_category_view.xml but i can't. I override block category.products and it's work but how can i add my own block to existing category.products block? Because i want add my own element above of category.products element. I was trying add block and move element, add to referenceContainer content and move before category.products and nothing happened. Still the same page exists. Can you help me how can i add block inside category.products or above category.products.
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
<container name="category.product.list.additional" as="additional" />
<block class="MagentoFrameworkViewElementRendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="MagentoFrameworkViewElementTemplate" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="MagentoCatalogBlockProductProductListItemContainer" name="category.product.addto" as="addto">
<block class="MagentoCatalogBlockProductProductListItemAddToCompare"
name="category.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
<block class="MagentoCatalogBlockProductProductListToolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="MagentoThemeBlockHtmlPager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
</block>
This is block category.products from Magento_Catalog. I want add my block above this one:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml">
Or:
<block class="MagentoCatalogBlockCategoryView" name="category.products" template="Magento_Catalog::category/products.phtml"><!-- Before category.products.list -->
<block class="MagentoCatalogBlockProductListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
Anyone can help me? I will be really grateful!
magento2 module layout magento-2.2.5 development
magento2 module layout magento-2.2.5 development
asked May 30 at 12:33
FocuSsmokFocuSsmok
34
34
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?
– FocuSsmok
May 30 at 12:53
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
I solved this problem with your tips :)<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07
|
show 8 more comments
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?
– FocuSsmok
May 30 at 12:53
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
I solved this problem with your tips :)<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?– FocuSsmok
May 30 at 12:53
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?– FocuSsmok
May 30 at 12:53
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
I solved this problem with your tips :)
<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
I solved this problem with your tips :)
<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07
|
show 8 more comments
1 Answer
1
active
oldest
votes
You need to use <move>
element in following way:
<move element="yourblock" destination="content" before="category.products" />
Hope may helpful to anyone.
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%2f276735%2fhow-can-i-add-block-to-existing-layout-in-catalog-category-view-xml%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to use <move>
element in following way:
<move element="yourblock" destination="content" before="category.products" />
Hope may helpful to anyone.
add a comment |
You need to use <move>
element in following way:
<move element="yourblock" destination="content" before="category.products" />
Hope may helpful to anyone.
add a comment |
You need to use <move>
element in following way:
<move element="yourblock" destination="content" before="category.products" />
Hope may helpful to anyone.
You need to use <move>
element in following way:
<move element="yourblock" destination="content" before="category.products" />
Hope may helpful to anyone.
answered May 30 at 13:09
Dhara BhattiDhara Bhatti
431112
431112
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.
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%2f276735%2fhow-can-i-add-block-to-existing-layout-in-catalog-category-view-xml%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
Have you tried with this? <move element="yourblock" destination="content" before="category.products" />
– Dhara Bhatti
May 30 at 12:41
<referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">MGS_Landing::category/products.phtml</argument> </action> </referenceBlock>
- This code override standard category.products. I'm beginner developer of magento2. Where i must create additional block which will show above category.products? Inside referenceBlock or somewhere else?– FocuSsmok
May 30 at 12:53
Do you want to replace default magento's layout of category.products block or want to create a new block before category.products block?
– Dhara Bhatti
May 30 at 13:00
I solved this problem with your tips :)
<block class="ModuleOwnLandingBlockLanding" name="landingown" template="ModuleOwn::category/landing/grid.phtml"/> <referenceBlock name="category.products"> <action method="setTemplate"> <argument name="template" xsi:type="string">ModuleOwn::category/products1.phtml</argument> </action> </referenceBlock> <move element="landingown" destination="content" before="category.products" />
– FocuSsmok
May 30 at 13:05
Great :) I'm posting my answer, may be it may helpful to anyone else.
– Dhara Bhatti
May 30 at 13:07