Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #7094
    Cosmin
    Member

    Salut,
    I have some understanding issues on how to “persuade” the csv-upload to work with FormBuilder custom fields.

    Lets say we have Form ID 2 named FormNo2.
    Lets say we have defined the following fields: item_name, gr_abc, con_xyz, a_textarea[],gr_asdf

    Then a proper csv file would look like this:
    item_name;form_id;gr_abc;con_xyz;a_textarea[];gr_asdf
    Item Name;2;ABC;;option_1,option_2;ASDF

    Am I missing something?
    The upload creates the “empty” List entry but no Form fields entries [no entry into the bepro_listing_form table].

    Is there a trick I am missing? The csv documentation does not cover the FormBuilder.

    Thanks for your time!

    #7098

    Hi,

    Your best bet is to use the BePro Listings Exports plugin. It gets the fields and exports a properly formatted csv

    https://www.beprosoftware.com/shop/bepro-listings-export

    You can setup the csv file yourself by tying the following:

    – “a_textarea” should not have brackets after it in the csv.
    – To specify form 2, you should use the heading “bl_form_id”.

    Let us know if these steps help.
    ___
    BePro Software Team

    #7100
    Cosmin
    Member

    Salut,
    thanks for your heads up – the bl_form_id was needed for the upload on the form table.

    I have a problem with checkbox and categories fields
    The csv-upload ignores coma separated categories and messes up the checkboxes values by quoting the whole thing in double quotes, for example none of these work for checkbox:

    a,b,c
    "a,b,c"
    "a","b","c"
    [a,b,c]
    ["a","b","c"]
    a|b|c

    So how do I write checkbox values?

    • This reply was modified 8 years, 6 months ago by Cosmin.
    #7102

    Hi,

    What delimiter are you using?
    ___
    BePro Software Team

    #7128
    Cosmin
    Member

    Salut.

    Delimiter is ;

    bl_form_id;checkboxfield;dropdown
    2;a,b,c;x
    #7130

    Hi,

    It looks like you should be using the following

    2;”a,b,c”;x

    If you have actual category ID’s, that would be best
    ___
    BePro Software Team

    #7162
    Cosmin
    Member

    It is simply not working.
    “a,b,c” is added in database as “a,b,c” when the expected format is [“a”,”b”,”c”]
    Trying to add [“a”,”b”,”c”] ends-up as “[\”a\”,\”b\”,\”c\”]”

    I’m running Listings 2.1.99991 and Form Builder 1.0.36
    I see that Listings 2.1.99999 (July 23rd, 2015) made some changes for csv-upload but none refer to check box fields.

    #7169

    Hi,

    Thanks for sharing these details. Is there are reason why you have not updated both BePro Listings and the Form Builder to the latest version?

    ___
    BePro Software Team

    #7206
    Cosmin
    Member

    Yes,
    various improvements and custom code made to some functions – I needed to finish developing before handling cosmetics.

    I haven’t got my time to deal with this issue ftm, do you think there’s an update I’m missing in order to make this functionality work in the expected way?

    Thanks

    #7211

    Yes,

    I believe that if you upgrade, the category upload will be fixed. We released an upgrade directly addressing it, check out changelog. Once that is confirmed fixed, we can focus on diagnosing the checkbox upload issue

    ___
    BePro Softare Team

    #7524
    Cosmin
    Member

    Hello.
    I have updated both listings and form builder to the latest release.

    Uploading by csv does not work for checkbox fields!

    Example for 3 checkbox fields in the csv file:
    checkbox fields: gr_program;gr_limbi_secundare;gr_curriculum;
    delimiter: ;

    What’s in the CSV

    bl_form_id;item_name;gr_program;gr_limbi_secundare;gr_curriculum;gr_alimentatie;gr_somn;gr_limba_principala
    2;CSV Temp V4;"scurt,lung,mediu";[Engleză,Franceză];Curriculum Britanic,Curriculum Francez;"Bucătărie Proprie";da;Română

    What’s in the DB

    {"item_name":"CSV Temp V4","gr_program":"scurt,lung,mediu","gr_limbi_secundare":"[Englez\u0103,Francez\u0103]","gr_curriculum":"Curriculum Britanic,Curriculum Francez","gr_alimentatie":"Buc\u0103t\u0103rie Proprie","gr_somn":"da","gr_limba_principala":"Rom\u00e2n\u0103","save_bepro_listing":1}

    As you can see, none of the 3 variants work for a checkbox field – the DB output should have been:
    “gr_program”:[“scurt”,”lung”,”mediu”]

    Please give me a solution.

    #7528
    Cosmin
    Member

    Salut.
    Can you tell me the name of the function dealing with csv uploads?

    #7529
    Cosmin
    Member

    I performed the following fix:

    In bepro_listings_admin.php
    I changed this loop to verify that csv field looks like [option,option,option…]
    Basically all the check-box fields should be in square brackets.

    
    				while (($results = fgetcsv($file,0,$delimiter)) !== false){
    					if($counter > 0){
    						$_POST = "";
    						foreach($results as $key => $result){
          // START OF joe csv upload
    						  if ( preg_match("~^\[(.)*\]$~",$result) ){
    						    $result=substr(substr($result,0,-1),1);
      						  $checkbos_result=explode(",",$result);
      						  $_POST[$csv_titles[$key]] = $checkbos_result;
      						  //var_dump($result);
    						  } else{
                    $_POST[$csv_titles[$key]] = $result;
                  }
          // END OF joe csv upload
          //$_POST[$csv_titles[$key]] = $result;
    						}
    

    also note that fgetcsv from this loop was restricted to 1500 characters – this should be customised in admin dashbord as it creates an artificial limit of 1500 characters to the file [and 0=unlimited by default is not desirable as it should be slower]

    #7531

    Hi,

    Thanks for sharing this code snippet. Our development team will test your solution and confirm its the best approach.
    ___
    BePro Software Team

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.