How to Create Frontend Multi-Select UI Fields

Here we are going to learn how to add Magento2 Multi-select field using the Ui Component on the frontend.
You can check categories multi-select files in admin how this going to work.

Okay, let go.

Step 1: Defining the frontend layout.xml file.

Continue reading “How to Create Frontend Multi-Select UI Fields”

Magento 2 how to overwrite an admin template

Create new custom module to overwrite the magento2 admin template. For example Here I’m going to overwrite admin order comment section. So let’s create module MageChallenge_SetupData. Next step is copy the admin layout file sales_order_addcomment.xml file from core and place in Our custom magento2 module. Okay, let’s create layout file.


Continue reading “Magento 2 how to overwrite an admin template”

Upgrade Schema in Magento 2

If you want to add a column, update the column to magento2 existing table then you can use upgrade schema (UpgradeSchema.php).

Okay, let’s check with example.

Im going to use module


Let’s create new file


Continue reading “Upgrade Schema in Magento 2”

How to create custom Log file in Magento2?

Magento2 providing some log files. Some cases, we should create custom log files . you can easily track errors, exceptions, and more using log data.

Try to write your own logger extending Monolog with very little effort. I’m using MageChallenge_SetupData as my module. In the very first step, we will create di.xml In my custom module,

Continue reading “How to create custom Log file in Magento2?”

Magento 2 Add Product Attribute Programmatically

Magento2 manages Product by EAV model, So we cannot directly add an attribute for the product by adding a column for the product table. Will check how we can achieve this.

I’m going to add custom_qty as custom product Attribute.

Create UpgradeSchema.php file under the Setup folder. using MageChallenge_SetupData

File path: app/code/MageChallenge/SetupData/Setup/UpgradeSchema.php

Continue reading “Magento 2 Add Product Attribute Programmatically”

Change column name for database table Magento 2?

In Magento 2 if you want to change/rename the existing column/field from the table.

Let’s assume I have a table custom_table1 and the table containing field post_user.

So what I’m going to do is change table field post_user to the author .

My module current version in 1.0.1. So Upgrade the setup_version number of the module.So I have added new version 1.0.2 in module.xml file

Continue reading “Change column name for database table Magento 2?”

Magento2 Configure custom Cron jobs

Using Magento2 Cron Jobs can run scheduled tasks like

  • reindexing
  • newsletters
  • generating emails,
  • sitemaps..etc.
  • In Magento2, it’s very easy to configure and saving in the database tables to run tasks at scheduled times.

Follow the below steps to create cron jobs.

Create crontab.xml file under /etc folder.

This file will defined the schedule and the cron class.

Continue reading “Magento2 Configure custom Cron jobs”

Rearrange the Action column of the Magento2 grid?

ActionsColumn in the Magento2 UI component has a configuration option called, “draggable” and It’s defaulted value is 0.

If you want the Action column to active drag and drop you need to activate this to true.

Let’s check with the code sample in magento2.

Create requirejs-config.js file in the following path

Continue reading “Rearrange the Action column of the Magento2 grid?”