35,18 €
Maximize the power of Magento 2 to create productive online stores
Key Features
Book Description
The long-awaited release of the world's most popular online solution, Magento 2, is now out with an all new interface and several enhancements. This book offers you advanced guidance on managing, optimizing, and extending your store while taking advantage of the new features of 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. From planning your Magento installation through to advanced techniques designed to make your store as successful as possible, this book is your roadmap to managing your Magento store. Focusing on Magento's Community version, the book covers everything from creating and managing multiple stores to fine-tuning Magento for speed and performance. You'll learn how to manage categories, products, design themes, extensions, and more.
What you will learn
Who this book is for
This book is for web designers, developers, or e-commerce store-owners who design or manage Magento stores for their clients and want to gain an in-depth understanding of the various features of Magento 2.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 385
Veröffentlichungsjahr: 2016
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2012
Second published: June 2016
Production reference: 1220616
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-236-4
www.packtpub.com
Authors
Bret Williams
Jonathan Bownds
Reviewer
Andre Gugliotti
Commissioning Editor
Wilson D'souza
Acquisition Editor
Aaron Lazar
Content Development Editor
Arun Nadar
Technical Editor
Vivek Pala
Copy Editor
Pranjali Chury
Project Coordinator
Ritika Manoj
Proofreader
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Jason Monteiro
Production Coordinator
Melwyn Dsa
Cover Work
Melwyn Dsa
Bret Williams, for over 20 years, has engineered the creation of hundreds of websites, including many profitable e-commerce properties and several Internet firsts. Beginning with version 1.3 of Magento CE, Bret began an odyssey of becoming one of the foremost experts on leveraging Magento to build successful online businesses. Today, as CEO of novusweb llc, Bret continues to provide e-commerce management services from his office in Austin, Texas. Bret authored the wildly popular Mastering Magento, and he is the co-author of Magento 2 Administrator's Guide (Packt Publishing) with his wife and business partner, Cyndi. His company also owns MageDaily.com, a Magento news and reviews blog, and MageRevolution.com, which sells Magento enhancements.
I would like to extend his sincere thanks to the team at Packt Publishing for helping bring this book to life. I am also thankful to Jon Bownds for being a great writing partner and source of in-depth technical knowledge about Magento 2. Magento—the company and people—are to be commended for creating an extraordinary platform for building e-commerce businesses that succeed. Last, but certainly not least, I would like to thank my wife of 36 years, Cyndi, for allowing me the time and environment to write.
Jonathan Bownds is an e-commerce professional living in the sunny climes of Austin, Texas. He got his start working in technology around 1998, and he promptly gravitated toward Linux, system administration, security, and open source projects. He's been embroiled in something related to one of these topics ever since.
He is currently a partner at Praxis Information Science (www.praxisis.com), a web development company that specializes in tackling interesting Magento problems and helping merchants make a go of it in the wild and woolly frontier of e-commerce.
Beside work, he enjoys spending time with his wife and two boys, playing tennis, reading, and in an ongoing search for the best breakfast taco in Texas.
I would like to thank Bret Williams for the opportunity to work on this book, and his invaluable guidance during the entire process. In addition, I'd like to thank Packt Publishing for their deft editorial guidance, and Magento for creating the most flexible e-commerce platform available. Last but not least, I'd like to thank my wife, Shana, and kids, Sebastian and Maxwell, for their support and inspiration.
Andre Gugliotti is a Brazilian author, writing about e-commerce and working on internet business since 2004. He is a specialist in building and maintaining online stores and helping companies and entrepreneurs to achieve success. He also teaches teams on e-commerce subjects and give lectures in Brazil or abroad.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Since its launch in late 2007, Magento has become the most widely used open source e-commerce platform. The growth of the system was fueled by its ability to be extended and customized to meet almost any online retailing need. Thousands of developers and store owners have built profitable B2C and B2B implementations.
However, it's no secret that the learning curve to master Magento can be intense. With power comes a degree of complexity. To meet this need for Magento 1.x, one of the authors, Bret Williams, wrote the very successful Mastering Magento for Packt Publishing in 2012. The book helps thousands of readers navigate Magento.
Magento has released the long-awaited version 2. This version introduces a completely revamped code architecture, admin user interface, and better workflows. Version 2 is truly a completely new version.
Therefore, it stands to reason that Magento users will need to learn how to maximize this improved platform. Mastering Magento 2 satisfies this need while following much of the same easy-to-learn, information-rich format of the first book.
With Mastering Magento 2, author Bret Williams has teamed with eminent Magento developer and technical architect, Jonathan Bownds. The combination of these long-time Magento experts brings a full-circle approach to truly mastering the world's most powerful open source platform for online sales.
Chapter 1, Planning for Magento, introduces you to Magento 2 with a discussion of its technical considerations, its multistore methodology, and how to apply this key feature to your plans for multiple stores.
Chapter 2, Installing Magento 2, provides keys to ensure that you have a successful Magento 2 installation as well as guidance to plan your categories, backups, and security.
Chapter 3, Managing Products, teaches you about how Magento manages products and categories.
Chapter 4, Designs and Themes, explores the new Magento 2 theming structure and shows you how to customize your store for your brand.
Chapter 5, Configuring to Sell, covers the entire sales process, including payment systems, shipping methods, taxes, and transactional e-mails.
Chapter 6, Managing Non-Product Content, discusses the Magento content management system that helps you create pages and layouts to communicate your brand.
Chapter 7, Marketing Tools, covers the various Magento features that work to drive more business—and repeat business—to your store.
Chapter 8, Extending Magento, dives into the powerful extendibility of the platform, including how to build your own Magento 2 extensions.
Chapter 9, Optimizing Magento, takes an in-depth look at the core Magento 2 data architecture and how you can tune your Magento store for maximum speed.
Chapter 10, Advanced Techniques, guides more technical readers through processes that improve Magento reliability and stability.
Chapter 11, A Pre-Launch Checklist, provides an easy-to-follow checklist to use when taking a new Magento 2 store online.
Store owners using this book to learn Magento 2 should have an installed version of Magento 2 to work with. Developers should have a development environment capable of supporting a Magento 2 installation:
Developers are also required to have a good working knowledge of PHP, object-oriented programming, and MVC architecture.
Mastering Magento 2 was crafted for anyone who will use Magento 2, whether it's as a store owner or developer. The book was designed specifically for those with little or no prior experience with Magento. Packt Publishing provides additional books by experienced authors to cover more specific Magento topics in even greater detail. This book provides the reader with a solid, functioning foundation to successfully use Magento 2.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Open the .htaccess file in a text editor."
A block of code is set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on Default Category shown on the left side of the edit area."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
It's not difficult to download Magento 2. With some hosting companies, it only takes a simple request or "one-click" to do an initial installation of this powerful e-commerce platform. The question now becomes, "where do you go from here?"
Before you even download and install Magento, it's important that you take some time to plan. The temptation to dive right in and get your feet wet is strong – especially for those of us who enjoy exploring new technologies. However, this is perhaps the primary reason why many people abandon Magento even before they get off the ground. Not only are there lots of wonderful features and configurations to tackle, there are significant installation issues to consider even before you download the installer.
Avoid the "uninstall-reinstall" syndrome. Plan your installation before you install and you're less likely to have to start all over again at a later date.
In this chapter, the following topics will be covered:
There are three important areas to consider when defining your e-commerce project:
It is never wise to skimp on defining and analyzing any of these, as they all play crucial roles in the successful implementation of any e-commerce project (or any web project). Let's look at each of them in detail.
Magento is a powerful, full-featured e-commerce platform. With that power comes a certain degree of complexity (one very good reason to keep this book handy!). It's important to take your analysis of how to leverage this power one step at a time. As you discover the many facets of Magento, it's easy to become overwhelmed. Don't worry. With proper planning, you'll soon find that Magento is quite manageable for whatever e-commerce project you have in mind.
It is very likely that your e-commerce project is ideal for Magento, particularly if you intend to grow the online business well beyond its initial design and configuration – and who doesn't? Magento's expandability and continued development insures that, as an open source platform, Magento is the ideal technology for both start-up and mature stores.
When considering Magento as a platform, here's what Magneto offers that makes it shine:
Where you might find Magento to be more than required is if you have only a small handful of products to offer or expect very few sales.
If you think that Magento might be too complicated to use as an e-commerce platform, think again. Power always involves some level of complexity. With Mastering Magento 2, we feel the challenge of using Magento will quickly become an appreciation for all the ways you can sell more products online.
How are you going to be using your Magento installation? This list will help you focus on particular areas of interest in this book. Answer these questions, as they pertain to your single Magento installation:
Whatever you can conceive for an e-commerce store, it can almost always be accommodated with Magento!
The second stage to defining your scope is to think about "users" – those who will be actually interacting with Magento: customers and store staff. These are people who have no technical expertise, and for whom using the site should be straightforward and intuitive.
Designers and developers may use Magento's administration screens to configure an installation, but it's the ones actually interacting with Magento on a daily basis for which designers and developers must plan. As you use this book to craft a successful Magento store, always keep the end-user in mind.
Who are your users? Basically, your users are divided into two segments: staff and customers.
Staff refers to those who will be using the Magento administration screens on a daily basis. Magento's administration screens are elegant and fairly easy to use, although you'll want to pay close attention to how you create user permissions, as described in Chapter 2, Installing Magento 2. Some users won't need access to all the backend features. By turning off certain features, you can make the administration area much more user-friendly and less overwhelming. Of course, regarding staff managers, additional permissions can give them access to reports, marketing tools, and content management sections. In short, as you work with staff, you can fine tune their back-end experience and maximize their effectiveness.
One key staff user should be designated as the "Administrator". If you're the one who will be responsible for managing the Magento configurations on an ongoing basis, congratulations! You now have at your fingertips the power to adjust your online business in ways both significant and subtle. You also have in front of you the guidebook to give you a full appreciation of your capabilities.
For store administrators, Packt Publishing offers a companion book, Learning Magento 2 Administration. This book, authored by Bret and Cyndi Williams, is the perfect training and reference book for your staff.
There are several types of customers, and they are based on their relationship to the vendor: retail and wholesale. Among these customers, you can also have customers that are members of the site – and therefore privy to certain pricing and promotions – both on the retail and wholesale level. You can also subdivide wholesalers into many other levels of manufacturers, jobbers, distributors, and dealers, all operating through the supply chain.
Magento has the ability to handle a variety of different users and user types, including all the ones mentioned above.
The one caveat to consider when scoping users is that if you are going to use a single Magento installation to operate more than one business – which can certainly be done – you cannot create unique permissions for staff users which restrict them to managing the content, customers, and orders of any one business.
As reviewed in the Preface, there are basically three different types of people who will be involved in any Magento installation: the Administrator, the Designer, and the Developer. Which one, or ones, are you?
As a complete, installable platform, make sure you have sufficient technical resources to handle all aspects of web server configuration and administration. It is not uncommon to find one or maybe two people tackling the installation, configuration, and management of a Magento installation. The web industry is well populated with "Jacks-of-all-Trades." As you analyze your own technical abilities, you may find it necessary to hire outside help. These are the disciplines that can help you maximize your Magento success:
When hiring a developer for your Magento store, make sure you find someone with specific experience with Magento 2. The new architecture and coding standards require particular knowledge. Magento provides a list of certified Magento developers at http://www.magentocommerce.com/certification/directory. Be sure to inquire about Magento 2 qualifications.
Fortunately, many Magento-friendly hosting providers offer assistance and expertise when it comes to optimizing your Magento installation. In Chapter 9, Optimizing Magento, we explain ways you can perform many of the optimization functions yourself, but don't hesitate to have frank discussions with potential hosting providers to find out just how much and how well they can help you with your installation.
If you choose to host the installation on your own in-house servers, note that Magento does require certain "tweaks" for performance and reliability, which we cover in Chapter 9, Optimizing Magento.
You have assessed the technical knowledge and experience of yourself and others with whom you may be working, now it is important that you understand the technical requirements of installing and managing a Magento installation.
If you're new to Magento, I certainly recommend that you find a capable hosting provider with specific Magento experience. There are many hosting companies that provide hosting suitable for Magento, but far fewer who invest resources toward supporting their clients with specific Magento-related needs. Keep these points in mind as you research possible hosting candidates:
You may already be hosting PHP based websites, have a robust server setup, or manage racked servers at a hosting facility. In these instances, you might well be capable of managing all aspects of hosting a Magento installation. In this book, you will find considerable information to help you configure and manage the server aspects of your Magento installation. We do repeat the advice that if you're new to Magento, an experienced hosting provider could be your best friend.
Due to Magento's complex architecture, your servers should be powerful. The architecture, indexing, and caching schemas of Magento require considerable resources. While we will attack these issues in Chapter 9, Optimizing Magento, the more horsepower you have, the better your store will perform.
To host your own Magento installation, your server must have the following minimum requirements:
Magento 2 can also use Redis 3.0 or Varnish 3.5/4.x for page caching and memcached for session storage.
Most Magento Community users we know (and there are lots!) opt for a hosted solution. Even with our own experience managing web servers, we too use a third-party hosting provider. It's easier, safer, and in most cases, far less expensive than duplicating the same degree of service in-house.
However, we do enjoy installing and testing open source platforms in-house, rather than setting up another hosting account. This is especially true when working with new platforms. Setting up an in-house installation can also allow you to test modifications, extensions, and updates before installing them on your live production server.
You can set up a complete Magento environment with PHP and MySQL on your own desktop computer or a local server in your office. In Chapter 10, Advanced Techniques, we'll provide detailed instructions for several different methods that can be used to install Magento on a local machine.
Now you're probably itching to install your first Magento store. In fact, you probably have done that already and have been fumbling through the vast labyrinth of configuration menus and screens. If you're like so many first-time Magento installers, you might feel ready to uninstall and reinstall; to start all over.
Most of the time, this "restart" happens when users try to take advantage of one of Magento's most powerful features: managing multiple stores. It seems easy when you look at the store management screen until you begin setting up stores, configuring URLs, and assigning specific configurations to each frontend website.
Before you begin laying out your master plan for the various websites and stores you intend to create (and even if you're only beginning with one website), you need to master the Magento methodology for multiple stores. Magento describes this as "GWS," which stands for "Global, Website, Store." Each Magento installation automatically includes one of each part of this hierarchy, plus one more for "Store View."
The following diagram shows how each part of GWS is related to one another:
Global refers to settings (for example, stock management rules) and values (for example, product price) for the entire installation. Throughout your Magento installation, you'll find Global displayed next to various form fields.
In terms of installation planning, your Global considerations should include:
In general, we recommend that you consider a single Magento installation only for multiple websites and stores that are similar in concept. For example, if your online business is selling drop-shipped furniture through several differently branded websites, then a single Magento installation is ideal. However, if you have two or more different businesses, each with a different product focus, company name, banking, and so on, it is best to use a separate Magento installation for each discrete business.
The website is the "root" of a Magento store. From the website, multiple stores are created that can each represent different products and focus. However, it is at the website level that certain configurations are applied that control common functions among its children stores and Store Views.
As described above, one of the most important considerations at the website level is whether or not customer data can be shared among websites. The decision to share this information is a Global configuration; however, remember that you cannot elect to share customer data among some websites and not others: it's an all or nothing configuration.
If you do need to create a group of websites among which customer data is to be shared, and create other websites among which the data is not to be shared, you will need more than one installation of Magento.
What can sometimes be confusing is that "Store" for Magento is used to describe both a store structure as well as a Store View. When configuring your hierarchal structure, "Store" is used to associate different product catalogs to different stores under a single "Website," whereas "Store Views" can be created to display a "Store" in multiple languages or styles, each with their own URL or path. Each Store View can be assigned different themes, content, logos, and so on.
Yet, throughout Magento's many administration screens, you will see that "Store" is used to define the scope of a particular value or setting. In these instances, entered values will affect all Views under a Store hierarchy. We know this can be confusing; it was to us, too. However, by following the processes in this book, you'll quickly come to not only understand how a Store and Store View is referred within Magento, but also appreciate the tremendous flexibility this gives you.
Perhaps the best way to consider Stores and Store Views is to learn that a View is what your website visitor will see in terms of language, content and graphics, while Store refers to the data presented in each view.
How you utilize GWS in your particular case depends on the purpose of your Magento installation. With GWS, you have an enormous number of configuration possibilities to explore. That said, your configuration planning would generally fall within three major categories: multiple domains, multiple businesses, and multiple languages. Of course, in the real world, a Magento installation may include aspects of all three.
It's important to realize that Magento allows you to drive your e-commerce strategy according to your own business and marketing goals, rather than conforming to any limitations according to what your e-commerce platform might or might not be able to deliver.
It's becoming more popular in e-commerce to create multiple storefronts selling the same or similar products, each having a different domain name, branding design, and content. In this way, merchants can extend their marketing by appealing to different market segments, not just having one website trying to satisfy all consumers.
For example, let's assume you want to sell shoes online. You have a great distribution source where you can source all kinds of shoes, from dress to casual, running to flip-flops. While you can certainly have a comprehensive, "all types available" online shoe store, you might elect to secure different domain names focused on different segments of the shoe market. www.runningshoes4you.com would cater to joggers, while www.highheelsemporium.com features designer-quality dress shoes for women.
In Magento, you would create one website but create at least two stores, one for each of your domains. You might also create a third as an overall retail store for all your shoes. Each store could either share the same product catalog or each have its own separate catalog. By having all stores assigned to the same website, you have the ability to control certain configurations that apply to all stores. For example, if all the stores belong to the same retailer, as in this example, all would offer the same payment methods, such as PayPal.com or Authorize.Net. Most likely, the shipping methods you offer would be the same as well as your policies for returns and shipping.
In short, if all the domains belong to the same retail business, it may make sense to have one website with multiple stores, rather than to create entire website-store hierarchies for each product-focused domain. As you can see in the following diagram, this makes for a slimmer, more manageable structure:
In contrast, if your installation will be used to manage multiple businesses, you will need to create multiple websites. The reason for this is that actual, separate business entities will have separate payment system accounts (for example, PayPal, credit card merchant accounts, shipping), and therefore need to be able to segregate these between different websites.
To extend our example, let's assume your shoe retailer also owns a sideline business selling women's sportswear. This other business exists under a separate legal entity (for example, corporation, partnership), and therefore has different bank accounts, distributors, and customers. With Magento, you should create separate websites for each, even if they are to share certain products.
For instance, the sportswear site might also feature women's casual shoes, which are also offered by the shoe website. The same product can be assigned to multiple product catalogs (and therefore different stores) even if the catalogs belong to separate businesses. And somehow, through a complex database architecture, Magento succeeds in keeping all this straight for you. Amazing.
Remember that Magento 2 does not allow you to give back-end user permissions based on the website. Permissions can only be set at the Global level.
Even among some of Magento's top competitors in the open source e-commerce arena, very few provide the ability to create multiple language views of a website. Multiple language views are not simple matters for several reasons:
Magento has several tools to help you create multiple languages and currencies for retailers wanting to sell globally (or just provide multiple languages to users within a single country), which we will tackle in Chapter 2, Installing Magento 2. It all begins with creating multiple views for a given store.
In our example, our running shoe website needs to be available in both English and French, so you would create two views within the running shoe store, one for each language. In your Magento-powered website, you can easily include a small drop-down selector which allows a visitor to choose their preferred language based on the views you have created.
In fact, in most Magento theme designs, this dropdown is automatic whenever there are multiple views created for any given store.
Another interesting use of multiple views could be to segment your customer market within a store. For example, if you wanted your shoe store to have a different overall look for men versus women versus children, you could create multiple views for each customer segment, and then allow the visitor to choose their desired view.
The power of Magento can also be a curse, particularly if you're like many of us: eager to jump in and begin building an online store. However – and this comes from the experience of investing lots of hours – taking a moment to understand the scope of your undertaking will make navigating the intricacies of Magento a much more rewarding experience.
In this chapter, we outlined the key areas to consider when planning our Magento installation. We also learned about the powerful Global-Website-Store methodology for managing multiple web stores in a single installation. In addition, we looked at the possibilities of introducing multiple languages, businesses, and domains for effective market segmentation.
As we go forward in this book, we'll learn how each decision we make in installing, configuring, and managing Magento traces back to what we covered in this chapter. In the next chapter, we will be taking your plans from this chapter and applying them to a new Magento installation.
Now that you've got your plan in hand from Chapter 1, Planning for Magento, it's time to now take the leap and install Magento 2 Community. While some hosting providers will install Magento for you, or provide installation assistance, Magento makes installation fairly easy. There are a few points to pay attention to, but if you follow the steps in this chapter, you'll be up and running with Magento in quick order.
In this chapter, we will learn about the following topics:
If you own and operate your own servers, and your server meets the requirements for installing Magento, you're all set to go. However, for most people installing Magento Community, the quest to install Magento on an appropriate hosted server is vital to insuring that their Magento stores run quickly and securely.
Hosting plans range from a few dollars to hundreds of dollars per month, depending mainly on the type of server configuration you have. For most hosting providers, hosting is divided into three distinct categories:
