Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning Magento Theme Development
Learning Magento Theme Development

Learning Magento Theme Development: Create visually stunning and responsive themes to customize the appearance of your Magento store

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Learning Magento Theme Development

Chapter 1. Introduction to Magento and Magento Themes

Magento is a popular, enterprise-level open source e-commerce platform used by hundreds of thousands of e-commerce businesses around the world. With ever increasing numbers of online stores competing for customers and income, it can pay off to invest in customizing your Magento store to set it apart from hundreds and thousands of other stores, and developing a custom Magento theme is the way to achieve this.

In this chapter, you will learn the following topics:

  • What a Magento theme is and what Magento themes can do
  • An overview of the default Magento themes in Magento
  • An introduction to the Magento theme terminology
  • How the Magento theme hierarchy works

What is a Magento theme?

A Magento theme is simply a collection of files that tells Magento how to display your store to visitors. A Magento theme can consist of a collection of CSS, HTML, PHP, XML, and images, all of which contribute to the look and feel of your store.

Due to Magento's architecture and the design interface's hierarchy, Magento will fall back to base theme (discussed later in this chapter) that contain the files it requires if they are not present in the current theme. A Magento theme can consist of one or more of the previously mentioned files. It could be as simple as a logo file with the rest of your store's styling provided by a parent theme.

Magento's default themes

In Magento Community Edition 1.8, Magento provides the following four themes:

  • Default
  • Blank
  • iPhone
  • Modern

The default theme

Magento's default theme is perhaps, unsurprisingly, the theme that is enabled by default when you first install Magento, encompassing a clear header area with a search field and drop-down navigation for categories to be listed, a content area with sidebar(s), and a footer, as shown in the following screenshot:

The default theme

The default theme's product page layout retains the header and footer styling of the home page layout, but the central content area is adapted to present the product information to customers, as shown in the following screenshot:

The default theme

As you can see in the preceding screenshot, the product page provides a product image with the name, a brief description, and the price of the specific product towards the top of the page. Then, a more detailed description is provided in the next block.

Tip

You might notice that there are many superfluous blocks in the sidebar, such as the BACK TO SCHOOL and COMMUNITY POLL blocks, which would not be required on a usual e-commerce website. These blocks help showcase how powerful Magento is to new developers and can be removed fairly easily.

The category page layout

One of the next key views for your Magento store is the category page layout, which presents all the products grouped within a particular product category, as shown in the following screenshot:

The category page layout

The list mode layout

Magento presents products in two ways: in a grid (as shown in the preceding screenshot) and as a list, which you can select by clicking on the List option in the product grid, as shown in the following screenshot:

The list mode layout

In the list mode, products within the selected category are displayed one above the other, as shown in the following screenshot:

The list mode layout

Checkout

Finally, Magento's famous one-page checkout provides a well-structured checkout process for your customers, as shown in the following screenshot, maintaining the default theme's overall character:

Checkout

Next, you will see the additional Magento themes that come with Magento Community Edition 1.8 to cater to different needs for both customers and developers.

The blank theme

The blank theme, as its name suggests, provides a very minimal approach to a Magento theme to allow a custom Magento theme to be built upon it, maintaining a layout that is similar to Magento's default theme but stripping the visual styles, as shown in the following screenshot:

The blank theme

The iPhone theme

The iPhone theme provides a more mobile-friendly theme for your Magento store, which can be switched on and off for specified devices. This view of the home page with the iPhone theme shows you how content is streamlined and slimmed down to help present the most relevant information to your customers on devices with limited screen space available, as shown in the following screenshot:

The iPhone theme

The modern theme

Finally, the modern theme provides a full-fledged Magento theme that can be used as an alternative to the default theme, with a more contemporary look, as shown in the following screenshot:

The modern theme

These themes show you just the surface of the potential customizations you can make to your Magento store, and this book will guide you through some of the common changes made to Magento stores as well as some less common alterations you can make to improve your Magento theme.

Magento terminology

As with many other open source technologies, Magento comes with its own terminology, which can be baffling to unfamiliar developers. This section identifies and defines some of the commonly used terms in the Magento theme development.

Scope in Magento

Magento has the following four levels of scope that help define the level in your Magento store(s) at which settings are applied:

  • Global: This refers to settings that affect the entire Magento installation.
  • Website: This acts as the parent entity for one or more stores in the Magento terminology. Websites can be configured to share the customer data or not share any data at all.
  • Store (or store view group): These are the hierarchical children of Magento websites. Products and categories are managed at Magento's store level. A root category is configured for each Magento store, allowing multiple stores under the same website to have totally different catalog structures.
  • Store view: A store needs one or more store views to appear in the frontend to customers so they are able to browse your store. The store view inherits the store's category and product information, and so the changes at the store view level are typically only cosmetic, changing the way the data is presented. The most common and likely implementation of multiple store views is to allow customers to navigate between two or more languages.

Magento websites, stores, and store views

It is possible to run many different e-commerce stores from one Magento installation, and it's also possible to run separate stores on the same website (for example, a consumer store and a trade store that offers discounts to trade customers). The simplest of Magento websites, however, consists of a single website with a single store and single store view as follows:

Magento websites, stores, and store views

Using multiple stores in Magento

The most common use of multiple stores in Magento is to build separate stores with their own inventories. For example, you could have one store, veryverycoolt-shirts.com, to sell t-shirts, and another, veryverycoolcaps.com, to sell baseball caps through the same installation of Magento. The following diagram illustrates the structure of how this would be created using Magento websites, stores, and store views:

Using multiple stores in Magento

You can chose whether the stores share the customer data or whether each store has its own customer data, requiring customers to register separately if they want to order from both the t-shirt store and cap store.

Using multiple store views in Magento

You can make use of multiple store views in Magento to customize how a store is presented; this is typically used to present the same store in multiple languages. In the following diagram, both stores have a French and English version, created at the Magento store view level:

Using multiple store views in Magento

Magento allows the following two types of themes:

  • A parent theme that contains all the files that are required to be run by Magento
  • A child theme contains one or more files. Where a file isn't overwritten; Magento will look for the file in the parent theme

A parent theme is useful when you want to create a highly customized Magento theme from the standard themes that Magento has installed. Child themes are of use when you only want to make fairly minor amendments to your theme.

Magento theme files

As you have already seen, Magento themes use a number of different types of files to change how your e-commerce website is displayed to your customers. The following four groups of files are associated with Magento themes:

  • Skin files
  • Layout files
  • Template files
  • Locale files

Skin files

Skins encompass the files that you would associate with a website's design: the CSS, images, and JavaScript your theme requires in order to display your store.

In Magento, skin files are located in the /skin/frontend/ directory. Magento's base skin files are stored in the /skin/frontend/base/default directory of your Magento installation, while theme files, which you would typically edit for custom themes that you create, would be included in the /skin/frontend/name-of-your-package/name-of-your-theme/ directory.

In the examples used in this book, you will be building a theme in the default package, so your skin directory will look like this: /skin/frontend/default/name-of-your-theme/.

Layout files

Magento uses XML layout files in its themes to inform Magento about which blocks are displayed where in the page and in what order, for example, the MY CART and COMPARE PRODUCTS widgets that use Magento's default theme, as shown in the following screenshot:

Layout files

The Magento layout can also be used to add and remove CSS and JavaScript files as well as other elements from the <head> element of your Magento theme and alter the order and location of the links.

Magento's base layout files are stored in the /app/design/frontend/base/default/layout directory of your Magento installation, while your custom theme's layout files can be found in the /app/design/frontend/name-of-your-package/name-of-your-theme/layout directory.

In the examples used in this book, you will be building a theme in the default package, so your application directory will look like this: /app/design/frontend/default/name-of-your-theme/.

Template files

Magento's template files (which use the .phtml file extension to indicate a mixture of PHP and HTML) provide your Magento theme with a way to generate the HTML for your store's pages using the data and content stored within Magento.

Magento's base template files are stored in the /app/design/frontend/base/default/template directory of your Magento installation, while your custom theme's layout files would be found in the /app/design/frontend/default/name-of-your-theme/template directory.

Locale files

Finally, Magento's locale files help you customize the text in the interface elements of your Magento store, such as the text used as links in the userbar for your store, as shown in the following screenshot:

Locale files

A Magento locale file can also be used to provide a translation of your store's elements to French, or even just American English to British English. In the preceding example, a locale file might change the My Cart link to My Basket, for instance.

The content of pages and products of your store can be translated by creating new products and pages in your new store's language within the store view for that particular language.

Magento locale files are stored in the /app/design/frontend/base/default/locale directory, with locale files specific to your theme being stored in the /app/design/frontend/name-of-your-package/name-of-your-theme/locale directory. Translations are stored in a translate.csv file; for example, /app/design/frontend/default/name-of-your-theme/locale/en_GB/translate.csv contains the translations for British English for that particular theme.

Packages

In Magento theming, a package typically encapsulates a default theme that contains all of the skin, template, layout, and locale files Magento needs to render the website. It might also contain another non-default theme that customizes the look and feel of the website on top of the base theme, as illustrated in the following diagram:

Packages

Assigning a package at the website level means that all the stores under that store level inherit that package. This would simply apply the theme to all of the stores assigned to that particular website in Magento. So, by assigning a theme at the website level in the following diagram, the Cap store and the T-shirt store would inherit the same theme, unless it was specifically overwritten at the individual store view level:

Packages

Magento theme hierarchy

Magento has a hierarchy in place for its themes, which tells the system where to look for files if multiple themes are active on different stores on your website. As an example, think about a simple Magento store setup like the one you saw earlier, as demonstrated in the following diagram:

Magento theme hierarchy

Now, imagine that your store has a theme called newtheme installed at the store view level. The Magento theme here requests a file called styles.css in the most specific interface and package first, so if you have a custom theme enabled, Magento will look in /skin/frontend/default/newtheme first. If it's not found in these directories, Magento looks in the default interfaces next: /app/design/frontend/default/default or /skin/frontend/default/default. Next, Magento will look in the base directories: /app/design/frontend/base/default or /skin/frontend/base/default. If the specified file is not found after that, Magento will encounter a rendering error.

So, the deeper down the hierarchy tree of themes the file is, the more specific it is and the more precedence it takes over other more general files.

Summary

This chapter provided you with an introduction to both Magento and Magento's themes as well as giving you an overview of what already exists in terms of the themes that ship with Magento by default. You have seen what comprises a Magento theme, some of the existing themes available with Magento 1.8, common theme terminology used in Magento, and how the Magento theme hierarchy works.

Left arrow icon Right arrow icon

Description

This book is for web designers and developers with existing knowledge of CSS, HTML, and XML, who wish to learn more about Magento-specific theming techniques. Some knowledge of PHP may be useful, but is not necessary.
Estimated delivery fee Deliver to Netherlands

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 20, 2014
Length: 182 pages
Edition : 1st
Language : English
ISBN-13 : 9781783280612
Vendor :
Magento
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Netherlands

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Aug 20, 2014
Length: 182 pages
Edition : 1st
Language : English
ISBN-13 : 9781783280612
Vendor :
Magento
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 82.98
Mastering Magento Theme Design
€45.99
Learning Magento Theme Development
€36.99
Total 82.98 Stars icon

Table of Contents

9 Chapters
1. Introduction to Magento and Magento Themes Chevron down icon Chevron up icon
2. Magento Theming Basics Chevron down icon Chevron up icon
3. Magento Templates Chevron down icon Chevron up icon
4. Magento Layout Chevron down icon Chevron up icon
5. Social Media and Magento Chevron down icon Chevron up icon
6. Advanced Magento Theming Chevron down icon Chevron up icon
7. Magento Theming for Mobile and Tablet Devices Chevron down icon Chevron up icon
8. Magento E-mail Templates Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(2 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 0%
1 star 50%
Jason William Alls Apr 10, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have the ebook, and it is in full colour, and this makes a big difference. The author does a very good job of explaining to a complete novice what Magento themes are, and provides a very detailed but simple to follow procedure with examples on how to customise your own themes. If you have never had any experience of creating your own Magento theme, I guarantee that by the time you have worked through this book, you will be fully armed with all the knowledge you need to create and customise your own commercial quality themes.
Amazon Verified review Amazon
Amazon Customer Mar 12, 2016
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
not very useful
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela