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

Last week: Print Diamond

To the Kata description

My first implementation suffered from the anticipated problem: Starting with tests for the whole output for ‘A’, then ‘B’, then ‘C’, the full algorithm was implemented after the second or third test in one big step.

<?php namespace Katas\Diamond; class DiamondTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider dataDiamond */ public function testDiamond($letter, $expected) { $diamond = new Diamond($letter); $this->assertEquals($expected, $diamond->__toString()); } public static function dataDiamond() { $b = <<<TXT A B B A TXT; $c = <<<TXT A B B C C B B A…
geschrieben von
am 14. März 2017 - 4:41
This entry is part 5 of 5 in the series Pestle. Earlier posts include Pestle 1.1.1 Released, Pestle 1.1.2 Released, Magento 2 Setup Migration Scripts, and Pestle 1.2.1 Released. This is the most recent post in the series. Today we’re going to go a little off the beaten path. I’ve had “professional reasons” to explore voice and SMS APIs in the past few weeks, and I ended up adding some commands for the Nexmo API to the latest release of pestle, (my kitchen sink PHP command line framework). This article’s going to talk a little bit about the history of […]
geschrieben von
am 14. März 2017 - 1:00

In this article we will be sharing how we can update email templates via upgrade scripts.

We have already shared some of our knowledge about running upgrade scripts and how helpful they are in automating database changes in deployment processes. I would recommend checking our first article "Create or update blocks and pages via Upgrade Scripts" for more details on how to run upgrade scripts. I will only explain the lines of code for updating email templates via scripts in here.

To add new transactional email template in Admin, you go to:
  • Admin > System > Transactional Emails
  • Add New Template
  • Load the default template + Click Load Template
  • This will load up Content of the default Magento template for each template you want to style
  • All default email templates are located in: app/locale/en_US/template/email/
geschrieben von Dunja Vorkapic
am 13. März 2017 - 13:16

Company culture defines its journey. One of the definitions says culture is based on shared attitudes, beliefs, customs, and written and unwritten rules that have been developed over time and are considered valid. It includes both work and general behaviour philosophy and set of values thus shaping company efforts and overall activities. One of the main attributes of Inchoo’s company culture is commitment to the local community.

How sharing leads to engaging?

When I asked Tomislav, our CEO, why commitment to the local community is so important, this was his answer:

“Inchoo has an office in a small Croatian town called Osijek with a population of 100.000. Since the inception in ’08, we were hiring from the local pool of talent.

Industry in Osijek collapsed after Croatian war for independence. Today, economy is still struggling and a lot of young people…

geschrieben von Maria Zayac
am 13. März 2017 - 12:54

Magento is a great eCommerce platform to work with. Many solutions are available out of the box, ready for you to use them and grow your brand online. Your Magento solution partner will always help you develop the best-in-class online store, but there is basic knowledge you should acquire when managing a Magento store – from knowing how to use Magento admin to doing little SEO tweaks and security checks.

While Magento is very intuitive and user friendly, you’ll probably end up searching for specific guides and use cases. You might feel overwhelmed with the numerous How-To’s and tutorials that have been generated by the Magento community since the first release of the platform on March 31, 2008. In this very blog we have accumulated over 200 posts about Magento. This is why we came up with the following reference of the trusted resources that you can use. This may help you learn more general information about the platform, best security practices, tips on…

geschrieben von Jayme Courtney
am 12. März 2017 - 9:50

Magento’s store configuration functionality allows developers to quickly and efficiently define config fields for their modules. This efficiency promotes flexible and configurable modules, saving developers and merchants time and money.

In some cases, however, a fixed list of defined config fields isn’t sufficient to configure a more dynamic feature. Fortunately, it’s relatively straightforward to implement dynamically generated store config fields, allowing developers to support complicated flexibility.

Example Use Case

The requirement for this example is that, for countries which are configured to require a state/region, only certain regions are allowed.

These countries are configured in store config at General -> General -> State Options -> State is Required for. In order to configure which regions are allowed for each country, new store config fields will need to be added, one for each configured country. Since the configured…

geschrieben von
am 11. März 2017 - 3:36
This entry is part 4 of 4 in the series Pestle. Earlier posts include Pestle 1.1.1 Released, Pestle 1.1.2 Released, and Magento 2 Setup Migration Scripts. This is the most recent post in the series. Pestle 1.2.1 is out (we skipped 1.2.0 because tagging is hard). New users? The GitHub README can get your started. Existing user? You’re just a pestle.phar selfupdate away from the latest and greatest. This release closes out 17 GitHub issues. For a full list of everything we did checkout the two closed milestones. This release contains a lot of “sandpaper work”. Fixing the formatting of […]
geschrieben von Goran Kolak
am 7. März 2017 - 8:37

In this article we’ll be looking to a basic overview of PostCSS from the perspective of a developer whose current CSS development process includes use of CSS preprocessor, or in particular, Sass. If you’re a Sass user, there are a couple of approaches when starting out with PostCSS. You could make a complete switch and recreate your basic preprocessing environment with PostCSS, or you could start using it as a supplement.

Many of you will say that you still only rely on your favorite preprocessor, but then, it’s possible that you’re also using Autoprefixer for vendor prefixing, and guess what? In this case, you have already included PostCSS into your workflow.

What exactly are we talking about?

PostCSS is a tool, or basically, just an API which handles its plugins written in JavaScript.

Comparing to Sass,…

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

Last week: Functions Pipeline

My first implementation in PHP was a Pipe class with __invoke method:

class Pipe { /** * @var \callable[] */ private $callables; private function __construct(callable ...$callables) { $this->callables = $callables; } public static function create(callable ...$callables) : Pipe { return new self(...$callables); } public function __invoke() { return array_reduce( $this->callables, function(array $result, callable $next) { return [$next(...$result)]; }, func_get_args() )[0]; } }

I made it possible to be created without any callables. The behavior was not specified but I choose to let the pipe return the first argument in that…

geschrieben von PAJ
am 3. März 2017 - 15:07

If you are relatively new to docker and are migrating php applications to containers you may notice that a lot of docker images recommend using sSMTP as a sendmail replacement / smtp transport for php. I wanted my php containers to relay mail to an EXIM4 container but most php base images do not include any type of mail transport system to allow php to relay emails.

ssmtp cannot rewrite php from header

Ssmtp does work, but not very well and one major problem I came across was that no matter what configuration settings I tried I could not rewrite the send from SMTP headers in ssmtp I wanted, resulting in all emails being sent from the default root@host address.

The solution is to use msmtp. Msmtp works well with PHP 5.x and 7.x images and allows you to rewrite the from headers. Here is how to build it into your PHP 5.x and 7.x base images.

FROM php:7-apache

For php7 using the official php-apache…

geschrieben von
am 3. März 2017 - 1:00

There are estimates that Amazon has sold over 5 million Echo units in 2016. That's a lot of homes that are at least experimenting with voice interactions.

I think that the Echo and Google's Home are distinctly different to phone voice agents like Siri and Cortana because of the context that they're used in. Siri and Cortana are used on your mobile phone, a device that knows most about you and your interactions with others. That's why we never really feel comfortable with other people using it - even if you have nothing to hide.

The Echo and Home devices on the other hand, while they are connected to an individual's account, they don't have as much access to information so it's safer. They're also designed to be used in a social context around the home which I think is going to be really important component of their success.

What these devices are having to get past, at least from my experience in the UK, is the conservatism around…

geschrieben von Denis Saltanakhmedov
am 2. März 2017 - 15:17

Any application should be unambiguous. Every user should easily read and understand it. OroCRM applications contain many forms and fields. Developers can customize them and add even more, which can make the application difficult to use by other parties. The easiest way to avoid this is to add comments to the application elements: fields, forms etc. This can be done with tooltips in OroCRM. And we are going to show you how to do it.

In the following example we will use a Contact form entity. You can see the form in contact/create or contact/update/(id). You can use any of the forms but if you want to add some changes to a native Oro form, you first need to overwrite it. We have overwritten the OroCRMContact form and now can add tooltips to fields. Keep in mind, the native OroCRMContact form class is vendor/oro/crm/src/OroCRM/Bundle/ContactBundle/Form/Type/ContactType.php. We need to change the $builder->add() method.

Here is how you can add fields to…

geschrieben von markoshust
am 2. März 2017 - 15:15

By default, Docker for Mac ships with the default filesystem being aufs. This is a fairly antiquated filesystem and is quite slow if you deal with lots of files and filesystem reads and writes. You can see the results of a filesystem benchmark to compare.

The easiest task to do to get better filesystem performance in Docker is to switch to the overlay2 filesystem. This achieves better performance by optimizing how layers are created and managed.

The first step to do is to check that you are in fact currently not using overlay2. Open up command line and type:

docker info | grep "Storage Driver"

The output will most likely be Storage Driver: aufs. Let's change this to overlay2.

Cleaning out your closet

Since switching filesystems will change the location of where all of the docker images and containers are stored on your machine, switching the driver will cause you…

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

In this article we will be going to share how we have handled Magento 2 upgrades, noting any common gotchas, and issues we have run into.Ensuring a smooth as possible upgrade is incredibly important to us.

Note: that this assumes you are using composer for your project, and that your installation is created using composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition [your/dir] [version].

This guide also assumes you are running this on a local installation before running on a staging or production environment (we have a few tips for this at the end of the article too!).

Step One. Read the release notes.

Every release will contain detailed release notes, it's important to get familiar with the areas that are changing in each release. You can find these over on the devdocs: Magento 2 release information

Make notes on the areas…

geschrieben von
am 28. Februar 2017 - 22:08

Here’s a fun pestle command I forgot about.

pestle.phar magento2:search:search_controllers

This command accepts a file path as a single argument, searches through the specified folder for anything that looks like a Magento controller file, and then displays that controller file’s execute method along with its relative file path.

Pipe the resulting output to a file or text editor, and you can quickly search through all Magento’s controller files. For example, today I forgot the syntax for adding a custom handle to a layout update XML file – but with magento2:search:search_controllers the syntax was and a “Ctrl-F handle” away.

$ pestle.phar magento2:search:search_controllers //... vendor/magento/module-backend/Controller/Adminhtml/Denied.php -------------------------------------------------- function execute() { if (!$this->_auth->isLoggedIn()) { /** @…
geschrieben von
am 28. Februar 2017 - 18:40
This entry is part 3 of 3 in the series Pestle. Earlier posts include Pestle 1.1.1 Released, and Pestle 1.1.2 Released. This is the most recent post in the series. Today we’re going to talk about pestle’s new magento2:generate:schema-upgrade command. To do that, we need to talk a little bit about Magento 1, as well as “migrations” in information systems more generally. Information Systems Most e-commerce, content management, and CRM software can be broadly classified as information systems. An information system (IS) is any organized system for the collection, organization, storage and communication of information. More specifically, it is the […]
geschrieben von Hrvoje Ivancic
am 28. Februar 2017 - 13:02

If you’re looking for a way to improve your user’s experience in terms of speed – try Fastly.

What is Fastly?

Fastly is a modern CDN service – it uses SSD disks in their cache servers to ensure fast content access & great cache hit ratio, it offers over 30 POP (point of presence) locations placed on strategic places all over the world (Asia, Europe, North & South America, Australia, New Zeland), it uses reverse proxying which means that the content is being fetched from your origin server as it’s requested and on top of that – they have greatly supported extensions for Magento 1 & Magento 2.

Benefits
  • Faster load times for web and mobile users
  • Better site stability in the event of traffic surges…
geschrieben von
am 27. Februar 2017 - 20:35
This entry is part 2 of 2 in the series Pestle. Earlier posts include Pestle 1.1.1 Released. This is the most recent post in the series. We can neither confirm nor deny that we’re filled with a positive emotion that PR folks typically call excitement or happiness that pestle 1.1.2 is now available. Existing pestle users should be able to run pestle.phar selfupdate and pestle will update itself. If you’re new to pestle the GitHub README has the low-down on why you’ll want it, and how to install it. If you run into any problems getting started please let us […]
geschrieben von Dmytro Cheshun
am 27. Februar 2017 - 14:24

Magento uses notification messages to improve user experience. You can simply add any message using the Message Manager to notify users whether the result of an action is successful or not.

In this blog post we will cover one type of the notifications – Admin System Messages. This type of notifications will be shown in a pop-up block and will be present in the admin panel as a reminder for an admin user until a special condition is met. These notifications can vary from messages about invalidated indexes to vulnerability issues. Adding custom system messages can be helpful and we are going to show you how to do it in few simple steps.

To add a custom system message you need to:

  1. Register a new message in the message list;
  2. Create a model class for the new message, which implements few necessary methods for further message handling.

The "\Magento\Framework\Notification\MessageList" class is responsible for…

geschrieben von
am 24. Februar 2017 - 23:00
UI Component Item `source` Nodes are Redundant:

I finally got an answer out of Magento engineering on those nodes and their best guess is as good as ours. i.e., they’re redundant/not-used.

There’s a few interesting points to make here for folks just learning to program, and just getting settled into the industry.

The first is software projects often grown beyond what any individual can understand, even (or especially) if that person works at the company responsible for that software. This is why programmers clammer for best-practices and consistency in their framework code. The ability to quickly trace out why something works a particular way is more important than any particular implementation, and inconsistent or over complex systems make that impossible.

The second is, when you find something that doesn’t work right, you’ll…