Okay
  Public Ticket #2979450
Data Collection
Closed

Comments

  • Nicolas started the conversation

    Hello,

    We need to add some item to collect more informations about client.

    We created in popup-display-template.php 3 news field :

    Adresse 

    Code Postal

    Ville

    But at this point, data are not save in the table.  Can you telle us where and what we need to change to register this data and, to export they after.


    Thank you very much for help !

  •  1,906
    WebWizards replied

    Hi Nicolas,

    Thank you for purchasing our plugin!


    To do this, you can follow these steps:

    1) The table is created when the plugin is activated. This is controlled in the file in includes/class-wproulette-activator.php . You need to edit this function to add 3 lines in the SQL, for your 3 fields.

    You should add something like this:

    adresse tinytext,
    ville tinytext,
    code_postal tinytext,
    


    This only runs when the plugin is activated. So you will need to install the plugin in a new site. OR you will need to go to PHP MY ADMIN and delete the table "wprw_roulettewheel". Then deactivate and activate the plugin again. This is because you need the table to be created again, with space for your new fields.


    2) Go to the file in includes/class-wproulettewheel-database.php and go to the function insert(){


    Here you will find some lines like

    $sanitized_phone_number = sanitize_text_field($_POST['phone-number']);
    

    You need to create lines for your 3 fields (based on your field NAME). For example:

    $sanitized_code_postal = sanitize_text_field($_POST['code-postal']);
    


    In the $data variable in the same function, you also need to add your variable, for example 

    'code_postal' => $sanitized_code_postal

    3) If you want to modify the download, you need to go to the same database.php file and edit the download() function. You need to add your fields here also, so they can be in the downloaded CSV file.


    Kind regards,

    Stefan