• Add select/dropdown in a Magento 2 UI component admin grid

    Please check our previous article to add an image column to your admin grid.

    If you’ve created an admin grid, you most likely in Magento 1 or Magento 2, you most likely have used select field. This particular type of column uses the label text defined for a specific value as text in the grid column. This is usually used for Yes/No fields, Active/Inactive or more options like Countries list fields....

    The data stored in the database will be raw and while it might make sense to a programmer, it might not make any sense to the user/admin....

  • Display image in a Magento 2 UI component admin grid

    If you have an image in your admin form and would like to display the saved image in the listing grid, follow the steps below:

    A typical UI component admin grid, will look as shown below:

    <?xml version="1.0" ?>

    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">

    <argument name="data" xsi:type="array">...

    ......

    </argument>...

    <settings>...

  • How to fix the issue not a registered handle in Magento 2 admin grid

    I recently added a custom grid in a custom module, like I’ve done hundreds of times before. The process I followed was identical to how I created my Magento 2 admin grids before, but this time I did something, or rather didn’t do something, because of which when I visited my grid page in the admin I got the following error message:

    Not registered handle *_listing_data_source

    At first I was not sure what the issue was, cause I was of the belief that I had done everything I used to do before and this wasn’t even a new Magento 2 version with breaking changes....

  • How to add mass action to Magento 2 admin grid?

    Having a grid in your custom Magento 2 module, more often than not means you will have mass actions. Below, we will see how we can add mass actions to our custom grid in Magento 2.

    For those of you who do not know, mass actions are actions available in the grid which can be applied to multiple grid items at once, instead of having to apply them to each item individually.

    For example, changing status of the grid line items. When changing status you may want to change the items of batch of items instead of just a single item. Mass actions come in handy when you want to do this. It allows you to select the items you want the action to apply to, and then apply the mass action, which will filter the grid items and apply the action to each of the selected items....

  • How to create a module in Magento 2

    In this article we will discuss how to create a module in Magento 2. Magento 2 modules are the building blocks that make the Magento what it is.

    So what is a Magento module?

    A module is just a directory with a bunch of files organized in a certain way that make up a specific business feature. Modules ideally encapsulate one specific business features and may dependencies on other modules.

    A module is used to to implement a new functionality or extend an existing functionality....

    How do I create a module?...

  • Dependent fields in UI component forms in Magento 2 without Javascript for boolean fields

    In this article, we will discuss a simpler method of handling field dependencies when the parent fields are boolean (meaning the values are either 0 or 1). The switcher config discussed in the earlier tutorial can handle these cases as well, but the switcher config is bigger in size and the method I am going to show you in today’s article is much smaller.

    Note: This method will only work on parent fields with boolean values and for values other than 0 or 1, you can use the switcher config method. The field can be a dropdown, a switcher, or any other field whose values are going to be either 0 o 1....

  • Dependent fields in ui-component forms in Magento 2 without Javascript

    This article is going to show you how to define field dependencies between ui-component form fields. There are several articles out there explaining how to do it using Javascript, however, there is nothing really that explains how to do it without Javascript, by just using XML. Most of the cases are usually simple and using Javascript for handling field dependencies would be more than what’s necessary. For such cases, you can use the solution discussed in this article....

    This method is going to use something called as the switcherConfig that is available in Magento. switcherConfig allows you to define rules for handling actions on field value updates. It doesn’t necessarily have to be show/hide, but you can use different callbacks and pass arguments to the callbacks, thus allowing you to handle basic to moderate level of actions on fields by just using the XML schema....

  • Only non-interlaced images are currently supported issue

    This is a pretty common issue when you use png images throughout your site, because of which you also use the png image for logo of PDFs in Magento 2.

    The stack trace might look something like this:

    1 exception(s):

    Exception #0 (Zend_Pdf_Exception): Only non-interlaced images are currently supported.

    Exception #0 (Zend_Pdf_Exception): Only non-interlaced images are currently supported.

    <pre>#1 Zend_Pdf_Resource_ImageFactory::factory() called at [vendor/magento/zendframework1/library/Zend/Pdf/Image.php:124]...

  • How to return JSON response from Magento 2 controller?

    When writing custom code for Magento, if there is data involved, more often than not, a controller needs to be created. The controller handles the request and returns an appropriate response. The response could be several different things, but if the request is an ajax request, then we can be pretty certain that the response returned is most often in the JSON format.

    So how do we return response from the controller in a specific format?...

    When I initially started developing for Magento 2, I thought returning an array would suffice and Magento will take care of the rest. But I was wrong. Although Magento 2 can handle several different types of requests, they need to be returned in a certain way for the controller to send the response in the format needed....

  • Magento 2 - load model by custom field

    This is a simple tutorial showing how to load a model using a custom field rather than loading by the primary key. There are several situations the primary key isn’t the only unique field and we may have other fields in the table which are unique and are used more often to load the model. To name a few, Customer entity has email as the unique field and the Product entity has SKU. These fields are used quite often to load a single database row into the model....

    This tutorial will show you how to do that for an existing or custom model....

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
Live chat: cookie consent required

Copyright © Hungersoft 2019

· Terms & Conditions · Privacy policy