Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using Views to gain better oversight

From: Create Your First Online Store with Drupal Commerce

Video: Using Views to gain better oversight

What you're about to see might be the most powerful video of the entire course. That's because you're going to learn about one of the systems that underlies your entire store, and once you understand how it works, you will be able to change the organization of pretty much everything in it. This magical system is called views, and it's included as part of Drupal Commerce. Views is the single most popular extension to Drupal, and it's quite complex. This video gives you only a peek into its power, but it'll be enough to let us see at a glance how many of each product we have in stock.

Using Views to gain better oversight

What you're about to see might be the most powerful video of the entire course. That's because you're going to learn about one of the systems that underlies your entire store, and once you understand how it works, you will be able to change the organization of pretty much everything in it. This magical system is called views, and it's included as part of Drupal Commerce. Views is the single most popular extension to Drupal, and it's quite complex. This video gives you only a peek into its power, but it'll be enough to let us see at a glance how many of each product we have in stock.

First, let's look at how we see products by default. To do that, we go to Store, and Products, or of course, we could just click View products. In the video about managing inventory, we added a module that keeps track of our holdings, but we don't actually see that in this list. We look at any particular product, say by editing Olive oil; there is our Stock field. But let's go back to our list of products. One thing you might not have noticed throughout this course is when you move your cursor over it, you see this little gear up here.

This is what's called a contextual menu. It lets you edit the view that you're seeing here. You see, this list is actually just a simple view, which you can edit. So we go up, and click it, and Edit view. By the way, there is another way to get there. You would click Structure, and Views, and then find the view that you want. To tell you the truth, I prefer to do it through the contextual menu, because then I know exactly what I'm editing. The way we are going to add that field is actually fairly simple. We go down here to this Field section, and click add. I am then going to do a search for stock, and there it is; Commerce Product: Stock.

Add and configure fields. I'll just leave it in its default, and then before you do anything else, you might want to see what it looks like. So we will scroll down, and look at the preview, and there's our stock. If we wanted, we could move it around by clicking rearrange. Let's say, move it up a little bit, and apply it. All sorts of things you can do in views, but before we go, we have to save it. So scroll up to the top, and click Save. Now as you see, we are here on our View products list, and there's our stock. The great thing is, you can do this on just about any screen in your store, and with views, you can do a lot more than just add fields.

Here; I will show you with the order screen. We go to View orders, and then click this contextual menu to edit the view. Here I am going to change the filtering, so we are going to add an exposed filter. Click add, and add order total. Again, I just happened to know this, but you could scroll through and see which one you wanted. This is the one I want. So I will add and configure. I will expose this filter, and say that I only want to see those orders which are, let's say, greater than 10, and apply.

By the way, I am doing a mistake here, which I will show you in a minute. If we scroll down to the bottom here, we see we now have this filter available to us. Let's go ahead and save, and see what that looks like. Again, if I click View orders, there it is. I can change the filter here, like let's say we only want to see things that are above 20. That should cut out this one that's $19, right? Oh! But it didn't. So I must've done something wrong. Let's go back in and check. Edit view, go down to our filter, and edit this particular one.

Now, as it turns out, the thing that you need to know is that it's counting by pennies, not dollars. This is the kind of error that will drive you crazy when you go through it. The thing I would recommend is go and take a look at the documentation that's either on drupalcommerce.org, or drupal.org/project/views. I am going to change this so that it shows us $10 by default. Then I will go back up and save it. Now if I want to see only those things that are above $20, I'll enter 2000, and apply, and indeed, everything below $20 drops out.

But you know what? I don't think I like having this available. Fortunately, I can revert it back to its factory settings. So once again, I'll go up to my contextual menu, and edit the view. Now, here I will notice, the name of the view is Orders (Commerce Order). In order to change this view, I have to go up one level to where it shows all the views, and then find that one. Orders, yep, that looks like the one. I will go back here, and choose revert. Yep, that's really what I wanted to do. Now if I go back and view orders, it's as it was before; there is no filter.

I do have to warn you, though: you can't revert views that you specifically create, and as you can see, you can get yourself into a lot of trouble with them. If you really want to play around with them, I strongly recommend you watch my Drupal 7 Reporting and Visualizing Data series on lynda.com. It's really amazing what you can do with views, though. You can, for example, create a map of all of your customers' shipping addresses, add totals to the order page, and so much more. You don't need to do that to run a successful store, of course, but the flexibility that you get with views is worth the learning curve.

Show transcript

This video is part of

Image for Create Your First Online Store with Drupal Commerce
Create Your First Online Store with Drupal Commerce

35 video lessons · 10903 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 16m 44s
    1. Welcome
      54s
    2. Previewing the finished project
      4m 10s
    3. Surveying the store-building process
      4m 29s
    4. Using the exercise files
      7m 11s
  2. 12m 12s
    1. Installing Drupal Commerce using Commerce Kickstart
      6m 5s
    2. Configuring your store's basic information
      6m 7s
  3. 31m 29s
    1. Accepting PayPal payments
      5m 9s
    2. Setting up individual products
      3m 17s
    3. Displaying products
      6m 30s
    4. Categorizing products
      5m 31s
    5. Adding simple taxes
      4m 39s
    6. Seeing your site from the customer's viewpoint
      3m 26s
    7. Processing orders
      2m 57s
  4. 17m 39s
    1. Understanding products and other entities
      3m 3s
    2. Understanding line items
      3m 16s
    3. Understanding rules
      5m 10s
    4. Integrating your store into a Drupal site
      6m 10s
  5. 29m 46s
    1. Adding product variations
      7m 2s
    2. Managing product variations
      3m 50s
    3. Importing simple products
      10m 11s
    4. Importing complicated products
      8m 43s
  6. 29m 52s
    1. Shipping products
      4m 50s
    2. Managing inventory
      4m 30s
    3. Managing orders
      5m 39s
    4. Managing customer profiles
      4m 55s
    5. Using Views to gain better oversight
      5m 0s
    6. Accepting other payment methods
      4m 58s
  7. 24m 52s
    1. Changing your store's look
      6m 24s
    2. Streamlining the checkout process
      5m 19s
    3. Launching your store
      13m 9s
  8. 29m 25s
    1. Offering product discounts
      8m 56s
    2. Gaining insight from Google Analytics
      5m 45s
    3. Making your site more visible to search engines (SEO)
      5m 52s
    4. Encouraging customer buzz
      8m 52s
  9. 56s
    1. Goodbye
      56s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Create Your First Online Store with Drupal Commerce .

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.