Tested on version 2.3.5
Branch for Magento 2.1 - 2.3
Master branch for Magento 2.3
- Copy the content of the repo to the Magento 2: app/code/Magestudy
- Run command: php bin/magento setup:upgrade
- Run Command: php bin/magento cache:flush
(On installing on Magento 2.2 need to uncomment rows at Magestudy\ProductExtensionAttribute\Setup\InstallData.php)
Shows how create simple CRUD: grid and form (ui component) without deprecated methods
Shows how create and update Configuration in Magento 2 (programmatically)
Admin panel: Menu - Stores - Settings - Configuration - Magestudy example
Shows how create console command in Magento 2
Command 1: magestudy:first_test_command
Command 2: magestudy:fullname FirstName LastName
Shows how create controller in Magento 2
Links:
yourDomain/index.php/controller/hello
yourDomain/index.php/controller/hello/world
yourDomain/index.php/controller/test
yourDomain/index.php/controller/test/check
Shows how to create Cron tasks and Cron groups in Magento 2
Result in /var/log/.debug.log: "Cron task was started at ..."
Answer on question: How are scheduled jobs configured?
Shows how use events in Magento 2
Documentation
Links:
yourDomain/index.php/event/example/index
yourDomain/index.php/event/example/second
Shows how use repository pattern in Magento 2
Shows how create menu in Magento 2 admin panel
Admin panel: Menu - MAIN LABEL
Shows how create simple page (frontend) in Magento 2
Link: http:://YOUR_SITE.domain/index.php/page/test/
Shows how create REST API in Magento 2
Links for test in \Magestudy\Rest\Model\Shop.php
Shows how create Unit test in Magento 2
In \dev\tests\unit\phpunit.xml (remove .dist if file name is phpunit.xml.dist)
Add line: ../../../app/code/Magestudy/UnitTestExample/Test/Unit
To block: testsuite
Run command in console:
- Go to magento directory (like: cd /home/admin/web/mage23.local/public_html/dev/tests/unit)
- Run command: php ../../../vendor/phpunit/phpunit/phpunit
Shows how use RequireJS and Knockout.js (bindings) in Magento 2
Result in console: yourDomain/index.php/customjs/test
Frontend: yourDomain/index.php/customjs/test/simple
Admin panel: Menu - CRUD
Frontend, url: yourDomain/index.php/crud
- Validation;
- Image loading;
- Table relations;
- UI Component;
- Event;
- Custom form validation;
- Highlight rows in grid;
- Create DB schema;
- Admin menu;
- Repository pattern.
Note, this module contains a lot of unnecessary abstractions for Adminhtml controllers.
SimpleCrud extension has simple and clean controllers.
magestudy:get_product
magestudy:save_product
magestudy:set_product_price
magestudy:set_product_title
magestudy:set_product_image
###Cases:
Login as customer adds next message: "This text added before customer authenticate."
Create new customer: "This text added after customer create account."
Shows how add new customer (custom) attribute to grid and create/edit form.
Answer on question: How do you add another field to the customer address entity using a setup script?
Shows how add custom fields in Stores->Settings->Configuration
Backend: Stores -> Settings -> Configuration -> Magestudy example -> Field with custom model
Shows how add new tab (page, menu item) in customer account (frontend).
Answer on question: Describe how to customize the “My Account” section. How do you add a menu item?
Shows how add new button in customer edit page (admin panel).
Shows how add new tab\page\menu item in customer edit section (admin panel).
Shows how create new payment method in Magento 2.
Shows how create simple shipping method in Magento 2.
Shows how hide/remove menu items in (frontend) customer account page in Magento 2 (programmatically)
Shows how add button to product create/edit page in Magento 2
Shows how create custom logger and write data to new file in Magento 2
Sample of injection and using here: Magestudy\LoggerExample\Helper\Data
Shows how to configure and create a SearchCriteria instance using the builder for repositories
Sample here: Magestudy\SearchCriteria\Controller\Hello\Index.php
Frontend url: .../index.php/SearchCriteria/hello/index
Shows how to use Extension Attributes
Frontend url: .../index.php/ExtensionAttribute/hello/index
Shows how to use Extension Attributes for products
Added sales information to product object (before test need to create order for selected product)
Frontend url: .../index.php/ProductExtensionAttribute/hello/index
Sample here: Magestudy\ProductExtensionAttribute\Controller\Hello\Index.php
Shows how create simple widget
- Go to CONTENT -> Widgets -> Add Widget
- Select "Magestudy Sample Widget" as type and choose your theme
- Click on continue and fill all fields (in "Widget Options" set some data to label and limit)
- Go to CONTENT -> Pages -> Home Page: add widget to page
- Go to main page for result
Shows how to use mixins in Magento 2:
Answer on question: How do you customize the order history page?
An implementation of RouterInterface to create a custom router.
Frontend url: .../index.php/sample
Migrate install/upgrade scripts to declarative schema
Develop data patches
Added new field to recently viewed widget
Add new params to use in JS files
Added new fields (Reference and Contents) to the tracking form.
Add new product image role programmatically
MIT