Creating generic child products with Virtuemart 2.0.8

Friday, 10 August 2012 14:40 Written by  Ed
Rate this item
(7 votes)

If you use the Virtuemart 2 component for web design with Joomla! then there will come a time when you will need to add attributes to products. When I use the term attributes I mean variations on a product that may or may not affect the price. For example we have been working with a company that produces LED displays. These displays may be red or yellow (another example may be having a Tshirt in various sizes Small, Medium, Large).  The site visitor needs to be able to select one of these values for each product in Virtuemart.

In older versions of Virtuemart you could simply add attributes to the product in the Product Status page. However alot of things have changed with version 2 and attributes are one of them. To achieve the same goal you need to approach the problem in a different way.

You need to create child products each with its own value. To do this navigate to the product to which you need to add the values and go the the Product Information page. Scroll down until you see the Add a Child Product Button. Click these and enter the necessary details. In the screen shot below we can see there are three child products added to the main or parent product.

Virtuemart child products - Joomla web design

We need then create a custom field in Virtuemart to display these child products on the product details page of the parent or original product. Navigate to the Custom Fields section in Virtuemart and create a new Custom Field. Choose type as Generic child variant. Check the Cart attribute to yes.

Virtuemart custom field - Joomla web design

We need then associate this custom field with the parent or original product we wish to add the custom values to.Navigate to the original product and select the custom fields tab.

Virtuemart custom fields

You will see a dropdown box Custom Field Type. Choose the name of the Custom fields you created earlier. Save and close the product. Now navigate to that product in the frontend of your web site and you should see a dropdown with the choice of child product you created earlier.

Virtuemart custom fields dropdown

Last modified on Wednesday, 05 December 2012 09:57
Ed

Ed