We have just made a new functionality available for Konfeo users: the import/export of discount codes from/to a CSV file. We assume that there is no need to describe in detail how it works, but it is worth explaining the issue of proper file preparation (download sample file).
File structure
The file consists of the following parameters:
- code – discount code *
- value – code value *
- kind – code type *
- amount – code usage limit
- taken – number of codes used
- valid_from – code start date
- valid_until – code expiration date
- groups – tickets/groups in which the code is valid
You must enter values for the first three parameters (marked with an asterisk), while the remaining ones – as needed.
Parameter values
Parameter | Description |
---|---|
code | Discount code that you use in a given event (string) |
value | Depending on the kind parameter: prc – integer, sum, and fix – the number can have values after the decimal point |
kind | The field accepts only one of three values: prc – percentage discount, sum – amount discount, fix – fixed price |
amount | Limit of code usage by participants (integer) |
taken | Number of codes used (integer, ignored during import and always set to “0”) |
valid_from | Code validity start date in the following format YYYY-MM-DD HH:MM:SS ZONE, e.g. 2034-05-03 07:40:00 UTC (if no time zone is specified, the zone set in the event is assumed) |
valid_until | The expiration date of the code, format details above. The date must have a future value |
groups | The names of the tickets/groups for which the code is valid. In the case of multiple tickets, you should separate names by a vertical bar “|” , e.g. Early registration|Late registration |
Import rules
During import, the program tries to match the indicated tickets/groups to those existing in the event. If any are unavailable, it will skip them. The code will work for all if it can’t find a match. Import checks and reports the following errors:
- the file is not in CSV format
- a required column is missing
- no codes to import (only headers in the file)
- standard validations for discount codes – checking the uniqueness of the code, correct field format, and date values
If any of the above errors occur, no code will be imported. In the case of validation errors, the program will indicate the line number where the problem was found and information about the field that contains the error.