geschrieben von
am 4. Mai 2017 - 19:02

I’m writing this down so I can remember it later – if you’re not deep into Magento service contracts apologies for the word soup.

When Magento’s parsing doc block’s for parameter types, it’s only looking at interfaces – or possibly its only looking at the type it knows about. i.e. if you have something like this

<route url="/V1/pulsestorm_apitest2/things/:id" method="GET"> <service class="Pulsestorm\Apitest2\Api\ThingRepositoryInterface" method="get"/> <resources> <resource ref="anonymous"/> </resources> </route>

Magento is going to look at Pulsestorm\Apitest2\Api\ThingRepositoryInterface for the type implementations and not the concrete class you have configuration via di.xml. In other words, if you put your @param int $id in the concrete get methods instead of the interface, Magento wont’ be able to find it will…

geschrieben von Roman Glushko
am 4. Mai 2017 - 13:30

Having a particular version of the software easily discoverable makes hacker’s job easier and allows automated scrapers to gather a database of URLs with particular software versions that can be used at an event of security vulnerability discovery for attacks. Of course, hiding the Magento version won’t be enough to secure your store, but it is just a simple step to take, just like changing your admin URL that makes store a little bit more secure.

In Magento 2, the Magento_Version module allows to retrieve Magento version and edition by a GET request. It consists of one simple controller action that has the following route:

magento_version/index/index

This action gets required information and renders it:

# Magento\Version\Controller\Index\Index public function execute() { $versionParts = explode('.', $this->productMetadata->getVersion()); if (!isset($versionParts[0]) || !isset($versionParts[1…
geschrieben von Tomas Novoselic
am 4. Mai 2017 - 12:01

Many times we need to show some sort of information in modal overlay when customer comes to the site.
We can use it for many kind of purposes like newsletter subscription form, coupon codes or just some
general information.
In this article I’ll show you how to create the most basic functionality around this.

The challenge

When customer comes to our site, we want to show load specific static block content
into the modal overlay and show it only once to every customer.

Solution:

We should start by creating new module in Magento 2.

For that purpose start by creating app/code/Inchoo/ModalOverlay/registration.php
with following content:

<?php /** * @category Inchoo * @package Inchoo_ModalOverlay * @copyright Copyright (c) Inchoo (http://inchoo.net/) */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Inchoo_ModalOverlay',…
geschrieben von Tea Pisac Benes
am 2. Mai 2017 - 13:23

So you have been running an eCommerce site for some time now but in order to increase sales, natural thing to do is to increase traffic towards your site. Regardless of your site’s SEO health and organic ranking, PPC traffic is also something you shouldn’t miss out, because hey, your competitors are also doing it and being within the first 3 organic results today (if you are lucky) isn’t the same like a few years ago.

Paying for incoming clicks is natural thing to do but before you continue (start) investing money in driving traffic to your site, pay attention to these three essential things that we noticed many site owners miss out.

1. Functionality & usability check

Yeah, you played a giant role in setting everything up on your store and making sure it works for your visitors (because you are the one who knows your business the best). But stop just for a second and think about when did you do your last serious…

geschrieben von Damir Serfezi
am 27. April 2017 - 16:58

Most of the time working with Magento, a single database connection is just enough. Magento has excellent system of adding new tables in database or extending existing ones. So, why would there be a need for an external database connection outside the Magento system? Well, one of the examples is data migration from another ecommerce system. In this article, a simple connection to external database is explained with CRUD (create, read, update, delete) examples.

Configuration

This external database connection is similarly defined as the Magento default one – in an XML configuration. The difference is that foreign connection is defined inside particular module’s XML configuration. It defines read and write adapters, setup and database credentials information. Foreign tables are defined in the same way as magento tables. They are under inchoo_foreignconnection_resource node so the model resource can be invoked later in the code. For demonstration…

geschrieben von
am 26. April 2017 - 22:33
Fooman's Magento Imagine 2017 Wrap Up:

Another developer oriented Magento Imagine 2017 wrap up. Include the slides from Kristof’s talk on Magento and composer.

geschrieben von
am 26. April 2017 - 21:37

Over in my Patreon slack, a patron came to me with the following layout handle XML chunk.

This block of XML would successfully remove the block named breadcrumbs, but it would not successfully remove the block named product_list_toolbar.

This is one of those places where Magento’s lack of documentation and/or a cogent systems philosophy really bites practitioners in the butt. Even as an experienced M2 developer, my mind came up with multiple possible causes

  • That was <remove/> in M1, will <remove/> work in M2?
  • Is remove=true something that works by coincidence but isn’t supported?
  • Is remove=true something the works for only blocks or works for only containers? (you can use referenceBlock and referenceContainer interchangeably in Magento’s core)
  • Is handle loading order to blame here?

Worse – because…

geschrieben von
am 25. April 2017 - 18:46
Magento 2 Module for Custom Reporting Grids:

Haven’t tried it yet, but this looks like a Magento 2 module that will let you easily create new Reporting Grids with a simple SQL statement.

geschrieben von
am 22. April 2017 - 22:03
Imagine2017 Summary from Yiero Founder Jisse Reitsma:

A nice, succinct wrap up of Magento’s announcements at Imagine 2017. Lots of third party service acquisitions for EE users, not much public-news/investment on the open-source/CE/independent-developer side of things.

geschrieben von Robert Popovic
am 20. April 2017 - 8:23
magebase-analytics-snapshotmagebase.com, the domain and this website is for sale!

To the left is a snapshot of the current 2017 traffic to the site. In its heyday, Magebase was consistently attracting over 1000 sessions per day, this has diminished only due to inactivity but the site is well established and can be managed to attract a solid audience with up-to-date Magento 2 articles, etc.…

geschrieben von
am 19. April 2017 - 19:11
Headless Magento 2 Resources:

“Headless Magento” – that is, an ecommerce store whose user interface uses some other technology stack for the UI/UX (i.e. javascript) while relying on Magento’s REST API endpoints for store functionality – is a hot topic in the Magento world. While this approach can explode a project’s budget (you’re reimplementing the a front-end store and any extension functionality) it is, none-the-less, popular with agencies looking to put their javascript engineering teams to work.

If your sales team has thrown you in the headless deep-end, the sitewards/headless-magento2-resources and ishakhsuvarov/going-headless GitHub repositories are two small projects that are tracking resources for developers looking to implement a headless Magento 2 system.

geschrieben von Igor Furseev
am 19. April 2017 - 11:04

Magento 2 Command-line interface (CLI) tools differ from those in Magento 1. In Magento 1 you could simply add a script to the “shell” directory, include abtract.php, and extend from it. Magento 2 is a bit more complicated. This post will show you how to create a simple CLI script in Magento 2.

First of all we will need to declare a module (you can use an existing one, if you have it). We need to create: registration.php, composer.json (actual path: app/code/Atwix/Shell/composer.json), and etc/module.xml:

<?php /** * @author Atwix Team * @copyright Copyright (c) 2017 Atwix (https://www.atwix.com/) * @package Atwix_Shell * * path: app/code/Atwix/Shell/registration.php */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Atwix_Shell', __DIR__ ); { "name": "atwix/shell", "…
geschrieben von Ivan Curdinjakovic
am 18. April 2017 - 13:29

How time flies! It’s been almost a year and a half since we released Inchoo_PHP7 extension for Magento 1 (https://github.com/Inchoo/Inchoo_PHP7), and announced that in a blog post (http://inchoo.net/magento/its-alive/).

We were just scratching our own itch – wanting to use all the performance benefits PHP 7 brought to run Magento faster. But, as the cover image of that post inadvertently prophesied, we created a monster that escaped, and is continuing to terrorize the villagers to present day.

So, what happened in the meantime?
  • M1 is still going strong. M2 will take over eventually, but, in my humble personal opinion, that’s going be a very slow process.
  • On the other hand, PHP 7 is overtaking PHP 5 much quicker than previous versions used to replace their predecessors. (https://…
geschrieben von PAJ
am 18. April 2017 - 12:43

In part one of the Alexa PHP Hello World example we created a very basic skill and a PHP app to show how to handle Amazon Alexa IntentRequest data and provide a response. In part two let’s extend the code to allow us to create interactive prompt and responses.

In this example we ask Alexa for a “clever quote”, Alexa will give us the quote and ask if we want another. If the user replies yes, Alexa reads another quote and prompts again until all the available quotes have been used.

Alexa Clever Quotes Alexa Prompt and Response

To allow this prompt and response interaction we simply tell our skill to keep the session open when we require a response, and we store the data we need for the session in the session attributes…

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

Last week: Boolean Expression Engine

To the Kata description
Scroll down to this weeks Kata description

I was determined to build a real compiler for exercise, knowing that it would be a bit over the top for this particular challenge. The first step was a lexer that converts an input string to a list of tokens.

So

(x&y)|z

became

Token::openingBracket(), Token::variable('x'), Token::and(), Token::variable('y'), Token::closingBracket(), Token::or(), Token::variable('z')

At this point it’s pure syntax checking without context, so “)(&&&1” would be tokenized without errors, so I could implement it with a backtracking algorithm. Using TDD worked well here.

The next step…

geschrieben von Toni Pap
am 10. April 2017 - 14:42

There always comes the time when shopkeeper decides that he want’s to inform his customer of shipping estimate on checkout, so they could know approximately when they will get their goods. And for that, many shops today rely on API-s like ones from USPS or FedEx. Both of which are available for Magento.

In this article I will be showing you how to override FedEx carrier to return shipping estimate for given rates.

Overriding carrier

FedEx carrier works by sending request with given flags to FedEx server, who then, based on given flags, prepares response. After Magento receives response, it parses each rate as “Mage_Shipping_Model_Rate_Result” which he will later pass on to “Mage_Sales_Model_Quote_Address_Rate”. From which we will be able to access in template to show in frontend. For that, we will first override “Mage_Usa_Model_Shipping_Carrier_Fedex”.

geschrieben von Fabian Schmengler
am 6. April 2017 - 9:11

With PHP 7 you can choose to write much more type-safe code than before, thanks to scalar type hints and return types.

function repeat(string $text, int $times) : string;

But what about arrays? There’s still only the generic “array” type hint, you cannot specify what’s in the array. For the IDE, you can add PhpDoc comments:

/** * @return User[] */ function allUsers() : array;

Now IDEs like PhpStorm can help with code completion for items in the returned array. But we cannot benefit from any checks at runtime, like with real type hints.

For arguments, there is a partial workaround, using variadic arguments. Take the following function

/** * @param User[] $users */ function deleteUsers(array $users);

With variadic arguments we can rewrite it to

function deleteUsers(User ...$users);

Usage also changes, to deleteUsers(...$users); In this call, the argument $users will be “unpacked” into single…

geschrieben von Katarina Dijakovic
am 5. April 2017 - 12:33

As designers, we’re often faced with a lot of questions about our process. We never just dive into design and bask in the glory of amazing typography and brilliant color schemes because without the phases that precede it – it just wouldn’t even begin to be possible.

Beam me up, designer

The worst feedback you can give to a designer is commenting how pretty the design is. We don’t aim for pretty, can’t learn from it and our clients aren’t always satisfied with just pretty. In the end, if our clients’ customers don’t see the use in the pretty that we’ve created – the webshop will fail at some point.

Our process includes mechanisms that minimise that risk and allow us to make informed decisions for a successful webshop. Before the actual design phase, we go through planning and wireframing.

At this point we answer some of the questions that even we can’t answer just by being designers. We have best practice knowledge and experience…

geschrieben von Hrvoje Ivancic
am 4. April 2017 - 13:35

In the previous article I wrote on how to register a Fastly account and install & configure Fastly module for Magento 2 in order to improve your store performance.

In this article I’m going to talk about how to fine tune Fastly’s service performance by configuring Origin shielding and timeout settings.

Origin shielding

Origin shielding is Fastly’s service feature which reduces the load on your origin server by routing all requests to a specfic Point of Presence (POP) which you have designated as a shield node to your origin.

How shielding works

With shielding enabled, when the first request for content arrives at one of the POP’s, for e.g…