There are several ways to create customers in Magento 2. A customer can create an account on their own using the sign-up form, a customer can be created through the admin interface, and there is even a built-in Magento 2 import feature that can mass import a huge number of customers from a CSV file, provided that the customer data in the CSV is import-ready.
But what if we have thousands of customers whose data still needs to be processed before they can be created? The best way to do this would be to create the customers programmatically.
In this article, we are going to cover the topic of creating customers programmatically, and to this purpose, we are going to create a simple Magento 2 module which is going to have a custom console command and a couple of models that are going to be used to read, process and create customers. Read more
Logging is an important part of every development process. Logs provide insight into system processes of Magento 2 and are a great tool for tracking errors, significant events, exceptions and many more. In order for the logging library to be properly implemented with Magento 2, it must comply with PSR-3 standard.
Magento 2 comes with built-in logging solution based on Monolog Library which will be analyzed further in this article. Read more
Recently I was working on rendering images on a custom template. More precisely, I created a widget for inserting pictures that serve as a picture loader. And by default, the administrator has to input some parameters (width, height, alt) and if he decides, he could upload another image.
Reference for creating a widget tutorial could be seen here. The exciting part of the task was when the widget is saved on some of the Magento pages and loaded on i.e. ‘About Us’, image or images and parameter values have to be saved in the cache.
So when you visit ‘About Us’ another time, image content will be served instantly.
In this article, we’re going to save simple custom data inside the cache and load it when Magento renders the template. Read more
Magento 2 introduced a new and improved way for adding products to the cart. The system now offers complete asynchronous (ajax) process, although the process itself is not activated in default application state. It requires some manual adjustments in the script call inside the templates. Someone would think, ok, we will simply modify the template script calls and that’s it! We successfully improved the process. Unfortunately, not so fast! There is still more room left for improvement. If you’re interested, let’s find out what’s left on the table. Read more
Hello, in this article we will cover how to add custom entries in existing system configuration located in Stores->Configuration. Read more
We have already covered how to create Magento2 module, so here we will go straight to the point. Replace Inchoo/Test from entries in this article to your module name.
This article will cover the fundamentals of validating any form in Magento 2.
The contact form on Contact us page will be used and modified for the purpose of the article. The form itself can be found in the following paths, depending on the type of installation you are using: Read more
The Fastly CDN will sometimes return a 503 error due to various issues that can occur. The generic text associated with a 503 error is “Service Unavailable” and it can mean variety of things. This default error response can be confusing to the customers and have a basic look and feel. Read more
Out of the box, Magento 2 offers fair amount of search engine optimization options but when it comes to category pages, we only have option to add canonical meta tags. In today’s blog post, we will try to spice that up a bit by implementing our own variation of canonical tag and by adding rel=”next” and rel=”prev” tags to help bots with paginated content. Read more
When it comes to Magento customization, every now and then, there’s a need for a custom configuration option that needs to be placed somewhere in the administration menu. Magento 2 comes with well organized admin menu, but what if newly created configuration option doesn’t fit anywhere? Read more
Compared to its previous version, Magento 2 came out with a new concept of dependency injection where classes inject dependencies (different objects) for an object instead of that object manually creating them internally. That way overriding and manipulating with classes is much easier and allows us more ways of extending the native functionalities. Read more
Despite the good amount of attributes offered in Magento by default, there is often a need to add some new ones to the system for a particular EAV entity. Today I’m going to show you how to programmatically add a new category attribute. Read more
In one of our previous articles we learned how to create a widget. Now we will see how we can create a custom one, or even better, how to extend the core one. For this example I picked default catalog product listing widget that I will extend with sorting fields for better customization of this widget. Read more
One of the best parts in Magento is its admin interface. There is support for all kinds of input types (text fields, radio buttons, dropdowns, multiple selects, etc.), that can be stored in various ways (plain, encrypted, serialized), and displayed in numerous ways (grids, forms, simple fields, images).
What makes Magento great is the possibility to extend this default interface (especially store configuration part), and add our own fields easily. Let’s extend it with a custom file upload field. Read more
We’re going to build a very simple module in Magento 2. When finished, the module’s output will say “Hello world!” in the block content on a custom frontend route. Read more
Remember that time when you wanted to create a Magento shell or php script to perform some action, but didn’t know where to put it?
Remember the /shell folder in root Magento installation (or root folder, for that matter)?
Remember how it used to have, like, 50 shell and php scripts all mixed up, and you get a headache just by looking at them?
Pepperidge Farm remembers.
Those were good old times, and like all good times, they have now come to pass. There’s a new kid on the block, more powerful and way cooler, and the best part is – it’s integrated into Magento 2. Read more