Results 1 to 2 of 2

Thread: Custom Fields CSV Import Question

  1. #1
    Thread Starter
    red20me's Avatar
    Join Date
    Jul 2013
    Location
    United Kingdom
    Posts
    473
    Thanks
    1
    Thanked 104 Times in 93 Posts

    Custom Fields CSV Import Question

    I've posted about this before but I need to ask again.

    If you enter a listing via the admin or front end and that listing has a custom field which is a multiple checkbox, each ticked value gets stored separately in wp_postsmeta (and that's fantastic).

    If I import a CSV that includes that custom field with multiple values separated by commas, my listing gets imported but I only have one row on wp_postmeta with all my custom field values strung together. For the purposes of my listing display, I NEED these two methods of data entry to behave in the same way.

    I *think* the answer is in my child them functions.php , where I have this function:

    Code:
    function aspph_custom_csv_fields( $args )
    {

    $args['custom_fields']['price'] = array( 'internal_key' => 'app_price' );
    $args['custom_fields']['specialoffers'] = array( 'internal_key' => 'app_special-offers' );
    $args['custom_fields']['contactemailaddress'] = array( 'internal_key' => 'app_business-owner-email-address' );

    $args['custom_fields']['day'] = array( 'internal_key' => 'app_day' );
    $args['custom_fields']['time'] = array( 'internal_key' => 'app_time' );
    $args['custom_fields']['extrainfo'] = array( 'internal_key' => 'app_extra-info' );
    $args['custom_fields']['age-group'] = array( 'internal_key' => 'app_age-group' );

    return $args;
    }
    The first 3 $args are standard text field custom fields. The next 4 $args rows relate to multiple checkbox custom fields which allow 'tick all that apply'.

    I *think* I need some extra array() code around what I've got there for this to work as expected, but I can't figure it out. I have seen this comment in importer.php but I can't translate that into what I need in my functions.php?

    Code:
    /*
    * Args can have 3 elements:
    * 'taxonomies' => array( 'valid', 'taxonomies' ),
    * 'custom_fields' => array(
    * 'csv_key' => 'internal_key',
    * 'csv_key' => array(
    * 'internal_key' => 'key',
    * 'default' => 'value'
    * )
    * ),
    * 'tax_meta' => array( array( 'tax' => array( 'csv_key' => 'tax_key' ) )
    */
    Any clues would be much appreciated...I'm pretty desperate! I'm sure I should be able to figure this out but just can't see it....

    Many thanks,

    red20

  2. #2
    joes's Avatar
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    877
    Thanks
    12
    Thanked 358 Times in 261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CSV Import with custom fields for Classipress
    By swaynevds4755 in forum ClassiPress General Discussion
    Replies: 24
    Last Post: March 16th, 2016, 11:38 AM
  2. import custom fields - possible?
    By almightyeric in forum Report ClassiPress Bugs
    Replies: 4
    Last Post: August 18th, 2012, 04:03 PM
  3. Custom Fields Import
    By bbihun12 in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: August 15th, 2012, 03:33 PM
  4. Custom Fields question
    By marinos in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: May 4th, 2011, 12:35 AM
  5. Custom Fields Question - Is it possible to do this
    By kplunk in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: November 19th, 2010, 12:18 PM