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”
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?”
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”
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?”
In this post, we are going to learn about Command-line Interface(CLI) in Magento 2. There have a lot of commands in
bin/magento. I’m going to explain about adding our custom CLI in Magento 2.
Okay let’s run following command in terminal:
Continue reading “Adding new CLI Command Magento 2?”
Using Magento2 Cron Jobs can run scheduled tasks like
- generating emails,
- 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”
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?”
In this article, we are going to describe create a New Module Magento2 .what is the basic thing you need to know when creating a new module in magento2.
So we are using the sample module MageChallenge_SetupData to create a new module.
Create module.xml file
Continue reading “Create a New Module Magento2”
InstallSchema – this class will run when the module is installed to set up the database structure.
In this article, we will use the sample module MageChallenge_SetupData to create a demo table.
if you are not ready creating new module follow this link Create a New Module Magento2
Create a new file app/code/MageChallenge/SetupData/Setup/InstallSchema.php
Continue reading “How to Create a Setup Script in Magento 2?”
To remove a column from the magento2 grid we can set “componentDisabled” to True.
Okay, Let’s check with example. For example, I’m going to remove the following column from the magento2 order grid. you can apply whatever UI component grid if you want.
So let say we want to remove Purchase Point and Grand Total (Purchased)
Continue reading “Remove Column from Magento2 grid”