Hello,
I have a custom design .. this is running fine, but I need to made some modifications and has to learn about Layout.
Example: There is a "breadcrump" on top of the site ... I want display this just on 1 site.
How can I remove this? Where is this information stored?
In my theme I have unter Magento_Theme:
layout => default.xml, default_head_blocks.xml page_layout => 1column.xml, 2columns-left.xml, 2columns-right.xml, 3columns.xml templates => around 10 .phtml files
Thank you!
Solved! Go to Solution.
@hanhoe
If you want to remove from CMS pages, then you can follow below link:
https://www.simicart.com/blog/magento-show-breadcrumbs-cms-pages/
or not for cms page.
In your case you can add if condition in breadcrumb.phtml based on website id or store id,
for best approach override the breadcrumb file in your theme if not exist.
vendor/magento/module-theme/view/frontend/templates/html/breadcrumbs.phtml
To get website code and store code:
$url = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $url->get('\Magento\Store\Model\StoreManagerInterface'); $state = $objectManager->get('\Magento\Framework\App\State'); // Get Website ID $websiteId = $storeManager->getWebsite()->getWebsiteId(); //echo 'websiteId: '.$websiteId.” “; // Get Store ID $store = $storeManager->getStore(); $storeId = $store->getStoreId();
Hi @hanhoe
Put the following line in your theme "default.xml" if you need to remove from complete website.
<referenceBlock name="breadcrumbs" remove="true" />
otherwise you can add into specific xml files. for example: catalog_category_view.xml
for example: I have changed Magento_Theme/layout/default.xml file.
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="header.panel"> <block class="Magento\Framework\View\Element\Html\Links" name="header.links"> <arguments> <argument name="css_class" xsi:type="string">header links</argument> </arguments> </block> <referenceBlock name="breadcrumbs" remove="true" /> </referenceContainer> <referenceBlock name="logo"> <arguments> <argument name="logo_img_width" xsi:type="number">148</argument> <argument name="logo_img_height" xsi:type="number">43</argument> </arguments> </referenceBlock> <referenceContainer name="footer"> <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/> </referenceContainer> <referenceBlock name="report.bugs" remove="true"/> <move element="copyright" destination="before.body.end"/> </body> </page>
I hope it will help you!
Thank you ... guess I understand, but unfortunately I want to remove from home site ... when this is the default.xml then I can´t display it on other sites?
For example:
Add in default.xml
<referenceBlock name="breadcrumbs" remove="true" />
But add in catalog_category_view.xml:
<referenceBlock name="breadcrumbs" remove="false" />
is not working?
Or is the home site not the default.xml?
@hanhoe
are you using same theme for all the websites? If you are using different theme then you need to edit default.xml for the theme of the website.
home site means magento website right, not home page?
Hi @Vimal Kumar
yes, one theme for all sites.
"home site" I mean the landing page when you open "https://company.com" ... so magento root site.
So when I hide in default.xml I can´t display in another site of the same template?
@hanhoe
one question: do you want to remove from homepage only from the magento root website or from all pages of the website?
So when I hide in default.xml I can´t display in another site of the same template?
VP: yes, if we are using same template then default.xml will not work for the single website.
Hi @Vimal Kumar
I have 6-7 pages, which has nothing do to with the shop.
And when I display the shop site, he should also display the breadcrumps
@hanhoe
If you want to remove from CMS pages, then you can follow below link:
https://www.simicart.com/blog/magento-show-breadcrumbs-cms-pages/
or not for cms page.
In your case you can add if condition in breadcrumb.phtml based on website id or store id,
for best approach override the breadcrumb file in your theme if not exist.
vendor/magento/module-theme/view/frontend/templates/html/breadcrumbs.phtml
To get website code and store code:
$url = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $url->get('\Magento\Store\Model\StoreManagerInterface'); $state = $objectManager->get('\Magento\Framework\App\State'); // Get Website ID $websiteId = $storeManager->getWebsite()->getWebsiteId(); //echo 'websiteId: '.$websiteId.” “; // Get Store ID $store = $storeManager->getStore(); $storeId = $store->getStoreId();
need some days to check :-)
Thank you!