I've got a content type used to define places, i've enabled location module and enabled (for that content type) all the locative informations including phone and fax numbers BUT when i try to import my .csv via node_import, i cannot see the Phone or Fax fields in the dropdown of available fields to import to.
So i tried to see into "supported" subdir of node_import module where i noticed all supported content types definitions are in. I edited location.inc and realized that the fileds are collected from the function location_field_names() which i think is in locaiton module. I don't kow if i can override that or it's a problem of communications between location module and node_import module.
So, simply, how can i import using phone nad fax location field too ?

Comments

redmood’s picture

.. obvuously the title was intented to be: "unable to import phone and fax numbers... " and not "enabled to import..." :-) sorry

nexco’s picture

Title: enabled to import phone and fax numbers into location (module) fields using node_import » Fix for missing phone, fax and additional fields in node_import - Patch #1

I too had this issue and discovered two places in the code of location.module that, if changed, popped everything into place. This patch fixes all three of the missing phone, fax and additional street fields which do not display in the node_import field mapping popup. More testing of these changes is needed but it works for me now.

This first bit of code adds the missing phone and fax fields into the mapping popup in node_import, it also adds the missing 'additional' street address field as a bonus. (But the 'additional' field won't show up unless you make the second change entered below this first one.)

location.module
starting line 339 approx

...
$form['#theme'] = 'location_map_link_options';
     return system_settings_form($form);
}

function location_field_names() {
-    return array('name' => t('Location name'), 'street' => t('Street location'), 'city' => t('City'), 'province' => t('State/Province'), 'postal_code' => t('Postal code'), 'country' => t('Country'));
+   return array('name' => t('Location name'), 'street' => t('Street Line 1'), 'additional' => t('Street Line 2'), 'city' => t('City'), 'province' => t('State'), 'postal_code' => t('Zip Code'), 'country' => t('Country'), 'phone' => t('Phone'), 'fax' => t('Fax'));
}

function location_geocoding_parameters_page($country_iso, $service) {
   drupal_set_title(t('Configure parameters for %service geocoding', array('%service' => $service)));
...   

This second bit of code adds the missing additional street info radio button default choices into a content type's locative edit screen. Once you have added this code to the location.module, go to edit your content type and open the locative information. You will see the newly added 'Additional Street Info' radio buttons. Make a choice and save the content type. If you have chosen to work with the additional field you will now see it too has been added to the node_import popup.

location.module
starting line 636 approx

    $form['location']['location_street'] = array(
      '#type' => 'radios',
      '#title' => t('Street locations'),
      '#default_value' => variable_get('location_street_'. $type, $default),
      '#options' => array(t('Do not collect a street location for content of this type.'), t('Allow street locations to be submitted for content of this type.'), t('Require street locations to be submitted for content of this type.'))
    );
    
+  //BEGIN NEW CODE
+ 
+     $form['location']['location_additional'] = array(
+      '#type' => 'radios',
+      '#title' => t('Additonal Street Info'),
+      '#default_value' => variable_get('location_additional_'. $type, $default),
+      '#options' => array(t('Do not collect additional street location info for content of this type.'), t('Allow additional street location info to be submitted for content of this type.'), t('Require additional street location info to be submitted for content of this type.'))
+    );
+    
+  //END NEW CODE

  $form['location']['location_city'] = array(
      '#type' => 'radios',
      '#title' => t('City names'),
      '#default_value' => variable_get('location_city_'. $type, 0),
      '#options' => array(t('Do not collect city names for content of this type.'), t('Allow city names to be submitted for content of this type.'), t('Require city names to be submitted for content of this type.'))
    );
pcorbett’s picture

Status: Active » Reviewed & tested by the community

I can confirm this patch works for me.

brf123’s picture

Can you post the completed file or pm with a link? I think that the line numbers are not matching up and I would like to implement this for a vendor database. Thanks!

Robrecht Jacques’s picture

Status: Reviewed & tested by the community » Closed (duplicate)