Practice Tasks

  1. Create a MINIMAL module. Describe what is the minimal code and declarations you need to add to accomplish that?
  2. Create a module and make it dependent on the module created in the previous task. then disable the first module and describe that will happen.
  3. For the class \Magento\Catalog\Model\Product, it’s getPrice() method:
    – create a plugin that will modify price
    – create a preference that will substitute the core class with your own
    – make sure that your plugin still works. 
  4. Create a custom module and do the following:
    – create an observer to the event “controller_action_predispatch”
    – get a URL from the request object and log it.
  5. Find a place in the code where output is flushed to the browser ($response->send()). Create an extension that captures the output, and logs the URL, the controller action name, and the content of the tag <title> in the rendered page.
  6. Create an extension that logs a list of all available routers to a log file. Modify it to render a page that shows that list.
  7. Create an extension with a custom router that understands URLs like /frontname-actionpath-action and converts them into /frontname/actionpath/action.
  8. Modify Magento so that “not found” state would forward to the home page.
  9. Modify the frontend catalog product view controller action so that each product has “EXCLUSIVE!” text as a prefix for the product name.
  10. Create an admin panel controller that allows access only if a GET parameter “secret” is equal to “yes”
  11. Create a block extended from \Magento\Framework\View\Element\AbstractBlock. Render it in a new controller action.
  12. Create and render a text block in a new controller.
  13. Customize the product view description block in order to modify the product description and have “Description:” being output before each description.
  14. Define which template is used in \Magento\Catalog\Block\Product\View\Attributes and override it in your extension.
  15. Create an additional content in the top of the content of every page (block with a custom template. Pass a background color as a block argument in the layout XML, and use that value in the template for rendering.
    Change the background color to a different one only for product detail pages.
    On category pages, move the block to the bottom of the left column.
  16. Create a custom controller action. For that page, set a one column layout, and set a title of the page using layout XML. For this page, remove the block created in the previous task. Add the link to this page to the top links.
  17. Create a custom page on the frontend that lists all store views and associated with them root categories.
    Use a Store collection to fetch all store views, Category collection filtered by specific root categories fetched from the stores.
  18. Create a custom module that adds logging of every product save, including the product ID, SKU and the data that has been changed
  19. Create a DB table with your custom module using install schema logic:
    – create a DB table using DDL
    – execute setup using console tools
    – check the module version within setup_module DB table
  20. Upgrade the DB table created in the previous task:
    – create an upgrade schema class
    – add an additional column to the table using DDL adapter methods
    – increase the module’s version
    – run the appropriate console command
    – verify that the field was added and the module version has increased in the setup_module DB table
  21. Add a data fixture to the data table created and upgraded in the two previous tasks:
  22. – make sure you have a model/resource model in your module that corresponds the table data structure
  23. – create an upgrade data class
  24. – increase the module’s version
  25. – run the appropriate console command
  26. – verify that the fixture data was added on the module upgrade and the module version has increased in the setup_module DB table
  27. Create a custom module that adds a new attribute to the product called “subtitle
  28. – add it to the default attribute set
  29. – give it a varchar type
  30. – make sure that it appears on the product edit page in admin panel and saves successfully
  31. – make it visible on the product view frontend page.
  32. Write an upgrade class for the module created in the previous task that adds another multiselect attribute to the product
  33. – create the attribute called  “alternatives
  34. – set a proper backend model that allows to handle an array of options in the admin panel
  35. – add several predefined options to the attribute
  36. – make it visible on the product view frontend page.
  37. Customize the frontend rendering for the attribute created in the previous task:
  38. – create a custom frontend model
  39. – make it that the attribute is being rendered as an HTML list rather than a comma-separated list
  40. – randomize the output.
  41. Create a custom select attribute for the customer:
  42. – use a data upgrade class for creating a custom attribute
  43. – name the attribute “priority” and make it of “select” frontend input type
  44. – assign a custom source model
  45. – implement a custom source model that allows to select a number from 1 to 10
  46. – test that the attribute works as expected

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s