Naguel

I'm Nahuel, and these are my work experiences, ideas and thoughts as a web developer working on the eCommerce industry.

Magento virtual themes or why theme changes don't show up in the front end

Magento virtual themes or why theme changes don't show up in the front end

You have a Magento 2 theme created (at least you can see it in your IDE and we're going to assume there's no typo in the theme.xml nor in the registration.php), you can also see it in the Admin, and finally you have it configured for your store.

Then you go to the front end and you see a Frankenstein's monster: the CSS is okay but the Layout XML is not being taken into consideration. The front end kind of knows which theme to load, but it's loading it only partially.

What it's going on? How do we fix it?

One of the possibilities is that the theme is set as Virtual instead of Physical in the database, causing behaviors such as the described above.

Magento 2 happen to have 3 types of themes, of which I have found very little information in the official documentation (just a minor mention in the Troubleshooting section of the 2.0 "Apply and configure a storefront theme" page but gone in the 2.2 version of it) but a convincing explanation in this StackExchange question.

We have "Physical themes" which are the well-known themes such as Blank and Luma, second we have "Virtual themes" which appears to be themes that extend a Physical theme but doesn't exist in the files (nothing in app/design), and finally we have the "Staging themes" which I have no idea what they are nor how they behave (sorry).

These 3 different types of themes are defined in the Interface Magento\Framework\View\Design\ThemeInterface as 0, 1, and 2 for Physical, Virtual and Staging, respectively.

If you go to your database (using the Terminal, PhpMyAdmin or an app like TablePlus) and take a look at the theme table, chances are that you'll find something like this:

If you encounter a 1 in the type column for your theme, there's your problem. Change it to 0 and everything will be fixed.

How the theme became Virtual without anybody setting it anywhere?

You're probably wondering how that 1 ended up there without anybody setting it (at least you're sure you didn't as you just find out about all this).

As described, Virtual themes are themes that doesn't exist in the code, meaning there are no files for that theme (how Magento expect us to use this type of theme is for me unknown).

If you're using a version control system such as Git maybe (maybe) you ended up for a moment in a branch without the theme files and somehow loaded the front end or ran a bin/magento command. For a moment only, Magento saw in the database that a theme is set and active but found no files in the code for such theme, so it changed it to Virtual.

"kex_exchange_identification: read: Connection reset by peer" fix for Cloudways

"kex_exchange_identification: read: Connection reset by peer" fix for Cloudways

Basically, if you are seeing that message while trying to connect to a server, like over SSH, it means that your IP is banned.

There are great articles out there about solving this issue that requires you to edit some complicated files you never touched before on the server itself, but luckily, for those using Cloudways, the solutions is way more simpler.

First thing first, if you want to confirm this issue is really because you are banned, ask somebody else (or change how are you connecting to the Internet to get another IP) to cat the /etc/hosts.deny file inside the server.

If your IP is there, you can consider yourself banned.

To allow you back to the server, go to the "Security" tab inside the server configuration, within the Cloudways Dashboard, and whitelist your IP.

Make sure to "Save changes" after adding your IP.

Leave your stable job and stop being a coward

Leave your stable job and stop being a coward

I worked on the same place for almost 6 years until one day I quit.

That statement, while true, is extremely simplistic and it's not like I woke up one morning and said "Today is the day I move forward", but instead took me a lot of thinking and time (more than a year) until I reached that decision.

What took me so long? Mainly lack of bravery. Chances are that if you are reading this post you're a coward too, but that's okay, it can be our secret, and you shouldn't be ashamed of that. My cowardice is known as "being too much time in the comfort zone" by other posts you might find on the Internet, but I don't want to be that polite and instead call stuff by its names.

My lack of bravery grew over the time fed by the fact that my job was secured in this place after 6 years. I'm not saying that I was irreplaceable, but after 6 years it's not like somebody were going to fire me overnight.

Also, routine mixed with flexibility. I knew I had a job from Monday to Friday, a secured job, something to do within a company with many clients, and on the other side if I wanted to slept 2 more hours I could do that and there was no problem because they knew how I was and that I was going to work towards objectives (meaning me sleeping two more hours in the morning won't jeopardize any project). You know, comfort zone.

Something started to bother me, and it was the fact that inside me I knew that my performance could be better. My work done could be delivered with a higher quality and especially in less time, and I could be learning something different, new, or a different way to accomplish my job description's objectives.

I was somehow stuck, and I wanted to know how the work can be done from a different perspective, under a different pair of eyes. Like the "I want a second opinion" phrase in the medicine world.

It's a sentiment hard to put on words, that you're probably feeling too, that I compare to the need of leaving your parents' house to live by yourself.

If one day you make the step, you're in for a smoothie of feelings starting from "What the hell am I doing?" to somehow relief, peace, panic, adrenaline for sure, happiness. If things goes well (it can fail, I mean, sorry, but this is not quite an inspirational post... things can go terribly wrong so think twice, haha) you'll find yourself smiling on the back of your Uber ride while looking over the window (with a stupid face in my case).

As I don't want this to be a motivational post, and as I don't want to sound like I'm saying "leave your work, leave everything behind and pursue your dreams because life", let me pitch in some disclaimer points here.

We need to know that jobs are not like yogurt and they don't have an expiration date based entirely on time. If you happen to be on a job for 3 years, 5 years, or whatever, don't quit just because you believe that you're being too much time in the same place.

I don't believe in the feeling that a cycle is completed based only on the time you spent on that cycle. There are more than years spent on the same chair, so if you're happy where you are just keep going and that's just okay.

Consider also that being mad is not a reason to quit. If you're mad, and you quit just because of that, chances are that you are, at least, to blind to think this through, to contemplate all the possibilities and choose wisely.

I once saw somebody saying "I quit" right in the spot of a performance review, not even letting the performance review finish, not even giving an hour to think about the big decision of leaving a job. Of course, that was just words and total regrets the following day, but still works as an example.

Mad? Make peace with yourself and with the company you're working on before taking a decision. Stop thinking of companies as "big evil corporations", and you'll probably find (as I did) that the company you work for is given everything they can, so allow them some mistakes.

If you are getting fearless and thinking about leaving your stable job, do it for the right reasons.

I'm hoping this personal post, my personal experiences that most likely is totally different to what you're going through, helps you think more deeply about the current situation you're living with your current job.