Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,800 courses, including more Business and personalized recommendations.Start Your Free Trial Now
- View Offline
- Surveying the store-building process
- Installing Drupal Commerce using Commerce Kickstart
- Accepting PayPal payments
- Processing orders
- Understanding rules and line items
- Listing and importing products
- Managing inventory, orders, and customer profiles
- Streamlining the checkout process
- Launching a store
- Offering product discounts
- Analyzing site traffic with Google Analytics
Skill Level Intermediate
We've set up our store, and added one product; a bottle of olive oil. The way Drupal Commerce works, that's only the first half of the equation. That product won't appear on our site until we also display the product, sort of like moving items from the warehouse to the front of the store. To do that, we will create something called a product display node. Because we are using Commerce Kickstart, we get a few things that you'll have to set up by hand if you installed it from scratch. The first is in the modules. You will have to turn on two modules that are down here under the Commerce area.
First is Cart, and second is Product Reference. You'll need Product Reference, because that's what ties together the products with the product displays. Another thing that we get from installing from the Kickstart is a product display node content type. You see that by going up to Structure, and Content Types, and there is Product Display. As with other kinds of nodes in Drupal, you can change the fields that it contains by going over to Manage Fields, and as you see, there's only three by default. There is the Title, and the Body, and then there is a Product.
This is, once again, what ties our display node to the product itself, through a product reference. Now it's time to actually add a product display. There are two ways to do this. The obvious way is by clicking Add product display. The other way is the more drupaly one, by going up to Content, Add content, and Product display. In either case, it gets us to this form. I'm going to fill it out using some text that in our exercise files, and we'll copy the title here: Our best olive oil. And also, the body here: this is our description of the product.
Now, you'll remember there were three fields in the product display content type. The third one is right here; the reference to the product itself. I happen to remember that we called it olive oil, something, something. So as I start to type it in, it looks through all of the products and says, oh yes, that's the one. If we had more than one that started with olive, or that had olive in it, we would see the whole list here. But I will just click this, and go down, and Save, and there it is. This is the full view of our product. It is also set up, by default, to put that on the front page of our site, so a catalog starts compiling, just as we add products.
If we click on our logo, and go to the front page of our site, there it is, and there is even an Add to cart button here. Now the truth is, we could leave things as they are now, and we would be able to just shop from the site as it is. But I would like to go back and make a few changes to show you how to affect the way that products are displayed. There are two kinds of changes you can make. One kind affects only the display of a particular product, and the other one affects the display of all products. First, I am just going to change this particular product. To do that, you click its title to go to its full node, and there is this little Edit tab here.
Besides the things that we filled out earlier, if you scroll to the bottom, you will see all of these things, which are called vertical tabs. We could, for example, add a menu link here, and have that show up at the top of the page, make different revisions as we change things throughout the process of building our site, and so on. The one I'm going to change, though, is this URL path setting. If we switch over to the way that somebody sees this site as a visitor, which I have in another browser, and reload, you will notice that we see our product, but when we click it, the URL is this node/1; it's not really very friendly. And furthermore, that node/1 doesn't say anything to search engines like Google, or Bing.
We can make it more friendly both to people, and to search engines, by going back to that node here, and adding what's called a URL alias. I'm going to call this our best olive oil half liter, let's say, and then Save it. And now if you look at the top of the page, there it is. Much better for search engines, and it is also more friendly to people. There are other things that you can change in those vertical tabs, and if you want to learn more, see the Drupal 7 Essential Training Course. Now I would like to move on to the more powerful part, which will show you how to change the display of every product on your site.
For example, let's say that you want to make this graphic bigger, or put a label next to it, and you want it to be consistent on all the products in your site. You can do that by editing either the product display, or the product, and it's sometimes not clear which you edit. What I usually do is I start with the product display, and to do that go up to Structure, and Content Types, and once again, we have Product display. Now, instead of clicking edit, or manage fields, I click manage display. So I wanted to change the look of that image, and I go over here, and I see, ah, wait a second; I have to change that on the product itself. But there are some things that I change on the node.
For example, if I were to show a label here for the body -- let's do that; I'll put it above, and Save, and then close out this overlay -- we now see this label here that says Body. I don't really like that, so I will go back, and I will change it by clicking Structure, Content type, Product display, and manage display, and just remove it; easy enough. And of course, Save. But let's go ahead and change that image. I can either go to the Product Manage Display tab, or just click this link here. I'll do that, and then click manage display, and here I can change the style of that image.
Let's say I want to change it from medium to large, and Update, and Save. Now let's go back and see how that looks. Yup; it immediately refreshed, and now we see a much bigger picture. Now, I know that Drupal Commerce's two- step process for listing product is a bit odd, and it's sometimes confusing to tell whether you're supposed to affect the product, or the product display. The way I handle it is to first create products, and then create the display nodes that I need to display those products.
In fact, you have to go in that order, because in order to display a product, you first have to have it, and then make a reference to that product. Then, if I want to change the way these things look on the site, I start with the product display, because I know there are links back to the product if I need to make any changes there. So now we have all of our products displaying on our site, and along the way, I pointed out that we have this Add to cart button right here. Believe it or not, it's already possible to start shopping on the site. We will talk about the shopping cart, and checkout bits, in the video, Seeing your site from a customer's viewpoint.
Sign up for a Premium Membership to download courses for Internet-free viewing.
Watch offline with your iOS, Android, or desktop app.Start Your Free Trial
After signing up, download the course here or from the iOS/Android App.