Monday, October 23, 2017

Magento 2 is not saving the customer attribute

With Magento 2, even the trivial task of adding a custom attribute to a Customer can become quite challenging.

Today I spent significant time to trace the issue and resolve it, so I want to share my experience with all current and future generations of Magento 2 developers to help to save some time.
Read more

Thursday, December 29, 2016

Practical Magento 2: Creating a simple plugin

In Magento 1, when we wanted to override a specific method from the Core, we usually needed to rewrite Core class in our module.

Magento 2 introduced a new possibility for overriding core functionality without causing potential rewrite conflicts. It is called "Plugins".
Read more
, , ,

Friday, September 9, 2016

Practical Magento 2: Create a custom Module - minimal structure

There is no need to create a custom module structure from the scratch manually. Using this great tool helps to make creation process faster:

1. download and install n98-magerun2 as described on above link.

2. navigate to Magento root directory using terminal 3. running command:

$ n98-magerun2.phar dev:module:create
will display the following message with instructions about parameters that can be used for Module creation:

dev:module:create [-m|--minimal] [--add-blocks] [--add-helpers] [--add-models] [--add-setup] [--add-all] [-e|--enable] [--modman] [--add-readme] [--add-composer] [--author-name[="..."]] [--author-email[="..."]] [--description[="..."]] vendorNamespace moduleName
For minimal module structure, we can run:

 $ n98-magerun2.phar dev:module:create -m Apiworks Minimal
which will produce the following output:

<config xmlns:xsi="" xsi:nonamespaceschemalocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Apiworks_Minimal" setup_version="1.0.0">


Read more
, , ,

Tuesday, February 9, 2016

Installing xDebug on Mac OSX with AMPPS

Hi Dear reader!

You may be wondering why I am writing yet another article about xDebug installation on Mac OSX, but in fact, I am writing this more because of myself as I want to remember the easiest way on how to build and install custom xDebug without additional troubles in short time. (As I am sure I will forget it if not in written form :-p)

Usually when installing xDebug to make it work with AMPPS on Mac OSX, I downloaded Komodo Remote Debugging Package and selected version which fit my PHP version and put in my PHP modules directory.

Everything was just fine during the time, until the moment I started to play with Magento 2. I switched the AMPPS PHP version to 5.6 and installed Komodo xDebug as usual. But when tried to debug in PHPStorm, some weird errors appeared and debugging was practically impossible ....

Read more
, ,

Wednesday, March 18, 2015

Magento 2 playground: Rendering Page View

Hi. To be honest, I just started to investigate Magento 2 and it's structure these days.
As starting point, I decided to follow this great article by Ash Smith about "Creating Simple Magento 2 Controller Module".

And everything was just fine until the moment I needed to render view from my newly created controller like in above post.

In fact, everything still worked fine, just one thing was not right:
Read more
, , ,

Tuesday, February 3, 2015

Magento REST API- filtering results

Like in SOAP web services, Magento also offers some kind of filtering results as part of REST web services.

We have sevaral possibilities available as described on official website.

Let's show sample REST request made to Magento (without filters):
 (Skipping part how we get oAuth token and saved it in session, because it is out of scope of this article ...)
Read more
, , ,

Saturday, January 31, 2015

Custom order holded status in Magento

Ever needed to add one more hold status in Magento?

For example:

Let's say that we have some order processing logic integrated with third party shipping provider. We make API call and it fails.

If we put order on regular onHold status, it will mix up with orders that are put onHold by site administrator and we will not be able to filter them later if we want to re-try processing etc.

I suppose that most convenient way would be to use "holded" state and create additional status, for example: "order_processing_error".
Read more
, ,