Shopperfields

Written by Max Milbers. Posted in Concepts

Shopperfields gather user input

Usually a shopper must provide data to be able to buy, pay, and retrieve the goods. Most shops need different forms according to the country, language, cultural habits, and wares.

VirtueMart provides different types of shopperfields and also the possibilty to extend them by plugins. Any shopperfield can be set to required and the views in which they should be displayed can be selected.

Defaults can be set. In case of the country or state field, it is possible to use an id for the default. 

The userfield "custom" allows to create customised shopperfields, which use as layout file the name of the shopperfield. For example the shopperfield tos, uses the layout file tos.php in /components/com_virtuemart/sublayouts

Technical backgrounds

Shopperfields are handled as rows in the "userfields" table, but create columns in the userinfo and order_userinfo tables. So adding a new shopperfield with the name "xyz", creates a new column "xyz" in the tables userinfo and order_userinfo. This tables keep sensitive user information. Therefore deleting a shopperfield does not just delete the columns in the tables, instead they are renamed. An accidently added shopperfield with already existing name should be renamed. This should prevent the worst, but working on the shopperfields must be done with caution. Or in other words, just do not mess around with it.