Wednesday, April 26, 2017

"Dead" is dead

When I started this blog it was intended to provide short solutions to short and common Magento problems.
But then I slowly moved this activity to the Magento StackExchange website.
Since then, this has been left for DEAD. But I'm using it right now for my occasional rant because that's what blogs are about. People sharing their ideas & opinions (most of them wrong). I'm doing the same for the fear of missing out.
So here is my occasional rant.
Today is about ".... is dead".

I've been seeing a lot of blog posts that come in via e-mail or twitter (good thing I don't have a Facebook account) about "'bla bla, something something' is dead".
I'm going to list here only a few that are related to my everyday work, because I cannot express an opinion worth reading about thinks I don't know. (Apparently others can).
So here are the nominees:
  • PHP is dead.
  • Magento is dead.
  • Scrum is dead.
  • JS is dying. (notice, not dead yet)
Hold on there mister coroner.
Did you find someone lying down? Check the vitals first. Maybe that person is not dead. Maybe is just resting. Maybe he just fell down.
Look around you, maybe you are at the beach and the person lying down is enjoying the sand.
Do you have a relative that is an undertaker and is going to make money from all the things you declared dead?

I went home one day after reading a few of the "is dead" stories and told my wife that apparently I'm working with some dead technologies. Her answer: "But you're still getting paid, right?". Me:"Yes". Her: "Cool! At least like that you don't run the risk of killing something.".

So in conclusion, I'm declaring that "DEAD" is dead.
Every blog post I see from now on that ends with "...is dead", is dead to me (except this one). Stop declaring things dead if you don't feel a pulse in the nail of the small left toe. Disclaimer: I know I'm declaring something dead even if I say not to declare things dead.

Wednesday, April 19, 2017

Magento Imagine - the family reunion

More and more people write about their experience at #MagentoImagine this year. I think I'm better with code than with words, but I'll give it a shot to detail my experiences.

Alright. I'll start with the flight.

Getting there was hell. But not worse than I expected. That's what you get when you are 1.90m tall (6'3") and 95 kg (210 lb). Bucharest to London was OK. I was lucky to get the last available exit row seat. Yes, kissing flight attendants a$$ works. But I was not so lucky from London to Las Vegas. Almost 11 hours in a seat in which I don't fit. I saw 2 bad movies and a good one and read a slightly interesting book. 1.6 eternities later, the trip ended with meeting Jisse Reitsma in the LAS airport and not recognizing him at first. Reminder that almost nobody looks like their twitter picture. Lesson learned: Wear Magento branded clothes during the flight to a Magento event. It helps.

Even if I know that the credit card system is "different" in the US from EU, I did not expect to have to pay cash at the hotel (not Wynn.). No problem. Just a 200$ withdraw with about 2% interest and a call from my bank back home asking me why am I in Vegas and what the hell I'm doing there. But it was over quickly.

Now to the fun part. I was off to Preimagine for which I didn't sign up. But luckily the Magento employees are nice people and I could get in. Here, the usual, a lot of hand shakes and hugs, a lot of "How you've been? Same old same old, how about you?", some well deserved alcohol after a long trip. Just like a family reunion where you see who got married, who's got kids, who switched jobs, but better because nobody asks you to "lend" them money. When this was over, we moved across the street at Strip Burger where we kind of scared the staff because we took over more than half of it.

Then the first day of Imagine came. It all started with a Masters breakfast. Good food, good conversation, OK coffee. Again, a lot of handshakes and hugs. Then I went to the dev room, Margaux 1 where I've learned how to pass the Marketplace Extension Quality Program. Good way to start the dev track. A few sessions later I ended up in the UI-components presentation by James Zetlen A great technical guy and a great sales guy. He was the second person that day to jokingly (or not) tell me to leave a presentation room. But we're good friends now. We sorted it out at the party after some drinks like real adults.

Oh. And I got to go on MageTalk live With my good friends Sander and Anna. Thanks Phil and Kalen for having me.

Immediately after the Sponsors marketplace opened, the swag hunt started. Got a few good stuffed toys (for my kid of course). Something like SuperLLama, ZiggyTheHydra an echidna, cards against taxes and a few others.

Moving on to the important part. THE PARTY. Again, good food, good drinks, awesome conversation. Before Imagine I set some milestones for myself regarding the conference and I reached all of them.

Among all people I would like to mention that I met some new Magento employees. And from them, 2 really made a mark on me. I got to meet Kevin "SocialKev" Cassidy and Danielle "UX" Mundle. They really live up to their twitter handles.

Going to the second day. Among other technical tracks there were....Yey...Keynotes. I was amazed an disappointed at the same time. I was amazed by Jessica Herrin. She was simply awesome. A nice speech combining motivational words, business approaches, good jokes. Please Magento bring her back next year. As a keynote or as MC along side Jamie.

I was disappointed by the Serena Interview. Don't get me wrong, not by Serena, but by the interview. Maybe it's because I had really high expectations. I got used to Magic Johnson's magic last year and maybe I was expecting a few "war" stories from Serena also. Please don't do interviews with the Keynote speakers anymore. Just give the a mike and 45+ minutes. Also let the audience ask 3-4 questions at the end (even if they are staged questions).

Next...the legendary party. As usual, fancy location, good food and awesome conversation. I've played the "Have you met...." game. I've been on both sides of it. I introduced people I know to other people I know but they didn't knew each other. And I was also introduced to people I don't know. Great way to socialize. Everything ended as best as it could. With Max jumping in the pool holding his well deserved award.

Everything has to end, so we got to day 3. Last and most depressing day of the conference. But it all ended in a nice way with the DevExchange. a great way to talk to other devs and not only on dev topics. I got to hear from my good friend Miguel Balparda (that, by the way, was the 4th person at Imagine to tell me to leave the presentation room) how it is to work remotely, a thing that I was kind of against until now. I still am, but I understand now the need and the benefits.

Regrettably, it was all over. I had to go to the airport. When I got in the cab, one of the last things I expected to happen, happened. The conversation with the driver went like this after the formal greetings "Driver: Where are you from? Me: Romania. Driver: Oh. Buna! Ce faci? (that's Romanian for 'Hey! How are you?')". It was a good conversation opener. He was a guy from Macedonia that spent a lot of time in Romania during the 80's. We had a nice conversation until we reached the airport.

One other lesson I learned was "Buy TSA approved luggage.".

Coming back to the real world, I was left with a puzzling problem. On day one there was a talk about diversity in tech. From what I talked with the people I conclude this was a bit controversial. Most of the people had the idea that it is good to encourage diversity, but not overdoing it just so you can push an hidden agenda. My opinion on this might be a bit biased because in Romania we don't really have a problem with gender discrimination when hiring people, but I still had to ask the HR department if they have stories about discrimination. This is the answer I got back: "Are you fucking kidding me? We cannot afford to discriminate. We need a lot of developers. If your dog can bark the words 'node.js' or 'java' we would hire it.".

Kidding aside, this was a good conference, filled with fun moments and knowledge sharing. I hope I can make it to a future one.

Summing all up...well, just extract the first letters of each paragraph in this post.

Wednesday, August 27, 2014

Ultimate module creator 1.9.4.1

On August 27th 2014 I released the 1.9.4.1 version of the Ultimate module creator.
You can get from github or from magento connect
You can see here the release notes for the new version.
You can also checkout the documentation.

Monday, April 14, 2014

Ultimate module creator 1.9.0

I'm getting close to releasing a new version of the Ultimate Module Creator.
Version 1.9.0 will be released soon and it has a lot of new features and bug fixes.
It is based on the previous version (1.6.3) but it is not backwards compatible. So I suggest that instead of trying an upgrade remove the previous version and install this new one.

The new version is available on github and Magento Connect starting with April 25th 2014.

The 1.6 version will still be available on github but there will be no support for it.

Here are some key features from the new version. For a full list of release notes see this.

  • Features
    • Support for EAV entities.
    • Module Admin menu can be placed anywhere in the menu tree.
    • The frontend route of the module can be set manually on creation instead of using the module name.
    • Allow users to comment on the generated entities.
    • Link entities in a many to many relation with the catalog categories.
    • Additional attribute types (dropdown, multiselects)
    • Ability to add many to many relations between tree entities
    • Displaying flat entities by store is optional now.
  • Improvements
    • Pimped up the admin UI of the module creator
    • Faster admin UI. No more ajax calls to add a new attribute or a new entity.
    • Made the HELP section include more valuable data.
    • The aliases for models/blocks/helpers include the module namespace to avoid conflicts
    • Generate an uninstall file to make it easier to remove installed modules.
  • Bug Fixes
    • Most important: Module names can include uppercase letters. Until now using 'ModuleName' for the name of the module would make that module unusable on UX servers. Now it works.
    • Entities were not displaying in product page unless they had a separate view page.
    • Replaced 'addFilter' that had no effect with 'addFieldToFilter'
If you try it out and find any issues or have new ideas please post them on github.

Monday, November 11, 2013

Product relations importer

Check out the product relations import tool for Magento. This extension allows you to quickly update/replace related products, upsells and crossells for your catalog products. You can do that by manual input or file upload.

Thursday, October 31, 2013

Easylife Switcher extension

I've just released a new Magento extension called 'Easylife_Switcher'.
This is what it does:
  • Frontend:
    • it can change the configurable products dropdowns to text or image labels
      config
    • it allows you do display the out od stock combinations of configurable products with a "not available" overlay (see image above - medium size). The out of stock products may be selectable or not. Your choice.
    • it can change the main image in the product page when a combination is selected, if an image is available for the simple product. You can set the attributes that change the image.
    • it can change the full media block in the product page when a combination is selected, if at least the main image is available for the simple product. You can set the attributes that change the media section.
  • Backend:
    • it allows you to set a default configuration to be selected while accessing the configurable product page.
      backend
Code and more details on how to use can be found here: https://github.com/tzyganu/Switcher

Friday, April 19, 2013

Monday, April 8, 2013

Thursday, March 28, 2013

Get class rewrites

Here is a small script that lists all rewrites for models, blocks and helpers in Magento.
It also takes into account the disabled extensions but this should't be a big issue.
Create a new file on the root of your magento instance. Let's call it rewrites.php with this content.
<?php 
$folders = array('app/code/local/', 'app/code/community');//folders to parse
$configFiles = array();
foreach ($folders as $folder){
    $files = glob($folder.'*/*/etc/config.xml');//get all config.xml files in the specified folder
    if (is_array($files)){
        $configFiles = array_merge($configFiles, $files);//merge with the rest of the config files
    }
}
$rewrites = array();//list of all rewrites

foreach ($configFiles as $file){
    $dom = new DOMDocument;
    $dom->loadXML(file_get_contents($file));
    $xpath = new DOMXPath($dom);
        $path = '//rewrite/*';//search for tags named 'rewrite'
        $text = $xpath->query($path);
        foreach ($text as $rewriteElement){
            $type = $rewriteElement->parentNode->parentNode->parentNode->tagName;//what is overwritten (model, block, helper)
            $parent = $rewriteElement->parentNode->parentNode->tagName;//module identifier that is being rewritten (core, catalog, sales, ...)
            $name = $rewriteElement->tagName;//element that is rewritten (layout, product, category, order)
            foreach ($rewriteElement->childNodes as $element){
                $rewrites[$type][$parent.'/'.$name][] = $element->textContent;//class that rewrites it
            }
        }
}
echo "<pre>";print_r($rewrites);
When accessing mysite.com/rewrites.php you should be able to see all the model, block and helper rewrites. If there is one object rewritten by 2 or more classes it means you have an extension conflict.

Monday, March 25, 2013

Add custom page layout

Here is now you can add a custom page layout (similar to 1column, 2columns,....) without editing the core files.
Create a new module. Let's call it Easylife_Layout.
For this you need the following files:
app/etc/modules/Easylife_Layout.xml - the declaration file
<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Layout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Easylife_Layout>
    </modules>
</config>
app/code/local/Easylife/Layout/etc/config.xml - the configuration file
<?xml version="1.0"?> 
<config>
    <modules>
        <Easylife_Layout>
            <version>0.0.1</version>
        </Easylife_Layout>
    </modules>
    <global>
        <page>
            <layouts> 
                <custom_layout module="page" translate="label">
                    <label>Custom layout</label>
                    <template>page/custom_layout.phtml</template>
                    <layout_handle>custom_layout</layout_handle>
                </custom_layout> 
            </layouts>
        </page>
    </global>
    <frontend>
        <layout>
            <updates>
                <easylife_layout>
                    <file>easylife_layout.xml</file>
                </easylife_layout>
            </updates>
        </layout>
    </frontend>
</config>
app/design/frontend/{interface}/{theme}/layout/easylife_layout.xml - the layout file (I recommend creating it inside the base/default theme so it will be available for all the custom themes)
<?xml version="1.0"?> 
<layout>
    <custom_layout translate="label">
        <label>Custom layout</label>
        <reference name="root">
            <action method="setTemplate"><template>page/custom_layout.phtml</template></action>
            <action method="setIsHandle"><applied>1</applied></action>
        </reference>
    </custom_layout> 
</layout>
app/design/frontend/{interface}/{theme}/template/page/custom_layout.phtml - the page html - feel free to customize it as you want. this is just a copy of 1column.phtml with some new added classes (I recommend creating it inside the base/default theme so it will be available for all the custom themes)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
<head>
<?php echo $this->getChildHtml('head') ?>
</head>
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start') ?>
<div class="wrapper custom-layout">
    <?php echo $this->getChildHtml('global_notices') ?>
    <div class="page">
        <?php echo $this->getChildHtml('header') ?>
        <div class="main-container custom-layout-container">
            <div class="main">
                <?php echo $this->getChildHtml('breadcrumbs') ?>
                <div class="col-main">
                    <?php echo $this->getChildHtml('global_messages') ?>
                    <?php echo $this->getChildHtml('content') ?>
                </div>
            </div>
        </div>
        <?php echo $this->getChildHtml('footer') ?>
        <?php echo $this->getChildHtml('before_body_end') ?>
    </div>
</div>
<?php echo $this->getAbsoluteFooter() ?>
</body>
</html>
That's it. If you want to load your layout in a custom layout xml file (let's say for your custom entities display) just add this inside the page handle
<update hande="custom_layout" />
The new layout should be available for all the CMS pages and category/product display settings.