Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git plugins/FeedsCommerceProductProcessor.inc plugins/FeedsCommerceProductProcessor.inc
- index 73430c6..f8caa14 100644
- --- plugins/FeedsCommerceProductProcessor.inc
- +++ plugins/FeedsCommerceProductProcessor.inc
- @@ -50,7 +50,9 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
- * Save a product.
- */
- public function entitySave($entity) {
- - commerce_product_save($entity);
- + if (!($this->config['create'] == 0 && isset($entity->is_new))) {
- + commerce_product_save($entity);
- + }
- }
- /**
- @@ -69,6 +71,7 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
- return array(
- 'product_type' => $type,
- 'author' => 0,
- + 'create' => 0,
- ) + parent::configDefaults();
- }
- @@ -98,6 +101,14 @@ class FeedsCommerceProductProcessor extends FeedsProcessor {
- FEEDS_SKIP_EXISTING => 'Do not update existing products',
- FEEDS_UPDATE_EXISTING => 'Update existing products',
- );
- + $form['create'] = array(
- + '#type' => 'checkbox',
- + '#title' => 'Create new commerce products',
- + '#description' => t('When a product doesn\'t exist should we create a new product?'),
- + '#default_value' => $this->config['create'],
- + '#weight' => 0,
- + );
- +
- return $form;
- }
Add Comment
Please, Sign In to add comment