Adding import support to International Addr Field

More
9 years 7 months ago - 9 years 7 months ago #53890 by ChobPT
Hello all,

First of all, please know that this is my first submission of a solution, so don't judge, I'm just trying to help :)

The problem:
When using the FlexiContent Import function, the data for the International Address field introduced on 2.2.1 is not properly inserted.

The cause:
In pratical terms, because the data is going to a Array inside another array, something like:
Array(1)([0]=>Array(10)([addr1][addr2].......))
Instead it should be directly inside the first array, like:
Array(10)([addr1][addr2].......)

I am not very good explaining why this happens, it's the way of flexicontent to import... if someone wants to explain to the community, awesome :)

The sollution:
On (Joomla Directory)/administrator/components/com_flexicontent/controllers/import.php line 521

Replace:
Code:
if ( $task != 'testcsv' ) foreach($_d as $fieldname => $field_values) { if ( $fieldname=='tags_names' ) {

with
Code:
if ( $task != 'testcsv' ) foreach($_d as $fieldname => $field_values) { if ( $fieldname=='property_address' ) { $field_values['addr1'] = $field_values[0]['addr1']; $field_values['addr2'] = $field_values[0]['addr2']; $field_values['addr3'] = $field_values[0]['addr3']; $field_values['city'] = $field_values[0]['city']; $field_values['state'] = $field_values[0]['state']; $field_values['province'] = $field_values[0]['province']; $field_values['zip'] = $field_values[0]['zip']; $field_values['country'] = $field_values[0]['country']; $field_values['lat'] = $field_values[0]['lat']; $field_values['lon'] = $field_values[0]['lon']; /*echo "<br>"; print_r($field_values);*/ } if ( $fieldname=='tags_names' ) {

uncomment the Print_r bit to see the array data when the import script is running in admin.

Simple! and it works :)

To-do:

This is not the perfect sollution and still insert the Array[0] data. It will duplicate the data but it will work.

I didn't create the Unset function because I don't know the code and I'm a bit afraid of breaking the import script :)

Cheers and thanks to the creators for such a good extension :)
Last edit: 9 years 7 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #53891 by ggppdk
Hello

thanks for your posting

import support for non-core fields should go inside the field code,

a lot have changed in FLEXIcontent v3 in regards to fields too

and v3 BETA6 is almost ready, which is our last v3 BETA
then RC and then offical v3 release

please use:
github.com/FLEXIcontent/flexicontent-cck/releases


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.584 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline