Is it possible to make theme default.xml file store specific? - magento2.2

This is my code for adding top header links in magento 2.2.2 but as i am having multiple store's it is showing in all web site's top header but my requirement is to add this link in my default store top header...not in all the multi-store web-site's header
<referenceBlock name="header.links">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="wholesale">
<arguments>
<argument name="label" xsi:type="string">New Link</argument>
<argument name="path" xsi:type="string">New Link</argument>
</arguments>
</block>
</referenceBlock>

Related

Magento 2 MageSpecialist reCAPTCHA Module display on cms page

I've installed the MageSpecialist reCAPTCHA module on my Magento 2 webshop.
The module is working perfectly fine on the default contact form, but the reCAPTCHA is not rendered on the custom cms page.
This is how I display the contact form on the custom cms page:
{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}
I tried to add a code snippet from the layout section of the module contact_index_index to the cms page Layout Update XML.
<referenceContainer name="form.additional.info">
<block class="MSP\ReCaptcha\Block\Frontend\ReCaptcha" name="msp-recaptcha" after="-" template="MSP_ReCaptcha::msp_recaptcha.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="msp-recaptcha" xsi:type="array">
<item name="component" xsi:type="string">MSP_ReCaptcha/js/reCaptcha</item>
<item name="zone" xsi:type="string">contact</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
This also did not help with trying to render the reCAPTCHA on the custom cms page.
Is there anyone who can help me out with this?
With the below code I was able to add Contact Us form in a CMS page along with the MSP reCaptcha on the form, Add the below code in Admin > Content > Pages > [CMS Page] > Add / Edit > Design > Layout Update XML:
<referenceContainer name="content">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
<referenceContainer name="form.additional.info">
<block class="MSP\ReCaptcha\Block\Frontend\ReCaptcha" name="msp-recaptcha" after="-"
template="MSP_ReCaptcha::msp_recaptcha.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="msp-recaptcha" xsi:type="array">
<item name="component" xsi:type="string">MSP_ReCaptcha/js/reCaptcha</item>
<item name="zone" xsi:type="string">contact</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>

How to have different logos for different themes in magento 2.1

I have a site that uses different themes for different categories.
I need to have a different logo for each theme, but in 'content > design > configuration' there is only the option to use a logo for a store front.
So the new uploaded logo is used across all themes.
Any ideas how I can use a specific image logo for each theme?
Please find the following code to manage logo's to different theme's-
To declare a theme logo, add an extending <theme_dir>/Magento_Theme/layout/default.xml layout.
For example, if your logo file is my_logo.png sized 300x300px, you need to declare it as follows:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="logo">
<arguments>
<argument name="logo_file" xsi:type="string">images/my_logo.png</argument>
<argument name="logo_img_width" xsi:type="number">300</argument>
<argument name="logo_img_height" xsi:type="number">300</argument>
</arguments>
</referenceBlock>
</body>
</page>
Declaring the logo size is optional.
To learn more about theme layouts, refer to url : http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

How to remove or hide breadcrumbs for a particular page in magento

I am trying to hide the (Home > Catalog Advanced Search > Results) breadcrumbs alone in magento during the advanced search results. I don't want to navigate through the breadcrumbs in result page. Anybody help me to make this possible.
Try using
<remove name="breadcrumbs" />
Within specific handle of your layout xml file.
For example
<catalog_category_default>
<remove name="breadcrumbs" />
</catalog_category_default>
Or try using that within the cms page layout form in backend under CMS->Pages.
You can do by the admin:
CMS-> Pages:
Page Information
Design:
Custom Design
Custom Layout Update XML: <remove name="breadcrumbs" />
Magento 2 Code to remove breadcrumbs for CMS Page
<referenceContainer name="page.top">
<referenceBlock name="breadcrumbs" remove="true" />
</referenceContainer>
You can remove breadcrumbs in various ways in Magento.
For example if you want remove from a specific action like (Home > Catalog Advanced Search > Results) you just update catalogsearch_advanced_result in catalogsearch.xml file from your theme with:
<catalogsearch_advanced_result translate="label">
<remove name="breadcrumbs" />
</catalogsearch_advanced_result>
If you want to remove from all dynamic pages add this
<default>
<remove name="breadcrumbs" />
</default>
If you want to remove from a CMS page, you just configure from admin panel. Go to
system->configuration and then web->Show Breadcrumbs for CMS Pages.
Refresh your cache and check.
For Magento 2.1
Goto Admin->Store->General->Web->Default Pages->Show Breadcrumbs for CMS Pages
Select Option No for breadcrumbs
For Magento2 Remove from specific CMS page. Add following on Design >>Layout section of you CMS page
<referenceContainer name="page.top">
<referenceBlock name="breadcrumbs" remove="true"/>
</referenceContainer>
Edit catalogsearch.xml in /app/design/frontend/base/default/layout/
Add <remove name="breadcrumbs" /> within
<catalogsearch_advanced_result translate="label">
<label>Advanced Search Result</label>
<update handle="page_two_columns_right" />
<remove name="breadcrumbs" />
</catalogsearch_advanced_result>
Refresh and check... Breadcrumbs will be removed in advanced search result alone.
In layout update xml, per cms page:
<reference name="root">
<remove name="breadcrumbs"/>
</reference>

Google Analytics Stopped Working after Ungradation to Magento 1.7

Google Analytics stopped working as i upgrade the Magento 1.6 to Magento 1.7.
Really Stuck what to do, i have already
reference name="after_body_start">
<block type="googleanalytics/ga" name="google_analytics" as="google_analytics" template="googleanalytics/ga.phtml" />
</reference>
in my googleanalytics.xml
Not able to set it properly for Magento 1.7.
Add a tag template="googleanalytics/ga.phtml" in the layout/googleanalytics.xml
<layout version="0.1.0">
<!--
Default layout, loads most of the pages
-->
<default>
<!-- Mage_GoogleAnalytics -->
<reference name="after_body_start">
<block type="googleanalytics/ga"
name="google_analytics"
as="google_analytics"
template="googleanalytics/ga.phtml" />
</reference>
</default>
</layout>

addItem only to Magento cms_page via local.xml can't use theme?

Magento doesn't want to look in my theme folder for these JS files when I use this code in local.xml
<!-- /app/design/frontend/my-theme/default/layout/local.xml -->
<xml>
<cms_page>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>my.js</name><params/></action>
</reference>
</cms_page>
</xml>
This results in
<head>
<script src="http://example.com/skin/frontend/base/default/my.js" />
</head>
whereas if I where to put the same XML code within the "default" xml tag it loads correctly. i.e....
<!-- /app/design/frontend/my-theme/default/layout/local.xml -->
<xml>
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>my.js</name><params/></action>
</reference>
</default>
</xml>
loads...
<head>
<script src="http://example.com/skin/frontend/MYTHEME/default/my.js" />
</head>
<!-- Emphasis Added -->
The problem is that I only want to load this script for cms_pages. Is this impossible?
Using Magento 1.6 ~ The and yes, I've cleared the cache ;)
Oh, and my design configuration ( admin > configuration > design ) has "package" set to "my-theme", and the "default" set to "default"
The reason it ends up using the wrong URL when loading CMS pages is likely that you have a custom theme set on that CMS page.
The custom theme you define on a per-page level overrides the normal theme when the CMS page is rendered.
Check your CMS page settings under the custom design section.

Resources