Changing magento template file / content on the fly
The template file or content of the magento page can be changed on the fly using observer.
For example, if you want to change the product listing in the category view , just write observer for render before event and remove the specific block and add new block or just replace the template file with new template file with new content.
$categoryProductBlock->setChild('product_list',$specificBlock);
Related cards:
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 : 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 : How to write a controller to download a file
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Response\Http\FileFactory;
use Magento\Framework\Filesystem\DirectoryList;
use Magento\Framework\App\Action\Action;
use Magento\Customer\Model\Session;
class DownloadPres...
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 : 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...
magento 2: Docker compose file
Docker compose file for magento 2.4
version: '3.3'
networks:
pwa_net:
ipam:
driver: default
config:
- subnet: 40.0.0.0/24
gateway: 40.0.0.1
services:
web-cont:
image: registry.vasan.com/mag...
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 Oreder Creation other than the base currency
How to create order programmatically other than the basic currency?
Step 1) After create your Quote object set the currency code that you want in the order
--------------------------------------------------------------------------------------...
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...
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...