0% found this document useful (0 votes)
568 views

Magento 2 Development Essentials - Sample Chapter

Chapter No. 1 Magento Fundamentals Get up and running with Magento 2 to create custom solutions, themes, and extensions effectively For More Information : http://bit.ly/1RingAL

Uploaded by

Packt Publishing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
568 views

Magento 2 Development Essentials - Sample Chapter

Chapter No. 1 Magento Fundamentals Get up and running with Magento 2 to create custom solutions, themes, and extensions effectively For More Information : http://bit.ly/1RingAL

Uploaded by

Packt Publishing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Fr

ee

Magento, used by thousands of merchants for their


transactions worth billions, 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 the skills
you need to successfully create themes, extensions, and
solutions to Magento 2 projects.
This book begins by showing you how to set up Magento 2
before gradually moving on to 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 the end of the
book, you will have quickly explored all the features of
Magento 2 to create great solutions.
With ample examples and a practical approach, this book
will ensure your success with this astonishing e-commerce
management system.

What you will learn from this book


Install and set up the Magento ecosystem
Choose the best options for Magento's
Sell System features

Magento 2 Development Essentials

Magento 2 Development
Essentials

Develop extensions for new Magento


functionalities

C o m m u n i t y

Package extensions to publish in the Magento


Connect network

Fernando J. Miguel

Carry out performance adjustments to speed


up your Magento system

$ 29.99 US
19.99 UK

P U B L I S H I N G

Create and customize themes for Magento

Who this book is written for

community experience distilled

pl

Work with Search Engine Optimization


in Magento

Create Magento solutions for mobile devices


If you are a PHP developer who wants to improve your
skills in e-commerce development by creating themes and
extensions for Magento 2, then this book is for you.

Sa
m

D i s t i l l e d

Magento 2 Development
Essentials
Get up and running with Magento 2 to create custom solutions,
themes, and extensions effectively

Prices do not include


local sales tax or VAT
where applicable

Visit www.PacktPub.com for books, eBooks,


code, downloads, and PacktLib.

E x p e r i e n c e

Fernando J. Miguel

In this package, you will find:

The author biography


A preview chapter from the book, Chapter 1 'Magento Fundamentals'
A synopsis of the books content
More information on Magento 2 Development Essentials

About the Author


Fernando J. Miguel is a certified professional scrum master at the Scrum

Alliance, with experience in analysis and web application development since


2003. He has been working in project development using design patterns, MVC,
object-oriented programming, and Agile. He also has experience with content
management systems (CMS), WordPress, Joomla, Magento 2, PHP, Java, Node.js,
Android, SQL, NoSQL, and cloud computing.
Fernando has a bachelor's degree in information systems from Centro Universitrio
Mdulo, Brazil. He specializes in project management / PMI-PMBOK from
Universidade Cruzeiro do Sul, Brazil. He also specializes in health informatics
from Universidade Federal de So Paulo, Brazil, and he is currently pursuing a
master's degree in electronic engineering and computer informatics from Instituto
de Tecnologia e Aeronutica (ITA), one of the best technology institutes in Brazil.

Preface
Digital buyers are improving economies around the world, and information
technology (IT) provides the necessary subsides to allow customers to buy services
and products over the Internet. According to the research conducted by Statista
(http://goo.gl/BSCiuO), in 2016, 1.12 billion people worldwide are expected to
buy goods and services online.
Since the launch of Amazon.com, the first commercial-free 24-hour e-commerce
website, the universe of software development techniques has evolved, and new
approaches are emerging, such as cloud computingpreviously no more than an
embryonic idea, today a concrete application.
The Magento Commerce company, recognized as the leading e-commerce platform
in the 2015 Internet Retailer Top 1000, B2B 300, and Hot 100 lists, is in constant
evolution since the first Magento Community Edition (CE) system version in 2008.
Launched recently, Magento CE 2.0 has great features and takes advantage of the
newest client-server techniques providing a mature e-commerce system and a
promising professional area to explore.
Magento, used by thousands of merchants for their transactions worth billions,
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 showing you how to set 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
the end of the book, you will have quickly explored all the features of Magento 2 to
create a great solution.

Preface

With ample examples and a practical approach, this book will ensure your success
with this astonishing e-commerce management system.
Enjoy the read.

What this book covers


Chapter 1, Magento Fundamentals, teaches you how to create a basic environment,
install Magento 2.0, and study some Magento concepts.
Chapter 2, Magento 2.0 Features, helps you discover the features of Magento 2.0 and
configure some basic Magento options.
Chapter 3, Working with Search Engine Optimization, provides you with some
configuration tips to tweak the Magento options for SEO purposes.
Chapter 4, Magento 2.0 Theme Development the Developers' Holy Grail, gives you an
overview of theme development and techniques of customizing Magento 2.0.
Chapter 5, Creating a Responsive Magento 2.0 Theme, implements a practical project to
create your custom theme.
Chapter 6, Write Magento 2.0 Extensions a Great Place to Go, provides you with
development techniques by implementing a practical project to create your own
Magento extension.
Chapter 7, Go Mobile with Magento 2.0!, covers techniques of working with Magento
on mobile devices.
Chapter 8, Speeding up Your Magento 2.0, explains good practices to fine-tune your
Magento system and environment to gain performance.
Chapter 9, Improving Your Magento Skills, explores the tools and ways to improve your
skills in the Magento universe.

Magento Fundamentals
Magento is a highly customizable e-commerce platform and content management
system. Magento is one of the most used e-commerce systems to create online
stores around the world by providing management of inventory, orders, customers,
payments, and much more. It has a powerful scalable architecture.
Are you ready to start on the world of Magento development?
First of all, we will need to set up our environment. In this book, we will cover
how to set up a local environment. It is very important to have this local ecosystem
development to work smoothly and in an agile way.
In every chapter of this book, we will work with a mini project. It's kind of a sprint
to learn the path. In this chapter, our mission is to create a work environment and
understand the basic concepts of Magento (http://magento.com/).
After setting up the environment, you'll study the Magento folder structure and
work on a basic Model View Controller (MVC) software architecture pattern and
Magento basic setup.
Basically, we will work on this chapter with the following topics:

XAMPP PHP development environment

Magento e-commerce system

Magento system structure

Magento basic setup

Are you ready for fun some? Let's go!

[1]

Magento Fundamentals

XAMPP PHP development environment


The XAMPP is a complete web development environment. On its install package,
we can find Apache, MySQL, PHP, and Perl. This is everything that you will want
to develop your solutions!
At this time, you can imagine the meaning of XAMPP, but the X before the AMPP
has the meaning of cross or cross-platform. So, we have XAMMP: (X) Cross-platform,
Apache, Maria DB, PHP, and Perl.
The goal of XAMPP is to build an easy-to-install distribution for developers to get
into the world of Apache. XAMPP is a project of Apache Friends (Apache Friends
is a non-profit project to promote the Apache web server).
Why we are working with this software? Let's find out:

Apache (http://httpd.apache.org/): This has been the most popular


web server on the Internet since April 1995 providing secure, efficient,
and extensible HTTP services in sync with the current HTTP standards

MariaDB (https://mariadb.org/): This strives to be the logical choice for


database professionals looking for a robust, scalable, and reliable SQL server

PHP (http://php.net/): This is a popular general-purpose scripting language


that is especially suited to web development; and, most importantly, it is the
main language of Magento

Perl (https://www.perl.org/): This is a highly capable, feature-rich


programming language with over 27 years of development

So far so good, but how about doing some action?

[2]

Chapter 1

XAMPP installation
First of all, let's access the XAMPP website on https://www.apachefriends.org/.

XAMPP has three distinct versions for different operating systems (OS): Windows,
Linux, and OS X. Choose your preferred version to download, and start the
installation process.

XAMPP for Windows installation


XAMPP for Windows has three different kinds of installation files:

Installer: This is a classic Windows installation method

Zip: This method uses compressed files to install manually

7zip: This method uses compressed files to install manually

[3]

Magento Fundamentals

The (.exe) installer is the most popular process to install. Download it and execute to
start the installation process, shown as follows:

1. You can skip FileZilla FTP Server, Mercury Mail Server, and Tomcat for our
installation purposes but feel free to consult Apache Friends Support Forum
for further information at https://community.apachefriends.org.
2. On XAMPP, we have the option to use Bitnami (https://bitnami.com/
xampp), but for learning purposes, we will install Magento in a classic way.

[4]

Chapter 1

3. Complete the installation by pressing the Finish button.

4. In order to start XAMPP for Windows, you can execute xampp-control.exe


and start the Apache web server.
5. To test if everything is working, type http://localhosturl in your favorite
web browser. You will see the XAMPP start page:

[5]

Magento Fundamentals

XAMPP for Linux installation


XAMPP for Linux has two main versions of installation files:

32-bit version

64-bit version

Choose the file according to your architecture and follow these steps:
1. Change the permissions to the installer:
chmod 755 xampp-linux-*-installer.run

2. Run the installer:


sudo ./xampp-linux-*-installer.run

XAMPP is now installed below the /opt/lampp directory.


3. To start XAMPP, execute this command on terminal:
sudo /opt/lampp/lampp start

4. To test if everything is working, type the http://localhost URL in your


favorite web browser. You will see the XAMPP start page:

[6]

Chapter 1

XAMPP for OS X installation


To install XAMPP for OS X, you simply need to follow these steps:
1. Download the DMG image file.
2. Open the image file to start the installation process.
3. The steps are pretty much the same as Windows installation.
4. To test if everything is working, type the http://localhost URL in your
favorite web browser. You will see the XAMPP start page:

The XAMPP htdocs folder is the docroot folder of your server. Everything
that you save on htdocs can be accessed via any browser. For example, if you
save index.php inside the htdocs root, you can access this script by entering
http://localhost/index.php. If you save your file in the packt folder, you
can access it by http://localhost/packt/index.php. Piece of cake!

Magento
Magento is an open source content management system for e-commerce websites.
It's one of the most important e-commerce systems, which has grown fast since its
launch in 2008.
Basically, Magento works with two different types of Magento: Community Edition
(CE) and Enterprise Edition (EE). In this book, we will cover CE.

[7]

Magento Fundamentals

On a study provided by aheadWorks (https://aheadworks.com/) in October 2014,


Magento CE has taken the leading position among examined e-commerce platforms.

Now, we have solid concepts about "where we are going". It's very important to
have solids concepts about every aspect that you are working on in this moment.
Globally, e-commerce shows a remarkable potential market and Magento
professionals are welcome.

[8]

Chapter 1

Magento installation
First of all, we need to create a user account on the Magento website (http://www.
magento.com) to download Magento CE. Click on the top-menu link My Account
and after clicking the button labeled Register, fill out the form and confirm your
registration.
Once registered, you gain access to download Magento CE. You can access the
Products | Open Source/CE and VIEW AVAILABLE DOWNLOADS menus.

On this page, we have three important options:

Full Release (ZIP with no sample data): This is a complete download of the
last and stable Magento version

Full Release with Sample Data (ZIP with sample data): This is important
to create example products to our store for testing.

Download with Composer: This is the dependency management


installation tool

[9]

Magento Fundamentals

Choose the Full Release with Sample Data (ZIP with sample data) option for
downloading Magento. Extract the compressed files in the XAMPP htdocsfolder
and rename the folder to packt.
Remember to start Apache and MySQL services on the XAMPP
panel before the installation.

Before starting the Magento installation, we'll need to create a new MySQL database
instance to store the Magento data. phpMyAdmin is a MySQL web app to manage
your database and can be accessed at http://localhost/phpmyadmin/.
Click on the Databases menu and the Create database option to create the
packt database.

Now, let's start our Magento installation. On your browser, access


http://localhost/packt/setup.

[ 10 ]

Chapter 1

By now, you will see this installation page on your browser:

Let's start the Magento installation by following these steps:


1. Readiness Check: Check the environment for the correct PHP version,
PHP extensions, file permissions, and compatibility.
2. Add a Database: Fill the database form with your connection information.
By default, you can follow the suggestions given here:

[ 11 ]

Magento Fundamentals

3. Web Configuration: Enter you store address and admin address here:

4. Customize Your Store: In this step you provide the time zone, currency,
and language information:

5. Create an Admin Account: Enter with personal login information and set the
admin address to packt-admin.
After all these steps, we are done! Congratulations! We have our first
Magento installation!
You can access your new site by accessing the URL at http://localhost/packt:

[ 12 ]

Chapter 1

And you can access the admin area by accessing the URL at http://localhost/
packt/admin-packt:

For more information about Magento installation, access http://devdocs.


magento.com/guides/v2.0/install-gde/bk-install-guide.html.

Magento MVC architecture


MVC is an architectural software pattern that works with three different but
interconnected parts. Its principal mission is to abstract the development work
into interdependent layers providing the best practices to documentation and
organization of software projects.
The Magento e-commerce solution is written with the PHP Zend framework,
which is one of the most powerful PHP frameworks. For more information,
access http://framework.zend.com/.

[ 13 ]

Magento Fundamentals

Magento is a configuration-based MVC System. For example, when you develop a


module (we will check this in the next chapters), besides creating new files and
classes to your module, you need to also create a config.xml file. This file contains
all the configuration data for Magento module. These practices abstract some
important information that you can easily edit to set the module as you need.

In this book, we will cover only the very basic Magento software architecture
concepts, but it's highly recommended that you to study more software design
patterns, especially in our case MVC software architecture needs to be understood
well to best experience the field of software development.

Summary
You've now seen what Magento can do; you have installed Magento too. You started
to understand the basic concepts of Magento, and certainly, you'll get more experience
in developing your own Magento solutions by working in the projects of this book.
In the next chapter, we'll work with some Magento Sell System features.

[ 14 ]

Get more information Magento 2 Development Essentials

Where to buy this book


You can buy Magento 2 Development Essentials from the Packt Publishing website.
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet
book retailers.
Click here for ordering and shipping details.

www.PacktPub.com

Stay Connected:

You might also like