Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Code
  2. OpenCart

How to Set Up Configurable Products Using Options in OpenCart

Read Time:7 minsLanguages:

One of the many useful features provided by OpenCart is "Options". In this tutorial, you'll learn how to use Options to set up different variations of the same product without actually creating different products. More specifically, you'll learn to set up configurable products in the front­-end, so that the user can choose between the different variations available on the product page itself. We'll go through a detailed explanation of Options in the admin section, and we'll end up by setting up a demo of a configurable product.

Basic Understanding of Options

Have you ever run into the need for setting up multiple products with minor variations in product attributes? "Options" in OpenCart is exactly designed for that! It can help you set up different versions of the same product, as well as price variations.

Let's take a couple of real-world examples to understand this. Assume that you would like to provide different colors for the "T-­Shirt" product in your store. And you also want to charge a few extra bucks for the most popular colors. You can accomplish this using the Select option type in OpenCart. After you've set up the different colors on the admin side, the user is presented with a choice of different colors on the product details page. And yes, the user will be charged based on the color selection!

A more advanced example would be a "Graphic Tee" in which you would like to allow the user to upload an image which will be printed on the T‑shirt! In that case, you could use the File option type. Sometimes, you'll need to take some input from the user, like "Your Name", which will be printed on a key chain. And for that, the Text option type comes to the rescue!

So overall, Options involves some form of user input while purchasing the product. And if required, you can introduce price variations based on the user selection.

Different Types of Options

Now let's see the different types of options available in OpenCart.

Text and TextArea

This type of option is used to take some input text from the user. You could choose either Text, which will provide a text box, or TextArea, which provides a text area to the user for typing the required details.

File Upload

As the name suggests, you can use the File type of option in the case in which a user needs to upload a file for the product.

Date and Time

As you've probably guessed, this will ask the user to enter the date and time. There are three further different types available. The Date & Time type allows the user to enter the date and time together. Date allows the user to select only the date. In the same way, Time allows the user to select only the time. This option type is useful when you would like to ask the user to choose a delivery date.

Selection-Based Input

In this type of option, the user is presented with different items to choose from. There are four different types available for the user selection:

  • The Select type provides a drop-­down box to the user with different options.
  • The Radio type provides different radio buttons for each option.
  • The Checkbox type provides different checkboxes for each option. You could use this option when you want to provide multiple selections for the same option.
  • Image is somewhat similar to the Radio option type, but a user is presented with different images to choose from, instead of just text.

So that's it as far as different option types are concerned. Enough theory, let's dive into the action!

Set Up a Configurable Product

In this section, we'll set up a configurable product from the admin side. First of all, create a sample product named Graphic T­-Shirt from the back­-end of the admin side. You just need to enter the basic product information and choose the category. The details you enter into the product are not important, as we'll only concentrate on the Option tab available in the product edit interface. I'll get back to this at the end of this section.

We assume that our T-­shirt product is configurable in a way that one can choose color, enter some slogan text, and upload the image which will be printed on the T­‑shirt. Let's see how to accomplish this using the Options.

Add a "Color" Option

Head over to the back­-end of OpenCart. Go to Catalog > Options. It'll list out the existing options in the store. Click on the Insert button to create a new Color option.

Select Type of OptionSelect Type of OptionSelect Type of Option

As shown in the above screenshot, fill in the values. We've entered Color in the Option Name field. It'll be displayed as a title. The next field is Type, for which we've chosen Select, since we want to provide a drop-­down for the color. Sort Order is just used to display the different options in a certain order. For now, we'll enter 1 in that field.

Now that we've added basic information, you need to add option values. Obviously, in this case they'll be different colors. Click on the Add Option Value button to add values for the Color option. In the screenshot, it shows we've entered Red in the Option Value Name and again the Sort Order is 1. Let's ignore the Image field for the sake of simplicity now. In the same way add two more colors, Blue and Green.

Add a "Slogan Text" Option

Now let's go ahead and set up the "Slogan Text" option. Again, click on the Insert button on the Catalog > Options page.

Text Type of OptionText Type of OptionText Type of Option

As you can see, we've entered Slogan Text in the Option Name field. And the Type is set to Text. Sort Order is set to 2.

Add a "T­-shirt Image" Option

The last one is "T­-Shirt Image", so let's go ahead and add that. Click on the Insert button on the Catalog > Options page.

File Type of OptionFile Type of OptionFile Type of Option

As you can see, we've entered T­-Shirt Image in the Option Name field. And the Type is set to File. Sort Order is set to 3.

We've done with setting up "Options" stuff. Now, we need to associate our options with the product so that it can be displayed in the front­-end. I assume that you've created the sample product named "Graphic T­-Shirt" as I mentioned earlier. If you haven't done so yet, just do that before you proceed to the next section!

Assign Options to the Product

Let's edit the "Graphic T-­Shirt" product right away to add the options. Go to the Option tab in the product editing interface. On the left-hand side, you'll see the text box, which is auto-complete. If you type "Color", it will show you the "Color" option we added earlier.

Assign Color Option to the ProductAssign Color Option to the ProductAssign Color Option to the Product

Clicking on the Color option in the auto-complete text­ box will add a new row for color as shown in the screenshot. In that section, you can add different option values which you would like to display for the color option in the front­-end. Click on Add Option Value to add different color options.

As you can see, I've added three options: Blue, Green, and Red. The other important thing is the Price fields. For each option, you could vary the prices using the +/­- sign by the entered amount. Finally, you must specify the Quantity for each type of option, otherwise it won't get displayed in the front-end. So now we've finished with the "Color" option.

Now let's assign the "Slogan Text" in a similar way. We don't need any configuration for this field, as it'll be a simple text ­box.

Assign Slogan Option to the ProductAssign Slogan Option to the ProductAssign Slogan Option to the Product

Finally, lets assign the "T-Shirt Image". We don't need any configuration for this field either, because it'll be a simple file upload field.

Assign Image Option to the ProductAssign Image Option to the ProductAssign Image Option to the Product

After assigning all three options to the product, save it. And believe me, you're done!

Test Ride Front­-End

Let's straight away visit the product detail page in the fron­t-end to see the outcome!

Front-End PreviewFront-End PreviewFront-End Preview

Looks great, doesn't it? So you've just set up a configurable T­-shirt product which allows the user to choose the color, enter the text for the slogan, and upload an image. You've probably noticed that with each different color it charges extra money, as per our configuration in the back-end!

So now you should feel comfortable with Options and creating configurable products in OpenCart. So that's it for today! I would love to hear your feedback.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.