Magento 2 is a robust and feature-rich e-commerce platform with numerous actions and functionalities. However, I can provide a condensed cheatsheet outlining key actions across different areas of Magento 2 development. Please note that this is a simplified overview, and you may need to refer to Magento 2 official documentation for more in-depth information.
|
app/code/VendorName/ModuleName
|
Basic module structure
|
|
registration.php
|
Module registration file
|
|
etc/module.xml
|
Module configuration file
|
|
etc/frontend/routes.xml
|
Define frontend routes
|
|
etc/adminhtml/routes.xml
|
Define admin routes
|
|
execute()
|
Main controller action method
|
|
ResultInterface
|
Various result types (Json, Redirect, Page, etc.)
|
|
getRequest()
|
Retrieve request object
|
|
getResponse()
|
Retrieve response object
|
|
di.xml
|
Define plugin configurations
|
|
beforeMethod(), aroundMethod(), afterMethod():
|
Plugin methods
|
|
proceed()
|
Call the next method in the chain
|
|
bin/magento module:enable Vendor_Module
|
Enable a module
|
|
bin/magento setup:upgrade
|
Apply database schema and data changes
|
|
bin/magento cache:flush
|
Flushes cache including 3rd party modules
|
|
bin/magento cache:clean
|
Cleans Magento cache
|
|
bin/magento indexer:reindex
|
Reindex Data
|
|
load(), save(), delete()
|
Basic CRUD operations
|
|
__construct()
|
Constructor method
|
|
getData(), setData()
|
Get and set model data
|
|
getResource()
|
Retrieve model's resource model
|
|
<referenceContainer>, <referenceBlock>
|
Reference existing containers/blocks.
|
|
<block class="" template="">
|
Difine a block
|
|
<arguments>
|
Pass arguments to blocks
|
|
<update handle="">
|
Apply layout updates.
|
|
events.xml
|
Define observer events
|
|
execute(\Magento\Framework\Event\Observer $observer)
|
Observer method.
|
|
getEvent()
|
getEvent()
|
|
<?php echo $block->escapeHtml(__("Text")); ?>
|
Output escaped text
|
|
<?php echo $block->getUrl('route/controller/action'); ?>
|
Generate URL
|
|
<?php echo $block->getChildHtml(); ?>
|
Output child block content
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.