Book Image

Magento 2 Development Essentials

By : Fernando J Miguel
Book Image

Magento 2 Development Essentials

By: Fernando J Miguel

Overview of this book

Magento is the e-commerce software and platform trusted by the world's leading brands. Used by thousands of merchants for their transactions worth billions, it provides the flexibility to customize the content and functionality of your website. By strengthening your fundamentals in Magento development, you can develop the best solutions and take advantage of the growing market. This fast-paced tutorial will provide you with skills you need to successfully create themes, extensions, and solutions to Magento 2 projects. This book begins by setting up Magento 2 before gradually moving onto setting the basic options of the Sell System. You will take advantage of Search Engine Optimization aspects, create design and customize theme layout, develop new extensions, and adjust the Magento System to achieve great performance. By sequentially working through the steps in each chapter, you will quickly explore all the features of Magento 2 to create a great solution. With ample examples and a practical approach, this book will ensure your success with this astonishing e-commerce management system.
Table of Contents (16 chapters)
Magento 2 Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing Magento 2.0 templates


Magento works with .phtml template files to generate the view layer for the users. The modules and themes in Magento have its specific group of .phtml files to show data to the users. Let's create a custom template example in the CompStore theme to see how it works:

  1. Create the Magento_Catalog directory under the compstore theme directory.

  2. Copy the contents of vendor/magento/module_catalog/view/frontend/templates to app/design/frontend/Packt/compstore.

  3. Then, open the app/design/frontend/Packt/compstore/Magento_Catalog/templates/product/view/addto.phtml file in your favorite code editor.

  4. Go to Line 17 and enter the following code:

    <div><h2>Buy in CompStore!!!</h2></div>
  5. Save the file.

  6. Delete the var/view_preprocessed/ and pub/static/frontend/Packt/compstore/ directories.

  7. Deploy static content files by running the php magento setup:static-content:deploy command.

  8. If necessary, give write permission to the pub directory.

Navigate to the product...