Book Image

Magento 2 - Build World-Class online stores

By : Fernando J Miguel, Ray Bogman, Vladimir Kerkhoff, Bret Williams, Jonathan Bownds
Book Image

Magento 2 - Build World-Class online stores

By: Fernando J Miguel, Ray Bogman, Vladimir Kerkhoff, Bret Williams, Jonathan Bownds

Overview of this book

Magento is the leading e-commerce software trusted by world`s leading organizations. Used by thousands of merchants for their transactions worth billions, it provides the flexibility to customize the content and functionality of your website. Our Magento Course will help you gain knowledge and skills that are required to design & develop world class online stores. Magento 2 Development Essentials - This book begins by setting up Magento 2 before gradually moving onto setting the basic options of the Sell System. You will learn Search Engine Optimization aspects, create design and customize theme layout, and adjust the Magento System to achieve great performance. Magento 2 Cookbook – This book is divided into several recipes, which show you which steps to take to complete a specific action. It will cover configuring your categories and products, performance tuning, creating a theme, developing a module etc. At the end of this book, you will gain the knowledge to start building a success website. Mastering Magento 2 - This is a comprehensive guide to using the all new features and interface of Magento 2 to build, extend, and design online stores. This book is your roadmap to managing your Magento store which teaches advanced and successful techniques. Focusing on Magento's Community version, this book offers you advanced guidance on managing, optimizing, and extending your store while taking advantage of the new features of Magento 2. This Learning Path combines some of the best that Packt has to offer in one complete, curated package. It includes content from the following Packt products • Magento 2 Development Essentials by Fernando J. Miguel • Magento 2 Cookbook by Ray Bogman and Vladimir Kerkhoff • Mastering Magento 2 by Bret Williams and Jonathan Bownds
Table of Contents (6 chapters)

Chapter 2. Magento 2.0 Features

Magento has many features to provide a great experience to the users and developers. Understanding what Magento can provide is the key to success in the development of Magento. All Magento developers seek for improvements in this area.

On the Magento Connect site (https://www.magentocommerce.com/magento-connect/), you can search for uncountable extensions to improve your Magento solution: Checkout, Cart, Order Management, Gifting, Pricing, and Promotion, and a lot more. At this point, it is crucial to understand that Magento has a native solution and how its features can help you think of some great solutions for development.

In the previous chapter, you learned the fundamentals to create a basic local Magento environment to work with book projects. In this chapter, you will learn how Magento manages and improves system sell processes.

The following topics will be covered in this chapter:

  • Magento features
  • Magento architecture
  • Magento order management
  • Magento command-line utility configurations

Have fun!

The revolution of Magento 2.0

Magento Commerce has promoted important changes between its 1.x and 2.0 versions. Some usual problems of the Magento 1.x version were fixed in this new version. The following processes/modules have received improvements in Magento 2.0:

  • Performance
  • Payment method
  • Checkout
  • Catalog
  • CMS
  • Web API
  • Framework
  • Setup

All good software or systems pass through incremental improvements for evolving according to its production environment; it couldn't be different with a commerce platform that powers over 250,000 online stores worldwide.

Magento 2.0 CE has a flexible architecture and a modular code base; it has a modern theming and an extensive Application Programming Interface (API). To get a better performance, Magento 2.0 compresses JavaScript files and images and gives support to Apache Varnish integration on the server side to enable faster performance.

Security is another subject treated in the Magento 2.0 system. According to its official documentation (http://goo.gl/E7sPm3), Magento 2.0 has had substantial enhancements in its security layer:

  • Enhanced password management
  • An improved prevention of cross-site scripting (XSS)
  • Restricted permissions for file access
  • An improved prevention of click jacking exploits
  • The use of non-default admin URL

Extensibility and modularity allow Magento to be highly customizable. As an objected-oriented solution, Magento follows good architectural principles and coding standards that provide high cohesion and loose coupling.

The following diagram illustrates Magento's architecture and how the components are integrated:

The revolution of Magento 2.0

Magento works with PHP Standards Recommendations (PSR). The PSR establishes the following good programming practices:

  • PHP extensions: This allows Magento to work with some PHP extension solutions that are required by Magento, for example, PDO and Memcache.
  • PSR-0—Autoloading Standard: This enables class autoloading on the PHP code. It's highly recommended to use PSR-4 instead of PSR-0, but the PSR-0 standard illustrates only the Magento architecture standards.
  • PSR-1—Basic Coding Standard: These are some good practices to write the PHP code.
  • PSR-2—Coding Style Guide: This extends PSR-1, adding the layout code presentation.
  • PSR-3—Logger Interface: This exposes eight methods to write logs to the eight RFC 5424 levels (debug, info, notice, warning, error, critical, alert, and emergency).
  • PSR-4—Autoloading Standard: This describes a specification for autoloading classes from file paths.

    Tip

    To know more about this, access http://www.php-fig.org/psr/.

On Magento Framework, we have some libraries and dependencies of this architecture. Zend Framework (ZF) is a very important layer of this architecture; once Magento was written in ZF; as we saw earlier.

Finally, we have Web Users (frontend/backend), Service Consumers (API and endpoints), Service Layers (interfaces/contracts), and Models (resources and database).

On the Web Users layer, we can define Magento's main processes as:

The revolution of Magento 2.0
  • Products: This manages the configuration of products in Magento, such as catalogs, inventory, categories, and attributes
  • Marketing: This manages promotions, communications, and SEO
  • Content: This manages the pages content
  • Customers: This manages and gets information about customers
  • Sales: This manages cart process, checkout, orders, shipping, and payments
  • Reports: This generates reports and statics of e-commerce

We will discuss these topics in the coming chapters, but now, I'd like to introduce to you one of the most important processes of any kind of e-commerce: the Sales layer or Magento Order Management. This is one of the most important things to understand the Magento development core.

An introduction to the Magento order management system

An introduction to the Magento order management system

On the e-commerce systems, the sell process is one of the most important features of every online business, providing a good e-commerce life cycle.

Some processes will be triggered when a customer confirms his order. Magento collects all the customer data and processes the request turning it into an order. This book will only cover the basic concepts of this process, but it's very important to understand them to develop consistent Magento extension solutions (we will see about this in Chapter 6, Write Magento 2.0 Extensions – a Great Place to Go).

Let's take a look at the Magento sales operations basics.

Sales operations

Let's play with the Magento admin area. In your favorite browser, enter the URL http://localhost/packt/admin-packt. Now, enter with your login credentials to access the admin area:

Sales operations

In Magento 2.0, you can manage sales operations by accessing the Sales menu in the admin area. Magento gives you the possibility to configure the following Sales options:

Sales operations

These options give you the power to manage your sales system as you want. Though it's, it's important to explore some Magento tools, extensions, and techniques to take full advantage and make improvements on your sales system to gather techniques to develop your own solution:

Sales operations

We have many options to make improvements on sales operations. You can configure up-sells and cross-sells features, for example, to give your customer more ways to order on your store. To do so, take advantage of a search engine optimization, work with a multilingual store, a geo-targeting, responsive design, and a simplified checkout process.

A simplified checkout process

In this section, we'll see how to implement a simplified checkout process on our store.

Orders

As a system administrator, you can access the admin area (http://localhost/mymagento/admin) to get all the customer order information, generate the product tracking code, invoices, and send a message to your customer. Magento stores all the order data on the admin area | Sales | Orders.

As an admin, Magento gives you the option to order products directly for your customer. On Magento, we have a persistent cart, print invoices, credit memo, and transactions.

Payments

You have a few options of payment methods in Magento. Magento has a native support to Google Checkout and PayPal. They both are payment gateways that provide the entire sell transaction environment to your store.

Basically, you choose your payment method and choose how you will pay for your product: credit card or deposit.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

Sales operations

Let's play with the Magento admin area. In your favorite browser, enter the URL http://localhost/packt/admin-packt. Now, enter with your login credentials to access the admin area:

Sales operations

In Magento 2.0, you can manage sales operations by accessing the Sales menu in the admin area. Magento gives you the possibility to configure the following Sales options:

Sales operations

These options give you the power to manage your sales system as you want. Though it's, it's important to explore some Magento tools, extensions, and techniques to take full advantage and make improvements on your sales system to gather techniques to develop your own solution:

Sales operations

We have many options to make improvements on sales operations. You can configure up-sells and cross-sells features, for example, to give your customer more ways to order on your store. To do so, take advantage of a search engine optimization, work with a multilingual store, a geo-targeting, responsive design, and a simplified checkout process.

A simplified checkout process

In this section, we'll see how to implement a simplified checkout process on our store.

Orders

As a system administrator, you can access the admin area (http://localhost/mymagento/admin) to get all the customer order information, generate the product tracking code, invoices, and send a message to your customer. Magento stores all the order data on the admin area | Sales | Orders.

As an admin, Magento gives you the option to order products directly for your customer. On Magento, we have a persistent cart, print invoices, credit memo, and transactions.

Payments

You have a few options of payment methods in Magento. Magento has a native support to Google Checkout and PayPal. They both are payment gateways that provide the entire sell transaction environment to your store.

Basically, you choose your payment method and choose how you will pay for your product: credit card or deposit.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

A simplified checkout process

In this section, we'll see how to implement a simplified checkout process on our store.

Orders

As a system administrator, you can access the admin area (http://localhost/mymagento/admin) to get all the customer order information, generate the product tracking code, invoices, and send a message to your customer. Magento stores all the order data on the admin area | Sales | Orders.

As an admin, Magento gives you the option to order products directly for your customer. On Magento, we have a persistent cart, print invoices, credit memo, and transactions.

Payments

You have a few options of payment methods in Magento. Magento has a native support to Google Checkout and PayPal. They both are payment gateways that provide the entire sell transaction environment to your store.

Basically, you choose your payment method and choose how you will pay for your product: credit card or deposit.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

Orders

As a system administrator, you can access the admin area (http://localhost/mymagento/admin) to get all the customer order information, generate the product tracking code, invoices, and send a message to your customer. Magento stores all the order data on the admin area | Sales | Orders.

As an admin, Magento gives you the option to order products directly for your customer. On Magento, we have a persistent cart, print invoices, credit memo, and transactions.

Payments

You have a few options of payment methods in Magento. Magento has a native support to Google Checkout and PayPal. They both are payment gateways that provide the entire sell transaction environment to your store.

Basically, you choose your payment method and choose how you will pay for your product: credit card or deposit.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

Payments

You have a few options of payment methods in Magento. Magento has a native support to Google Checkout and PayPal. They both are payment gateways that provide the entire sell transaction environment to your store.

Basically, you choose your payment method and choose how you will pay for your product: credit card or deposit.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

Promotions

With the products prices defined, you can set up promotions in advance. Promotion systems are very useful to establish a solid relationship with the customer.

In Magento, it is possible to define catalog price rules and shopping cart rules. Basically, you can define price behavior according to your promotions and customer defined rules, such as postal code, and certain value of discount.

You can provide coupon codes for your customers to raise Magento sells.

Magento 2.0 command-line configuration

Once you have installed Magento 2.0 CE, you will need to configure some options and manage the system life cycle according to your specific needs. You can start your Magento configuration and administration using the command-line utility.

Let's see how this feature works.

The command-line utility

Magento 2.0 has a command-line utility to help developers manage installation and configuration tasks. The new command-line interface can do the following:

  • Install Magento
  • Manage the cache
  • Manage indexers
  • Configure and run cron
  • Compile code
  • Set the Magento mode
  • Set the URN highlighter
  • Create dependency reports
  • Translate dictionaries and language packages
  • Deploy static view files
  • Create symlinks to LESS files
  • Run unit tests
  • Convert layout into XML files
  • Generate data for performance testing
  • Create CSS from LESS (CSS real-time compilation)

To work with this tool, you will need to open a terminal (Linux, OS X) or command prompt (Windows) and access the <your Magento install dir>/bin directory. Then, enter with the php magento command to see all the available commands of the command-line utility:

The command-line utility

Note

Remember to configure the PHP path to the system environment variable to execute the command. For further information, access http://php.net/manual/en/faq.installation.php.

Let's play a little bit with the utility by disabling your Magento system cache:

  • Run the php magento cache:status command. The cache will probably be enabled.
  • Run the php magento cache:disable command to disable any cache system.
    The command-line utility

    Note

    To know more about cache management in command-utility tools, access http://goo.gl/c5ivCY.

Now let's try to manage Magento indexing. Magento indexing transforms the data to improve the performance of your system by executing the following commands. Indexing technique optimizes the price calculations process, for example, and it has an important role to play in the Magento performance:

  • Run the php magento indexer:info command to view the lists of indexers
  • Run the php magento indexer:status command to view the real-time status
  • Run the php magento indexer:reindex command to rebuild the indexation
    The command-line utility

Magento indexing was successfully rebuilt, thanks to the command-line utility actions!

You can build cron jobs in a remote server to automate some Magento actions. For example, create an automation routine to re-index Magento periodically.

I strongly advise you to play more with the command-line utility. You can consult the online documentation available at http://goo.gl/iVnQSn.

Summary

We started this chapter to get the real bases of Magento power. It's important to get solid concepts, before you eagerly jump and begin developing Magento solutions. Take a moment to understand the scope of your project. This will make Magento development a much more rewarding experience.

Magento has a solid structure to develop your own solutions. You can automate some tasks using the Magento command-line utility and optimize Magento resources to get better results.

In the next chapter, we will work with Magento search engine optimization.