Building E-commerce Sites with VirtueMart Cookbook
上QQ阅读APP看书,第一时间看更新

Custom fields – show related products on the product details page

We can achieve so many things by using the custom fields tab of the product we want to show related products of. But this is simpler than other custom fields recipes, in that we don't have to create a custom field first. Showing related products is often a good idea as it encourages customers to make more purchases.

Getting ready

Make sure you have created the products you want to use as related products.

How to do it...

We have created Joomla! the Movie and we will be making it a related product to the VirtueMart the Movie product. Here is how to do it:

  1. Select the Products links from the Products menu. Click on the product you want to add related products to. Now click on the Custom Fields tab of that product.
  2. Scroll down to the Related Products search box and begin typing the name of the product you want this product to relate to, as shown in the following screenshot:
  3. Click the product you want to add, click on Save, then search again and add any other products you want this one to relate to. Click on Save.

How it works...

If you go and visit the product details page, you will see that VirtueMart has created a custom field showing your related product(s), as shown in the following screenshot:

There's more...

You probably noticed while completing this recipe that you could use exactly the same process if you wanted the product to relate to a whole category of products. Just type your search and make your selections from the Related Categories section instead, as shown in the following screenshot: