Magento 2 Tips : System Configuration field dependent on multiple values
How to show a field dependent on another field multiple values
<depends>
<field id="vasan/general/enable">1</field>
<field id="vasan/email_dispatch/receiver" separator=",">2,3</field>
</depends>
Related cards:
Magento 2 Tips: main.WARNING: Session size of 257209 exceeded allowed session max size of 256000.
This can be fixed by excuting folloing configuration.
./bin/magento config:set system/security/max_session_size_admin 512000
./bin/magento config:set system/security/max_session_size_storefront 512000
Magento 2 : Address additional attributes
In this example, you can learn how to add additional attributes for customer address
Steps
- Add additional attributes to EAV table
- Create extension attributes to link with models to save additional attributes values in databases
- Crea...
Magento2 : Admin Module Part 3
This section contains the edit UI components and layout xml files
Stesps :
- Form ui components
create a file kpsaddress_index_lising.xml for grid under ui_component
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http...
Magento 2 Notes
1) Non Auto Increment Primary key
The $_isPkAutoIncrement should be assigned as false in resource model, when a primary key of a table is used as non auto increment.
protected $_isPkAutoIncrement = false;
2) Custom Cron Job
F...
Magento 2 : Create cron with config schedule
Step 1:
Create system.xml file with configuration field.
<group id="cron" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>MSD Cron</label>
...
Magento 2 : Multi Store configuration
Sometime , we need to create multisite application using magento 2 framework.
Following example shows the nginix confgiration of multisite application with magento website or store
In this example contains three sites and each has different dom...
Magento 2 : How to use Javascript in Magento
Javascript in Magento 2
Magento 2 uses Require JS lib and Knockout JS lib to solve the page speed and manage the JS dependency.
As JS are loaded asynchronously in backend, it helps to increase the page speed.
The JS files can be found in f...
Magento 2 Tips : Conditionally Loading Javascript and css in layout xml
First create your conditions in the system.xml..
Second add your css and js in your local xml.
<reference name="head">
<action method="addCss" ifconfig="my_config_section/advanced/load_css"><stylesheet>css/my_module/my_module.css</st...
Magento 2 Tips : Date Format
use Magento\Framework\Intl\DateTimeFactory;
=====================================
$endDate = $this->dateTimeFactory
->create($milestone->getData('end_date'), new \DateTimeZone('UTC'))->format('d/m/Y');
==========================...
Magento 2 : Custom Email Sending
Email can be sent in magento customization with following implementation
First, The email template should be created in view section and registered in etc using email_template.xml
email_template.xml
<?xml version="1.0"?>
<config xmlns:xsi...