This is tutorial #4 in the Drupal Commerce tutorial series. In the previous article, we showed you how to add fields and metadata to a product. If you haven't read it, please go and read it now, or get the free eBook on Drupal Commerce 101 from the right sidebar (below the content if you are viewing in mobile).
This is tutorial #3 in the Drupal Commerce tutorial series. In this post, you will learn how to add fields and other metadata to the Drupal Commerce Product. In this specific example, we'll add description and image fields. This information will be exposed on the product display page so that it appears next to Add to card button. We will also enable user reviews and ratings.
We'll start from where we left off in the previous article on [PHP Interfaces](/blog/drupal-8/interface). If you haven't read it, please go and read it now, or get the free eBook on object-oriented programming from the right sidebar (below the content if you are viewing in mobile). In previous article on PHP Interfaces, we made `HondaAccord` class implement the `ContainerInterface` because it has a trunk. As a result, we could use `HondaAccord` class wherever `ContainerInterface` is used. But the code looks ugly!
If you are starting to learn about Drupal 8, you must have come across a term called "Dependency Injection". If you are wondering what it means, then this is the post you should read. Through examples, you will learn why dependency injection is useful for decoupling the code as well as unit testing effectively.
If you are starting to learn Drupal 8, you are probably overwhelmed by the number of blog posts that offer free tutorials on different aspects of Drupal 8. The only way to find all these tutorials is to search online. In this post, we have created an exhaustive list of the free resources online for mastering Drupal 8, organized by categories. Use these links as a reference when starting on your next Drupal 8 learning expedition. Perform a Ctrl+F search to quicky find the topic of your choice.
In Object Oriented PHP Programming post, you learned how to create classes and objects and how to use them in your code. In this post, we'll dig a little deeper and introduce the concept of inheritance. You will understand when to use it and the benefits associated with its use. You will understand Method Overriding in PHP. You will also learn when to set the visibility of properties and methods to public, protected or private. We'll continue where we left off in the previous post.
Start with learning object-oriented PHP that you need to understand Drupal 8 code. The free eBook covers:
Can highly recommend the @redcrackle Drupal 8 #OOP intro found at /blog . Also available as handy PDF. Very well written!