Fundamentals of Magento 2 Development - Exercise
Fundamentals of Magento 2 Development - Exercise
Fundamentals of Magento 2 Development - Exercise
1.4. Create a new module. Make a mistake in its config. Create a second module
dependent on the first.
2. Development Operations
2.1. Mode
1. Make sure the mode is set to Developer.
2. Then, go into the lib\internal\Magento\Framework\App\Bootstrap.php
file and throw an exception in the method, run().
3. See whether the exception is displayed on your screen. If it is, you
have successfully set the mode. If not, review your steps.
2.2. Cache
1. Under what circumstances will cleaning the var/cache folder not
work?
1
4. Plugins
5. Events
2
1.1. Find a place in the code where output is flushed to the browser. Create an
extension that captures and logs the file-generated page HTML. (“Flushing
output” means a “send” call to the response object.)
2. Request Routing
2.1. Create an extension that logs into the file list of all available routers into a
file.
2.3. Modify Magento so a “Not Found” page will forward to the home page.
3.2. Customize the catalog product view controller using plugins and preferences.
3.3. Create an adminhtml controller that allows access only if the GET parameter
“secret” is set.
3.4. Make the “Hello World” controller you just created redirect to a specific
category page.
4. URL Rewrites
3
1.1. In the core files, find and print out the layout XML for the product view page.
2.5. Create a template block and a custom template file for it. Render the block in
the controller.
3.4. Change the block color to orange on the product detail pages only.
4
3.5. On category pages, move the exercise block to the bottom of the left column.
3.6. On the custom action you just added, remove the custom block from the
content.top container. (See Exercise 3.1)
3.7. Using layout XML, add a new link for the custom page you just created to the
set of existing links at the top of every page.
5
1. Databases Overview
1.1. Echo the list of all store views and associated root categories (category
name).
1. Get a list of stores using:
Magento\Store\Model\ResourceModel\Store\Collection
2. Get root category IDs using:
Magento\Store\Model\Store::getRootCategoryId()
3. Create a category collection and filter it by the root category IDs.
4. Add the category name attribute to the result.
5. Display stores with the associated root category names.
3.1. Create a table with an install script for the module Training_Vendor.
1. Give Training_Vendor a setup_version of 0.0.1.
2. Create the Setup folder.
3. Create the InstallSchema class.
4. Create a training_vendor_entity table using DDL methods.
5. Execute the installation using the console tool.
6. Verify that it works by checking the setup_module table.
4. Attribute Management
4.1. Create a text input attribute (1) from the Admin interface.
1. Add it to an attribute set.
2. Check that it appears on the product edit page.
3. Make it visible on the storefront product view page
4.2. Create a text input attribute (2) from an install data method.
6
4.3. Create a multiple select product attribute from an upgrade data method.
1. Create a multiselect product attribute.
2. Set the backend_model property to
Magento\Eav\Entity\Attribute\Backend\ArrayBackend
3. Add a few options to the attribute.
4. Make it visible in the catalog product view page.
7
8
3. Web API
3.3. Create your own Data API class and make it available through the Web API.
- Make it anonymous and test how it works through the REST.
9
1. Grids
10
- For this table, create a grid with columns that correspond to the fields.
- Make release_date column optional (not visible by default).
- Create filters that correspond to fields (text for name, dropdown for
type, from-to for trial_period, date for release_date).
2. Adminhtml Forms
3.2. Menu
- Create a submenu in the Catalog/Product menu called “Games”. It
should lead to the games grid created earlier.
3.3. ACL
- Create a new page in Admin that renders “Hello World”.
11
https://oyenetwork.com/articles/magento2-devliery-date-module-creation-from-scratch/
1.2.
12