Magento 2 custom theme doesn't work on "home" - magento2

I have started to write a custom theme for Magento 2 on basis of the luma theme. I am now facing the problem, that my custom theme applies to all pages BUT the "home" page. The Luma theme is still active there and is not overwritten by my custom theme.
I set the custom theme as default theme and it is applied on every store / view
I have no idea what to do. Does anyone have a solution or faced the same problem?
This is my default.xml:
<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/unfair-athl-black.png</argument>
<argument name="logo_img_width" xsi:type="number">200</argument>
<argument name="logo_img_height" xsi:type="number">100</argument>
</arguments>
</referenceBlock>
<referenceBlock name="copyright" remove="true" />
</body>
</page>

Check if config is overriding your theme.
Check if your Home / Start Page has a Design Update at the bottom of the config page in Content -> Pages -> YourHomePage. (for all Store Views)
Check if your Home / Start Page has a layout that is represented in your theme (1 column, 2 column, etc.) (for all Store Views)
Manually remove all generated and static content via command rm -rf magentoroot/var/cache/* magentoroot/var/page_cache/* magentoroot/var/view_preprocessed/* magentoroot/generated/* magentoroot/pub/static/*
and re-deploy after
Make sure you include default_head_blocks.xml in the default.xml of your theme

Related

Magento 2 Critical CSS file position

Is there a way to include inline styles after the <title> tag as shown on this image:
If I edit the file default_head_blocks.xml I can only get this to show after the merged css file which defeats the purpose of using critical-css. One possible way is to add this bit of code into default.xml but then the inline css is rendered right at the top of <head> before all the <meta> tags so I'm not sure if this is bad practice or not
<referenceBlock name="require.js">
<action method="setTemplate">
<argument name="template" xsi:type="string">Magento_Theme::/header/inline-css.phtml</argument>
</action>
</referenceBlock>
Since Magento 2.3 (or 2.2?) Magento has an option for Critical Css, here is the doc
In your (custom) theme you can define web/css/critical.css and then enable using critical css.
bin/magento config:set dev/css/use_css_critical_path 1
This css file will be injected as inline style into the head and the rest of styles will be loaded asynchronously.
AFAIK, placing the critical css in any position inside the head will do the job. The point is to load the other styles asynchronously. Otherwise the browser will still wait till all css files are loaded before loading the contents (body tag).
Please refer to this and this

How to add layered navigation on brand page - Magento 2

I have used extension(Solwin_Ourbrand) for Shop by brand page.
http://inheritxdev.net/solen_magento/brands.html
On brand page I need layered navigation of that custom product collection.
See brand page : http://inheritxdev.net/solen_magento/brand/accuton.html
I had tried by changing the xml file of that extension by adding the below code.
<referenceContainer name="sidebar.main">
<block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml">
<block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" />
<block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
</block>
</referenceContainer>
But I get the filter options as per root category.
Can anyone help me to achieve this functionality for custom brand page?

Eclipse intro/welcome page definition with content attribute does not find the file

In my plugin/RCP I have defined my own contributions to Eclipse universal intro with page definitions inside the toplevel xml (the one pointed to by the "config" attribute to the "configExtension" element of the org.eclipse.ui.intro.configExtension extension point), which works.
However, I'd like to split out the page definitions to separate files for simpler editing and managing.
So I start out with (in my intro/introcontent.xml):
<page id="myfirststeps" style="$theme$/html/firststeps.css" style-id="page">
<!-- Page content here -->
</page>
And this works. The intro displays the page content correctly. Then I move the page content to firststeps.xml:
<?xml version="1.0" encoding="utf-8" ?>
<introContent>
<page id="myfirststeps" style="$theme$/html/firststeps.css" style-id="page">
<!-- Page content here -->
</page>
</introcontent>
and change the toplevel xml to say:
<page id="myfirststeps" content="intro/firststeps.xml" />
does not work. Running this creates a "File not found" exception, and the file indicated is pointing into the Eclipse installation (like "C:\Program Files\Eclipse") and not, as I would have expected into my plugin. And sure enough, if I copy my xml-file there it finds it.
Any pointers? Is there some trick about the content attribute and how it resolves the path to the file?
Or is there a way to specify a path to the plugin directory in the content attribute?
I'm using Eclipse 3.7.
Turned out that the solution was simple. The file reference in the content attribute is relative to the referencing xml-file, not relative to the plugin-root.
So all I had to do was to remove the "intro"-part of the path. From
<page id="myfirststeps" content="intro/firststeps.xml" />
to
<page id="myfirststeps" content="firststeps.xml" />
And all is well.

Magento advanced search form in sidebar

I'm using Magento 1.5.0.1 and I want to move my advanced search form to the sidebar for my 2columns-left template.
What I've tried was this:
<reference name="left">
<block type="catalogsearch/advanced_form" name="catalogsearch_advanced_form" template="catalogsearch/advanced/form.phtml"/>
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
</reference>
But unfortunately it doesnt show up.
When i browse to mywebsite/catalogsearch/advanced/ the form shows up in the sidebar so that goes well.
How can i change it so it always shows up in the sidebar?
Thanks in advance!
What happens if you insert into your template:
<?php echo $this->getLayout()->createBlock('catalogsearch/advanced_form')->setTemplate('catalogsearch/advanced/form.phtml')->toHtml() ?>
Also pay attention that .js files are loaded for calendar.

Android - Customizing the Spinner widget Look and Feel

Is it possible to change the color of the radio button in the Android spinner widget. By default it displays the green color for the radio button.
I need to change it to some other color, is it possible, and how?
I know this is an old question now, but here goes...
You will need to create a custom Theme and apply it to the Activity with your spinner.
First, you need to create images for the checked/unchecked states of the 'new' radio, you could just pull the given images btn_radio_on.png and btn_radio_off.png from the sdk's res/drawable-* folder(s). Edit them to look how you want (such as changing color or whatever) and save off to your project.
Next, create a new xml file in your res/values folder, and add the following:
<resources>
<style name="CustomSpinnerRadioTheme" parent="#android:style/Theme">
<item name="android:spinnerDropDownItemStyle">#style/EditedRadio</item>
</style>
<style name="EditedRadio" parent="#android:style/Widget.DropDownItem.Spinner">
<item name="android:checkMark">#drawable/edited_radio</item>
</style>
</resources>
Then, create another xml file in res/drawable named edited_radio.xml, and it should contain the following:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:drawable="#drawable/btn_radio_off" />
<item android:state_checked="true" android:drawable="#drawable/btn_radio_on" />
</selector>
just be sure to reference your edited images for the checked states. Then you just have to apply the CustomSpinnerRadioTheme to your Activity and run!
A good resource I found is Applying Styles and Themes especially the additional reference on Android Styles (styles.xml) and Android Themes (themes.xml)