2

First off let me just say, I am green when it comes to Magento (all versions) and have been trying to figure this out for two days and I am not sure what else to try. I have been fiddling with a custom template that inherits the Luma theme and I have figured out how to muddle through the xml files for block placements and so forth, mostly getting things to work by trial and error. I changed the default_head_blocks.xml located in my custom theme here:

/app/design/frontend/myvendor/mytheme/Magento_Theme/layout/default_head_blocks.xml

to include a custom css file to override some of the Luma css (mine is labelled as css/mycss.css):

<head>
    <meta name="x_ua_compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <css src="mage/calendar.css"/>
    <css src="css/mycss.css"/><!-- <<<--- I added this -->
    <script src="requirejs/require.js"/>
</head>

I was very happy with myself that something I did actually worked, until I went to look at the single product view (the category view inherits the css just fine and I also have the category set to apply my template to in-category products...something else I tried, not sure if that is right or not). I checked to make sure the product itself was also using my template under the Design tab in the admin area, which it says it is. Then I went to the catalog folder to try and mess around with all of the xml documents pertaining to product such as the catalog_product_view.xml, catalog_product_view_type_simple.xml, etc... and adding:

<head>
    <css src="css/mycss.css"/>
</head>

I should mention I did move all combinations of these xml files into both:

/app/design/frontend/myvendor/mytheme/Magento_Catalog/layout/

and/or

/app/design/frontend/myvendor/mytheme/Magento_Theme/layout/

Last thing to mention, I flush my cache every time I change something.

Anyway, I have Googled the crap out of this and I tried to adapt some Magento 1.x answers to try and solve it, but I can not figure it out with my limited Magento knowledge. Any push in the right direction would be helpful at this point because I am just staring at my Magento project folder right now with a dumb perplexed look on my face...


EDIT

After more "trial and error" I have deduced that this page, including the account signup, login, etc. are just using the base template...how do I know? I did the unthinkable! Just to test, I added my <css src="css/mycss.css"/> to the base theme's default_head_blocks.xml file located here:

/vendors/magento/theme-frontend-blank/Magento_Theme/layout/default_head_blocks.xml

So I guess my question is, how come it's using the base template (which I already suspected it was doing) and not the one I am assigning it? I am missing something, but I don't know what it is or where to fix it.

2 Answers 2

0

For adding custom or as you say "mycss.css" in your theme layout
you have to place "mycss.less" file in to
app\design\frontend\Zenon\zenon\Magento_Theme\web\css\mycss.less
after that change the css debugging mode to public or client side.

after than do static content deploy using compressor

1
  • Hello thank you for your interest. Let me clarify a bit, I have no issues getting CSS working in everything except the single product view, account signup, login etc. The problem is not the CSS, that is a symptom of the problem. The real problem is that I have told Magento to use my template for the product(s) in the admin, but it's still using the base template. I can live with the other parts not looking like the rest of the site, I can fiddle with that later, but I need the product page(s) to inherit my template.
    – Rasclatt
    Dec 19, 2015 at 18:47
0

I could not figure out this issue, the only option I had left was to delete the "working" installation of Magento2 and reinstall it (I actually reinstalled it 4 times)...basically I started over and went through all the set-up again. I resolved the issue in developer mode, but I have not tried it in production mode. I don't really know if it was a permissions thing, or some cache thing, or what...but reinstalling fixed it.

The solution is not an ideal one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.