Magento2 – Write Custom Mysql Query (Without Using Model)

How to create custom “Duplicate” buttons for Adminhtml Edit Form and save custom module in Magento2.?

Create file to add button in VenderName/ModuleName/Block/Adminhtml/Edit/SaveAndDuplicateButton.php

Modify _construct function in Edit class to add button in

Add sub-query Magento 2 Collection

Magento 2 how to add new column in quote_item table?

You can add column like this

 

Add Date picker in phtml file Magento 2 Admin

For Datepicker :

For Date Time Picker :

Add custom Javascript in Magento admin form

Magento is flexible enough to insert your custom JavaScript code snippets in forms created by your very own Magento modules & extensions.

 

How to log all Magento 2 SQL queries?

In your app/etc/di.xml, replace the line:

with

 

Magento 2 – How to get value in “core_config_data” table

First you need to include the Magento\Store\Model\ScopeInterface class in your constructor:

Then in your class’ method you can call the following: