Magento 2 provides a great feature that allow admin user to select which column in a grid that they want to see. In this post, I will show you how to do that with Magento 2 admin grid. Before go to the main point, I want to list some of my previous post in this […]
Category: Latest Magento 2 Tutorials
How to Create Widget in Magento 2 – Magento 2.3
There are 5 steps to create a new widget in Magento 2 (Magento 2.3) Step 1: Initialize widget Step 2: Create a widget template Step 3: Create a widget block Step 4: Flush Cache Step 5: Post Widget Step 1: Initialize widget File directory: app/code/Magestore/HelloMagento/etc/widget.xml
1 2 3 4 5 6 7 8 9 10 11 12 |
<?xml version="1.0" ?> <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:hellomagento:Magento_Widget:etc/widget.xsd"> <widget class="Magestore\HelloMagento\Block\Widget\Posts" id="magestore_hellomagento_posts"> <label>New Widget</label> <description>Posts</description> <parameters> <parameter name="posts" sort_order="0" visible="true" xsi:type="text"> <label>New Widget</label> </parameter> </parameters> </widget> </widgets> |
Step 2: Create a widget template File directory: app/code/Magestore/HelloMagento/view/frontend/templates/widget/posts.phtml […]
How to Translate a String by Code in Magento 2 – Magento 2.3
In this topic we will show you How to Translate a String by Code in Magento 2 through 5 steps: In .ptml files In email template Strings added in UI components’ templates Strings added in UI components configuration files Strings added in .js files Hello everyone. In Magento 2 (even for the Magento 2.3), you […]
How to Run Enable/Disable Maintenance Mode in Magento 2 – Magento 2.3
Hello, everyone. Maintenance Mode is an important mode in Magento 2. In case you want to temporarily disable your website to update or fix bug, then you should give your website to maintenance mode. So today I will show you the command line of Magento 2 to enable or disable maintenance mode. 1. Main keynotes First, […]
How to Create Simple Grid Listing in Magento 2 Admin with UI Component – Magento 2.3
Here are the steps that you will follow in this Create simple grid listing in Magento 2 admin with UI component: Step 1. Create company_staff_listing.xml Step 2. Create StaffDataProvider Step 3: create model Create simple grid listing in Magento 2 .In my last post in this series, we have learnt “How to Register a module […]
How to Add a Custom Discount in Magento 2 (Magento 2.3)? – Magento 2 Custom Discount
Here are the steps that you will follow in this How to add a custom discount in Magento 2 (Magento 2.3)? – Magento 2 Custom Discount: Register a total in the file sale.xml Add discount to change the grandtotal in the model Add the total in the layout file View model knockout Add a Custom Discount […]
How to Setup Cron Job in Magento 2? (Magento 2.3)
Here are the steps that you will follow in this How to setup cron job in Magento 2? – Magento 2 cron job: Create file etc/crontab.xml Please go to the ssh console and run the command: php bin/magento cron:run Hello everyone. As you know, Cron is a Linux utility which schedules a command or script on your […]
How to Get Value of Custom Attribute on Magento 2 Rest API? – Magento 2.3
Here are the steps that you will follow to get value of custom attribute on Magento 2 Rest API in Magento 2 tutorial: 1. Create new column and set value for the existing order. 2. Create a specific new file. 3. Create an observe. 4. Create a file to handle the event. 5. Delete folder to apply […]
How to create an event in Magento 2? – Magento 2 events (Magento 2.3)
As you know, I had a guide “How to use Magento 2 events” before. Now I will help you how to create an event in your extension for Magento 2. This guide is so easy to do, so let’s enjoy it with these easy steps. Now I have a simple example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php .. $event_data_array = ['cid' => '123']; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $eventManager = $objectManager->create(‘\Magento\Framework\Event\Manager’); $this->_eventManager->dispatch('my_custom_event', $event_data_array); .. ?> |
As you can see […]
How to use Magento 2 event? – Magento 2.3
Here are the steps that you will follow in this How to use Magento 2 event (Magento 2.3)?: Create a file events.xml in app/code/[Namspace]/[Module_Name]/etc Create observer file SaveAfter.php in app/code/[Namspace]/[Module_Name]\Observer\Sales\Order Today, I want to share with you: how to use Magento 2 event with a small, simple example. The situation here is I want to do something after save […]