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

Importing simple products

From: Create Your First Online Store with Drupal Commerce

Video: Importing simple products

If you're using Drupal Commerce to start an online business, you can now go off and merrily add products as you saw in previous videos. But some of you already have inventory that you want to sell through Drupal Commerce. In that case, you either have the data in an online store, or it's in some kind of database, list, or spreadsheet. Now, I can't tell you how to get the data out of some other store system, but I can tell you how to move a simple, tab delimited list of products into Drupal Commerce. For this, we will need to add a few modules. The first one, and most important, is called Commerce Feeds.

Importing simple products

If you're using Drupal Commerce to start an online business, you can now go off and merrily add products as you saw in previous videos. But some of you already have inventory that you want to sell through Drupal Commerce. In that case, you either have the data in an online store, or it's in some kind of database, list, or spreadsheet. Now, I can't tell you how to get the data out of some other store system, but I can tell you how to move a simple, tab delimited list of products into Drupal Commerce. For this, we will need to add a few modules. The first one, and most important, is called Commerce Feeds.

You get it by going to drupal .org/project/commerce_feeds. And as usual, we go down here and copy our link, then go back to our site and click Modules, and then click Install new module to install it. Paste, Install, and go. Now, if we go back to enable that newly added module, we will find that we are not able to. Let's go down and take a look. So there is Commerce Feeds, and an example, but we can't actually click it, because it has several requirements.

It needs Commerce Feeds, which in turn has its own requirements. Well, that's okay. We will just go drupal.org/project/feeds. Then do the same thing. Go back to our Modules page, and install that. Once again, we attempt to enable the modules we just added. Nope, it's still not working. We will go down and enable Feeds. Oh, but that in turn requires job scheduler, and back we go.

This is something that you'll find with Drupal sometimes. You have one module that depends on another module, which in turn depends on another one. That's okay; we will get to the end of this. I'm going to go do drupal.org/ project/job_scheduler, and download that. Remember, you have to grab the Drupal 7 version, even though it's an Alpha. Hopefully by the time you watch this, it will be out of alpha, and more ready to use, but I haven't had any problems with it. Back up to the top of the page; Install.

Now I believe we can enable our module. We will find out by collapsing all of these, and there is Commerce Feeds, and Commerce Feeds Example. When I enable that, it asks if I want to enable all of the other parts. The last thing I am going to do is just take a look and make sure that everything is enabled that we need enabled. So down here, Commerce Feeds; very good. We don't really need Commerce Feeds Example. And for feeds, I'm also going to add Feeds Admin UI, and Feeds Import.

Then Job Scheduler is fine, and we're done. Now we're ready to start importing our products. Let's take a look at the controls. There are two parts. First, you set up the import, then you execute it. To set up the import, you go to Structure, and Feeds importers. We have two examples here, but I am going to create a new one, which I'll call a Product import. You need both, a name that you can read, Product import, and then also one for the machine, which is all lowercase with an underscore, and create.

Now, the Feeds module has a lot of settings. I will only change those that are relevant to our particular import, but I definitely recommend you spend some time exploring these controls, and reading the documentation for feeds if you want to know more. That documentation is linked from the Feeds Project page, which is at drupal.org/project/feeds. But here we go. First I'll look at the Basic settings. We don't need to import every 30 minutes; we will just do it once. We're going to change it so that instead of going out to the Web to look for information, it goes to a file.

The parser isn't going to change an RSS feed; instead we are going to be using our Comma Separated Value file, or CSV. For the CSV parser itself, we will change the delimiter to Tab, because that's the way that we have the file set up, as you will see in a minute. Of course, you will make these changes depending on what sort of data file you have. For processor, we are going to change it so that it creates products instead of nodes, and then we'll look at those settings. Instead of having it as an anonymous author, I will change it to admin, and the Product type becomes a Product; very good.

Those are the basic changes. Then there's a few we have to look at the data file itself to understand. I already have that file open here. As I said, our bits of data are separated by tabs, but of course, they could be by commas, or other delimiters between the different fields. Our fields are listed here at the top; the SKU, the Product Name, Price, and Description. This is called the Header row, and you might have noticed that we had to specify that we are using a Header row. Now we go back to our Commerce Product processor, and we will change the mapping so that we know what fields in Drupal are going to be match with what fields in our text file.

The source field -- if we look back here, the first is called SKU, and that gets mapped to Product SKU. We will add that, and then continue with the other fields. The Product Name becomes the title. The Price becomes the Price Amount, and for the Description, we actually don't have any place for it to go.

Remember, the description shows up in the product display node, not in the product itself. So we will actually come back to that in just a minute, because we're also going to repeat this import for the node, so that we can display the product we've created. So we save this, and now we are ready to import. To do so, go up to the name of your site, slash, import. There is our Product import, I select it; look through the different settings. Yup, TAB delimiter; looks good. There are headers, that's unchecked, so now all we have to do is choose our file, and click Import, and when it's done, we see that three items were imported.

We can check this by going up to Store, and Products, and there they are: Guided tour of our orchard, Friday- night concert, and Night in our lodge. So now we have our products in Drupal Commerce, but if you've been watching the series this far, you know we have to create the product display nodes as well. But that's okay. We can use the same exact procedure, and in fact, we will use the same data file. We will just match the products to their nodes using the SKU field. To do that, once again, we'll create an importer. Go up to Structure, Feeds importer, and New Importer.

We're going to call this Product display importer, and save. Once again, we have to change many settings. I will just go through this quickly.

Finally, we get back to our mapping. To see what the mapping will be, once again, we'll look at our text file. So the first one is SKU; paste it in there, and this one actually gets mapped to two different places. First, it gets mapped to the SKU as you'd expect, but it also gets mapped to something called the GUID, which is a Global ID, and I will add that. Then we go back and map the other parts. Product Name goes to the title. The Price doesn't go in, because that showed up in the product, not in the product display node.

However, the Description goes to the body. Now we're ready for our import. I'll save that, and go to slash, import. This time we are going to import Product display. Make sure that we have the file we want, I will go up and find it, and away we go. There; three items were imported. We go back to our front page, and we see them right there. Because we had no images for them, we have this default image; that's all good, and we can add them to the cart, just like any other product.

If we go in and take a look at the nodes themselves, they work fine. That worked pretty well, huh? But the truth is, a lot can go wrong. Here are some of the biggies. The first common error is when you have malformed separators. That's when you put in a comma when you're expecting a Tab, or if you have quotes in the wrong place, and Feeds importer thinks that that's the end of a field. The second big error is if you misspell a header. That's why you saw me often go in and copy and paste, even if it was something very simple like SKU, because I wanted to make sure that I got it exactly right, otherwise Feed importer simply won't work.

Finally -- and this is a biggie -- if your file has non-UNIX or Linux line endings, as you sometimes get in some text processors on Mac or Windows. That commonly comes up if you save the file into Excel, and then save it out as an Excel text file. I have to tell you, I've use the Feeds module a lot, and I have run into all of these problems when I started out, but when it works, it is beautiful. I recommend that you run a few small test imports before bringing in your entire inventory file, so you'll be able to tell whether errors are caused by your procedure, or by issues in the data.

As always, backup your site before attempting any big imports or other changes.

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 · 10866 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 preferencesfrom 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.