Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.17, csv import, meta
- This topic has 6 replies, 2 voices, and was last updated 6 years, 8 months ago by
Steven Zahm.
-
AuthorPosts
-
06/10/2016 at 2:58 pm #379096
Brittany
GuestHi Steven –
Thanks for all of the help you’ve given me so far in connections. I’ve come a long way learning the library and excited to use it on my client’s site when it goes live.
We’re working on importing CSV files which will populate entries in Connections.
We’ve created a custom metabox using this tutorial: http://connections-pro.com/2015/06/23/quicktip-custom-field-adding-a-text-field/We are now wanting to import data into the text fields that we’ve created in that custom metabox using the CSV importer. When I followed your tutorial on importing custom meta fields (http://connections-pro.com/2015/03/19/quicktip-csv-import-custom-meta-fields/), the data was actually populated into the Custom Fields section of managing/editing an entry NOT the inputs in the new metaboxes that I’ve created. Can you tell me how I can modify the code found in the CSV Import Custom Meta Fields QuickTip to actually populate the custom metabox fields instead of the “Custom Fields” section? Thanks!
06/10/2016 at 4:18 pm #379103Steven Zahm
Keymaster@ Brittany
You need to use the field ID of the text field in the code that imports the meta. I’ll try to illustrate using the examples…
In the text field tutorial the field ID is
field_id
to import into that field as shown in the CSV import tutorial change the instances ofmember_level
tofield_id
(3 instances).Does that make sense?
06/10/2016 at 4:51 pm #379112Brittany
GuestHi Steven –
Does make sense. I actually did exactly that & the fields are still added the Custom Field area, not the custom field metabox :( Find my code below (added to functions.php).
/* Register a custom metabox with text field on the connections add entry page */ add_action( 'cn_metabox', 'my_connections_custom_metabox_and_text_fields' ); function my_connections_custom_metabox_and_text_fields() { $atts = array( 'title' => 'Memorial Locations', // Change this to a name which applies to your project. 'id' => 'memorial_locations', // Change this so it is unique to you project. 'context' => 'normal', 'priority' => 'core', 'fields' => array( array( 'name' => 'Superintendent\'s Honored Star Case', // Change this field name to something which applies to you project. 'show_label' => TRUE, // Whether or not to display the 'name'. Changing it to false will suppress the name. 'id' => 'sup_honored_star_case', // Change this so it is unique to you project. Each field id MUST be unique. 'type' => 'text', // This is the field type being added. 'size' => 'regular', // This can be changed to one of the following: 'small', 'regular', 'large' ) //...more fields here ), ); cnMetaboxAPI::add( $atts ); } /* CSV Importer Custom Meta Fields*/ add_filter( 'cncsv_map_import_fields', 'cncsv_import_meta_fields_options' ); function cncsv_import_meta_fields_options( $fields ) { echo print_r($fields); $fields['sup_honored_star_case'] = 'Memorial Locations | Superintendent\'s Honored Star Case'; //....more fields here return $fields; } add_action( 'cncsv_import_fields', 'cncsv_import_meta_fields_import', 10, 2 ); function cncsv_import_meta_fields_import( $id, $row ) { $sup_honored_star_case = isset( $row->sup_honored_star_case ) ? $row->sup_honored_star_case : ''; //...more fields here cnEntry_Action::meta( 'update', $id, array( array( 'key' => 'Superintendent\'s Honored Star Case', 'value' => $sup_honored_star_case ) //......more fields here ) ); }
06/13/2016 at 9:37 am #379295Brittany V
GuestYour CSV import meta fields QuickTip is putting the meta data into the Custom Fields part of the “Add Entry” page, and your Custom Metabox QuickTip creates a completely different text input area separate from the Custom Fields box in the “Add Entry” page.
06/13/2016 at 10:35 am #379303Steven Zahm
Keymaster@ Brittany
This line:
'key' => 'Superintendent\'s Honored Star Case',
Should be this:
'key' => 'sup_honored_star_case',
The field ID (
id
) use when adding the custom field and thekey
when importing the meta via CSV need to match.Sorry, I overlooked adding that direction in my previous reply!
06/13/2016 at 10:50 am #379307Brittany V
GuestCool – such a small & dumb mistake on my end! Thanks so much! that fixed the issue. The custom meta data is now being imported into the custom metaboxes that I made via the CSV importer.
06/13/2016 at 11:13 am #379310Steven Zahm
Keymaster@ Brittany
Great to hear it is working now! Glad I could help!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.