Skip to content

Instantly share code, notes, and snippets.

@pcave
Last active July 18, 2016 16:48
Show Gist options
  • Save pcave/1842c35e4ed8df10a686730bbd705d8e to your computer and use it in GitHub Desktop.
Save pcave/1842c35e4ed8df10a686730bbd705d8e to your computer and use it in GitHub Desktop.
Make product id and type mappable
// Add new alter hook in _salesforce_mapping_get_entity_fields
// Give other modules a chance to alter the entity fields available for mapping.
drupal_alter('salesforce_mapping_entity_fields', $entity_fields, $entity_type, $entity_bundle_type);
/**
* Implements hook_salesforce_mapping_entity_fields_alter().
*/
function salesforce_line_item_salesforce_mapping_entity_fields_alter(&$entity_fields, $entity_type, $entity_bundle_type) {
if ($entity_type == 'commerce_line_item' && $entity_bundle_type == 'designation') {
$entity_fields['Product']['commerce_product:product_id'] = 'Product ID';
$entity_fields['Product']['commerce_product:type'] = 'Product Type';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment