geschrieben von Fabian Schmengler
am 4. April 2017 - 10:00
This is my weekly Kata post. Read the first one to learn what it is all about.

Last week: Ugly Trivia Game

To the Kata description
Scroll down to this weeks Kata description

As planned, I did the PHP version of this refactoring Kata over the week in multiple steps. First I needed test data for the “golden master”, the black box test

1. Step: Generate Test Data

The only input for the “Game runner” are random numbers (rand()), so I seeded the RNG with srand() to make them deterministic. Output is directly echo‘d, so I captured output with ob_start() and ob_get_clean().

Then I ran the program several times with different inputs (seed numbers), and created a data provider from the results.

2. Step: Output Stream

To get rid of the output buffering hack, I passed a stream resource…

geschrieben von
am 1. April 2017 - 20:40

Whether you’re using your IDE, a debugging extension, or calling get_class and new ReflectionClass yourself, PHP (or any language’s) ability to examine itself at runtime is a vital tool for debugging a program.

Most bugs come down to “this variable does not have what I thought it had in it”, or “the thing in this variable behaves differently than I thought it did”. Being able to dump out the contents of a variable exactly when the bug happens during program execution is the quickest way to get to the bottom of any problem.

If you’re a seasoned debugger, the virtual types in Magento'2 di.xml system might throw you for a loop. You define a virtual type like this

<virtualType name="pageConfigRenderPool" type="Magento\Framework\View\Layout\ReaderPool"> <arguments> <argument name="readers" xsi:type="array"…
geschrieben von
am 1. April 2017 - 19:12

We’ve just released pestle 1.3.1, the investable .0.1 release following 1.3.0. The release fixes a few bugs with the generated DDL code for text and decimal based columns. Full details available in the issue that reported the problem.

If you’re at today’s Magento Imagine hackathon (or any day’s hackathon really), and if your project needs a module or common module code, please give pestle a try. Besides getting you up and running with your boilerplate faster, real world use plus bug reports is the only thing that’s ever made software better.

geschrieben von zallgood
am 31. März 2017 - 23:01
Creating a custom widget in Magento 2

It’s not common that you need a custom widget in Magento 2. They offer a fairly wide array of well-made widgets with easy-to-use customization. However, sometimes you need to change the functionality of a widget or increase the selection of customization options, and in order to do this you need to create your own. In this article we will be looking at how to create a widget that extends the functionality of a core widget. We will be extending functionality of the “Catalog Products List” widget so that we can change how the products are ordered.

Create the extension

Before we can create a widget, we need somewhere to put it. For this, we need a vendor folder in app\code and a module folder in the vendor folder. For the sake of this article, I will be using app\code\ClassyLlama\SortedProductsWidget. In the module folder we need two files: registration.php and etc\module.xml.


<?php \…
geschrieben von
am 30. März 2017 - 23:29

So what is a Magento 2 theme? To understand that, we’ll first need to talk about the Magento_Theme module.

The Magento_Theme module contains page layout XML files that define the basic containers for every Magento page layout.

This allows other Magento modules to use layout handle XML files to

  • Add frontend assets (JavaScript, CSS, Less) via the head element
  • Add new blocks and containers via layout handle XML files
  • Via blocks, add x-magento-init and data-mage-init javascript apps/widgets
  • Perform other actions (<move></move>, etc.) via layout handle XML files

By itself, all of the above is enough to build a Magento 2 site. Also, thanks to Magento’s infamous flexibility, it would also be possible “theme” – that is, change the appearance of – a Magento system strictly using modules.

However, Magento module programming is not a skill that’s…

geschrieben von Christian Münch
am 30. März 2017 - 21:30

Like promised in a tweet we deployed the stable version of n98-magerun2 before the start of Magento Imagine 2017. The new release contains five new commands and some bugfixes.

Features List EAV attributes

My colleague Jürgen Thelen ported two Magerun 1 commands to V2. One of it is “eav:attribute:list” which can give you a list of all your EAV attibutes.

n98-magerun2.phar eav:attribute:list

The output is a list of attributes which can filtered by entity type.

n98-magerun2.phar eav:attribute:list –add-source –add-backend –filter-type=customer

Clear your asset cache

The second command ported by Jürgen is to clear static assets.


geschrieben von
am 29. März 2017 - 22:40
This entry is part 6 of 6 in the series Pestle. Earlier posts include Pestle 1.1.1 Released, Pestle 1.1.2 Released, Magento 2 Setup Migration Scripts, Pestle 1.2.1 Released, and Sending Text Messages with PHP, pestle, and Nexmo. This is the most recent post in the series. A new release of pestle, my PHP command line framework with a full compliment of Magento 2 code generation commands, is available for download. New users will find all they need in the GitHub Existing users can just run selfupdate pestle.phar selfupdate and they’ll be good to go. Issues finished and pull requests […]
geschrieben von Fabian Schmengler
am 29. März 2017 - 16:52
This is my weekly Kata post. Read the first one to learn what it is all about.

Last week: Reversed Binary Numbers

To the Kata description

I started with a straightforward solution in PHP, using built-in functions:

function revert(int $input) : int { return (int)bindec(strrev(decbin($input))); }

That was quick (good, because I had little time), but boring. So the next time, I decided to go for a solution with bitwise operations. The result:

function revert(int $input) : int { $result = 0; $exponent = bitLength($input); do { --$exponent; $lastBitValue = $input & 1; $result += $lastBitValue * 2**$exponent; } while ($input>>=1); return $result; } function bitLength(int $input) : int { $result = 0; do { ++$result; } while ($input>>=1…
geschrieben von
am 28. März 2017 - 2:00

We're an ecommerce agency that specialises in Magento. Over the years, we've released a range of open-source commercial and free (as-in-beer) Magento extensions. Knowing that 10,000s of stores and 100,000s of their customers have benefited from our code is a satisfying part of being a developer and a member of a community. However, from today, we will no longer be providing extensions on a commercial basis. Any extensions we do release will continue to be open-source and only listed on and GitHub.

Like all agencies, our priority is to create performant, tailored solutions for our clients that they can benefit from. Over the years, we've also been able to capitalise on our insights and personal development time by releasing innovative solutions like Shipping Rules,

geschrieben von Rob Tull
am 27. März 2017 - 17:25

 Keys to a Successful Magento Implementation

Laying the foundation for your next Magento implementation.

Core Principles TRUST

Ideally, merchants should trust implementers and implementers should trust merchants. After handling over 125+ Magento implementations, we know that every implementation comes with at least one challenge that we hadn’t planned on. When challenges arise, both parties must work together, believing that they have one another’s best interest in mind.


There is no replacement for good old fashion conversation. Talk about the implementation. A big giant form should aid in conversation; it should not be a substitute for it. Important information often comes out of side comments had during a conversation. We encourage merchants to be…

geschrieben von
am 27. März 2017 - 2:00

We're now counting down the days until Magento Imagine 2017 kicks off at the Wynn in Las Vegas. It's a legendary event that has proven to be an incredibly inspiring and informative while also managing to be a whole lot of fun.

The most popular highlight for attendees at Imagine is the people there. It's a very collaborative environment.I'm looking forward to spending time with old friends catching up on both the professional and personal side.

Beating the Competition with Cognitive Commerce

It'll be my 5th time at Imagine and I'm proud to say that this time around I have the privilege of presenting at a breakout session on Wednesday 5th at 11AM in La Tache.

I will be talking on Artificial Intelligence, and machine learning in particular. How it’s going to revolutionise every sector is the talk of the tech industry. So what is it, what do you need to know and how can you use it as a tool to get an edge? My session will look at some of the…

geschrieben von
am 23. März 2017 - 17:44

I’m working on adding DDL (data definition language) code generation to pestle – i.e. the code that ultimately creates your database tables that lives in the InstallSchema or UpgradeSchema classes. I came across this bit of weirdness

#File: vendor/magento/module-cms/Setup/InstallSchema.php )->addColumn( 'identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Block String Identifier' )->addColumn( 'content', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '2M', [], 'Block Content' )

This is part of the code that creates the database table Magento stores CMS block data in.

CREATE TABLE `cms_block` ( `block_id` smallint(6) NOT NULL AUTO_INCREMENT COMMENT 'Block ID', `title` varchar(255) NOT NULL COMMENT 'Block Title', `identifier` varchar(255) NOT NULL COMMENT 'Block String…
geschrieben von Matej Zbiljski
am 23. März 2017 - 13:48

We wrote about Google Shopping Campaign as an unavoidable type of online advertising and its significance in web shop sales. But, what can we do about the buyers who are not ready to buy a certain product right away? The answer is remarketing!

Remarketing enables you to reach the client who visited your web shop, but did not buy anything or did not complete any goal you defined. Because of that, it is necessary to remind those clients that they did not fulfil what we think that is their “task/homework” via Google Display Network or Google Search Network. In order to reach your goal for them to purchase as efficiently as possible, it is necessary to show the clients what they have been searching for and encourage them to re-engage. This is exactly what Dynamic Remarketing does.

What is Dynamic Remarketing?

Dynamic Remarketing is a type of campaign for Google Adwords,…

geschrieben von Luka Rajcevic
am 21. März 2017 - 12:34

It’s just another day at the office. “Coffee tastes best on a Friday morning”, you think to yourself while reading emails from the previous day. Couple of guys are shouting in the back, and you’re shushing them angrily. With noise slowly diminishing, you find yourself checking an email with a request for custom change on one of your Magento stores. “Guys, we’ve got work to do. WeHeart3rdPartyModules Ltd. just requested a custom change on one of their stores. Who is willing to take on this one?”. Silence takes over the room. The only sound you hear is a fan from your colleagues PC (no need to ask why, Magento 2 is deploying static content). It seems like you’re in this alone. “Damn, I was hoping for a slow Friday”.

While PHPStorm is loading up, you’re reading the requirements:

Hi guys,

we would like to add a new column to our sales orders grid. We understand we…

geschrieben von Alexander Galtsow
am 21. März 2017 - 9:40

Imagine 2017 is just 20 days away and most of the attendees have already planned their trip to the conference. But if it is your very first Magento event, there are some useful things to consider. We’ve gathered some recommendations that proved to be good for Atwix each and every Imagine since 2011.

1. Plan ahead

Preparation is everything. Schedule your meetings in advance (schedule a meeting with Atwix team), create a list of breakout session to attend, and register for unofficial events around the conference, like MageHackathon, Big Dam Run and…

geschrieben von Fabian Schmengler
am 20. März 2017 - 10:27
This is my weekly Kata post. Read the first one to learn what it is all about.

Last week: Anagrams

To the Kata description

I started in PHP with a naive array based solution, then changed it to a pipeline with generators which made the memory footprint small, but it still takes a minute for a 150 KB file and forever for the provided 3 MB test input file.

When I retried the kata the next day, I used two simple loops and one array and the file was processed in 1 second. It needs 182MB but okay. It’s fascinating how trying to be clever from the beginning has been proven to be a mistake.

Here’s the code

<?php declare(strict_types=1); namespace Katas\Anagram; class Anagrams { private $wordsIterator; public function __construct($wordsIterator) { $this->wordsIterator = $wordsIterator; }…
geschrieben von PAJ
am 17. März 2017 - 19:49

If you are looking at containerising PHP applications you might want to run another containerised application from within your container – run a docker application or command in a docker container. Your native app might be encoding media on the fly via ajax requests using ffpmeg and you do not want to compile or install ffmpeg in your containerised app. It would be useful to run a containerised ffmpeg version within the container.

This is kind of a quasi docker in docker because we are not trying to create dockerised containers within a container, rather run a docker app from the docker host within a docker container.

Still with me? Good!

We give our container access to the host docker socket by sharing a volume (in this case docker.sock) with the container

volumes: - /var/run/docker.sock:/var/run/docker.sock

If we install the docker binaries within the container we can now run docker commands on the host i.e.:

geschrieben von Fabian Schmengler
am 17. März 2017 - 14:38

I wanted to run tests with PHPUnit on a docker environment, which was set up with docker-compose, and use the PhpStorm integration. Since PhpStorm 2013.2 there is a docker intergration which works well for single containers, but unfortunately it does not seem to use the running network of containers. So for example my PHP container does not get access to the MySQL container for integration tests.

If that’s not a problem for you, you will not need what I am going to explain here, read this instead:

Local CLI Interpreter

So instead of configuring the Remote PHP Interpreter for Docker, I created a local interpreter like this and selected it as the CLI interpreter for the project:

geschrieben von Alexander Galtsow
am 15. März 2017 - 14:31

Hooray! Imagine 2017 is just around the corner and Atwix is proud to sponsor the conference this year. Come chat with us at our booth, we’d be happy to provide express security audit of your Magento store, talk about general eCommerce trends and innovations, or simply have a nice little chat. All the visitors will be supplied with recommendations on implementations, discounts on maintenance packages, and a cool swag for you and your kids.

Where to find Atwix at Magento Imagine 2017

Imagine is unquestionably the central event in Magento ecosystem, expected to gather 2,500+ professionals from all over the world in one place for 3 days this year. If you are still in doubt, here are five reasons to attend the event:

1. Magento has been steadily making headlines…

geschrieben von Fabian Schmengler
am 14. März 2017 - 9:38

When migrated my workstation to Linux, one important tool was the password manager. I use KeePass, so there are two options around:

I tried both. On KDE, KeePassX integrates nicer into the Linux desktop while KeePass on Mono looks and feels a bit foreign. But the lack of features like auto open and plugins made me ditch KeePassX quite fast. Two important plugins for me are KeePassHttp, which integrates KeePass with Chrome as password manager, and KeeAgent which automatically registers SSH Keys with passphrases at a running SSH Agent.

Setting up KeeAgent was a bit tricky and all instructions…