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</stylesheet></action>
<action method="addItem" ifconfig="my_config_section/advanced/load_js"><type>skin_js</type><name>js/my_module/my_module.js</name></action>
</reference>
Related cards:
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 : Admin Module Part 2
5.Create Model and Resource model
Address model class extends the AddressInterface and it contains the data object getters setter methods.
<?php
/**
* Address
*
* @copyright Copyright © 2021 Va...
Magento 2 : How to add a column in Order Grid and Order
Following steps explain how to add new column in order and grid tables
1) Add the columns in order, quote and grid tables using declarative schema
**2) Add arguments to Magento\Sales\Model\ResourceModel\Order\Grid virtual class that alrea...
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 : 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...
Magento 2 : Admin Module Part 1
1. Create required folders and files for a module
Vasan
--KpsAddress
--Api
--Data
--AddressInterface.php
--AddressSearchResultsInterface.php
--AddressRepositoryIn...
Magento 2 : Data cleaning and import
Following example shows how to clean customer and order records and import customer data from another database
## Following query to identify the name of the attribute and attribute id
select * from live.eav_attribute where entity_type_i...
Magento 2: GraphQl
How to create a query with single input and output
Following graphql is defined schema.graphqls with Integer input and String output
type Query {
testing(id: Int!): String @resolver(class: "Vasan\\TesterGraphQl\\Model\\Resolver\\Te...
Magento 2: Create new customer attribute
How to create a new custom attribute to Customer
This article explain the custom customer attribute creation and showing that in account creation and account edit
Magento Customer module is developed with EAV attributes
if a attribute is cr...
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