Products with variants
Index of tables:

Steps for inserting a product with variants:

  1. in tbl_vari insert generic variant types ; the name of a type inherited in this way will be visible for all the variants with this criterion of variation. If a product variant has a type which is not specified in this table, it will appear as "type: x" in the public area.
  2. in tbl_valvari you can, optionally, insert the values of variants for each type from tbl_vari. These values are also generic.
  3. in tbl_artroot insert a record with codroot = code of the root product, numliv = number of levels; from 1 to numliv specify the lungvar for the values of the variant type (the lungvar for a level will be the maximum length allowed for the codes of variants for that type). This is one of the most important settings related to the variants structure.
  4. in tbl_varliv you can set, for each variant type (for a code root), one of the existing types from tbl_vari. The types are identified by the level number.
  5. the main step while creating a variant is to insert into tbl_objects and tbl_objects_lng records for every new variant of the root product.

    The rules are:
      -  in the codroot field insert the code of the root product
      -  for every variant value complete the code of variant value (field codvarX), optionally from tbl_artvar.

    If in tbl_artvar there is no record with this codvar, the public area will display the value from codvarX. When inserting the record in tbl_objects, you also have to complete the tbl_objects_lng following the rules described in the module - products.

See also the structure of tbl_objects and check the codroot, codvar1, codvar2, codvar3 fields.

Table tbl_vari -- Variant types

Field name Field description Field type Field size key required default Observation
codvari Variant type code VARCHAR 50 yes yes    
code_lng Language code (e.g.: IT, EN, FR, DE, ES, RO) CHAR 2 yes yes IT ISO code of the language - uppercase
[VIEW the table of Language Codes]
desvari Type name VARCHAR 30       e.g.: colour
lung Length of values code SMALLINT 2   yes 0  
longdesvari5.3 Long description of variant type TEXT          

Table tbl_valvari -- Variant values

Field name Field description Field type Field size key required default Observation
codvari Variant type code VARCHAR 4 yes yes   Linked to codvari from tbl_vari
code_lng Language code (e.g.: IT, EN, FR, DE, ES, RO) CHAR 2 yes yes IT ISO code of the language - uppercase
[VIEW the table of Language Codes]
valvari Variant value code VARCHAR 50 yes yes    
desvvar Name of the variant value VARCHAR 40       e.g.: red, blue
filevar File or colour of the variant value VARCHAR 50       could be the name of an image (myImg.gif) or a colour (#777777)
longdesvvar5.3 Long description of variant value TEXT          

Table tbl_artroot -- Contains general information about product and the length of variant values per level; also about the management method of prices

Field name Field description Field type Field size key required default Observation
codroot Code of the root VARCHAR 12 yes yes   Linked to codroot from tbl_objects
code_lng Language code (e.g.: IT, EN, FR, DE, ES, RO) CHAR 2 yes yes IT ISO code of the language - uppercase
[VIEW the table of Language Codes]
descr Description of the root VARCHAR 40   yes    
numliv Number of levels for the root SMALLINT 2   yes 0  
lungroot Length of the root SMALLINT 2        
lungvar1 Length of the code for the level variant 1 SMALLINT 2   yes 0  
lungvar2 Length of the code for the level variant 2 SMALLINT 2   yes 0  
lungvar3 Length of the code for the level variant 3 SMALLINT 2   yes 0  
prevar1 Flag for prices administration (one of the values: 'N' - common prices for all variants, 'S' - different prices) VARCHAR 1   yes N  

Table tbl_artvar -- Contains the values of variant for every codroot and level

Field name Field description Field type Field size key required default Observation
codroot Code of the root VARCHAR 12 yes yes   Linked to codroot from tbl_objects
code_lng Language code (e.g.: IT, EN, FR, DE, ES, RO) CHAR 2 yes yes IT ISO code of the language - uppercase
[VIEW the table of Language Codes]
livello Variant level SMALLINT 2 yes yes 0  
codvar Variant value code VARCHAR 50 yes yes   linked to codvar1 from tbl_objects if livello = 1; codvar2 for livello=2; codvar3 for livello=3
descr Variant value description VARCHAR 40        
filevar Variant file varchar 255       File must be uploaded on the server
price5.3 Difference of price double         Used only when option 'Configuratore varianti' is enabled
defaultInCombo5.3 Default value selected in combo char 1       Used only when option 'Configuratore varianti' is enabled

Table tbl_varliv -- Relates the variant level to the type name

Field name Field description Field type Field size key required default Observation
codroot Code of the root VARCHAR 12 yes yes 0 Linked to codroot from tbl_objects
livello Variant level SMALLINT 2 yes yes 1  
codvari Variant type code VARCHAR 50 yes yes   Linked to codvari from tbl_vari

Table tbl_ec_varexcluded --Excluded combinations of variants5.3

Observation: Used only when option 'Configuratore varianti' is enabled

Field name Field description Field type Field size key required default Observation
codroot Code of the root VARCHAR 100 yes yes  
codvari_1 First part of the comb. - code of the variant type VARCHAR 50 yes yes    
valvari_1 First part of the comb. - code of the variant value VARCHAR 50 yes yes    
codvari_2 Second part of the comb. - code of the variant type VARCHAR 50 yes yes    
valvari_2 Second part of the comb. - code of the variant value VARCHAR 50 yes yes