Guest User

Untitled

a guest
Jan 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. diff --git plugins/FeedsCommerceProductProcessor.inc plugins/FeedsCommerceProductProcessor.inc
  2. index 73430c6..f8caa14 100644
  3. --- plugins/FeedsCommerceProductProcessor.inc
  4. +++ plugins/FeedsCommerceProductProcessor.inc
  5. @@ -50,7 +50,9 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
  6. * Save a product.
  7. */
  8. public function entitySave($entity) {
  9. - commerce_product_save($entity);
  10. + if (!($this->config['create'] == 0 && isset($entity->is_new))) {
  11. + commerce_product_save($entity);
  12. + }
  13. }
  14.  
  15. /**
  16. @@ -69,6 +71,7 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
  17. return array(
  18. 'product_type' => $type,
  19. 'author' => 0,
  20. + 'create' => 0,
  21. ) + parent::configDefaults();
  22. }
  23.  
  24. @@ -98,6 +101,14 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
  25. FEEDS_SKIP_EXISTING => 'Do not update existing products',
  26. FEEDS_UPDATE_EXISTING => 'Update existing products',
  27. );
  28. + $form['create'] = array(
  29. + '#type' => 'checkbox',
  30. + '#title' => 'Create new commerce products',
  31. + '#description' => t('When a product doesn\'t exist should we create a new product?'),
  32. + '#default_value' => $this->config['create'],
  33. + '#weight' => 0,
  34. + );
  35. +
  36. return $form;
  37. }
Add Comment
Please, Sign In to add comment