Skip to main content

Thanks everyone, I got the answer. Instead of using Rules, I created a "custom feeds module."

Steps:

  1. Create a folder named "custom_feeds"

  2. Create two files, one is "custom_feeds.info", another is "custom_feeds.module"

    Create a folder named "custom_feeds"
  3. Add following information in the .info file: ; $Id: $ name = custom feeds module description =custom feeds module core = 7.x package = Feeds dependencies[] = feeds

    Create two files, one is "custom_feeds.info", another is "custom_feeds.module"
  4. Add following code in the .module file inside '<'?php?>': function custom_feeds_feeds_presave(FeedsSource $source, $entity, $item) { // check that this is fired only for the importer being used if($source->importer->id=='recommended_product_import'){ // "equivalent" is the column name in excel sheet if(!strcmp($item['equivalent'],"")){ $entity->feeds_item->skip = TRUE; } } }

    Add following information in the .info file:
name = custom feeds module
description =custom feeds module
core = 7.x
package = Feeds
dependencies[] = feeds</code>
  1. Add following code in the .module file inside <?php ?>:
function custom_feeds_feeds_presave(FeedsSource $source, $entity, $item) {
  // check that this is fired only for the importer being used
  if($source->importer->id=='recommended_product_import'){
     // "equivalent" is the column name in excel sheet
     if(!strcmp($item['equivalent'],"")){
       $entity->feeds_item->skip = TRUE;
     }
  }
}

Thanks everyone, I got the answer. Instead of using Rules, I created a "custom feeds module."

Steps:

  1. Create a folder named "custom_feeds"

  2. Create two files, one is "custom_feeds.info", another is "custom_feeds.module"

  3. Add following information in the .info file: ; $Id: $ name = custom feeds module description =custom feeds module core = 7.x package = Feeds dependencies[] = feeds

  4. Add following code in the .module file inside '<'?php?>': function custom_feeds_feeds_presave(FeedsSource $source, $entity, $item) { // check that this is fired only for the importer being used if($source->importer->id=='recommended_product_import'){ // "equivalent" is the column name in excel sheet if(!strcmp($item['equivalent'],"")){ $entity->feeds_item->skip = TRUE; } } }

Thanks everyone, I got the answer. Instead of using Rules, I created a "custom feeds module."

Steps:

  1. Create a folder named "custom_feeds"
  2. Create two files, one is "custom_feeds.info", another is "custom_feeds.module"
  3. Add following information in the .info file:
name = custom feeds module
description =custom feeds module
core = 7.x
package = Feeds
dependencies[] = feeds</code>
  1. Add following code in the .module file inside <?php ?>:
function custom_feeds_feeds_presave(FeedsSource $source, $entity, $item) {
  // check that this is fired only for the importer being used
  if($source->importer->id=='recommended_product_import'){
     // "equivalent" is the column name in excel sheet
     if(!strcmp($item['equivalent'],"")){
       $entity->feeds_item->skip = TRUE;
     }
  }
}
Source Link
jmu
  • 290
  • 1
  • 13

Thanks everyone, I got the answer. Instead of using Rules, I created a "custom feeds module."

Steps:

  1. Create a folder named "custom_feeds"

  2. Create two files, one is "custom_feeds.info", another is "custom_feeds.module"

  3. Add following information in the .info file: ; $Id: $ name = custom feeds module description =custom feeds module core = 7.x package = Feeds dependencies[] = feeds

  4. Add following code in the .module file inside '<'?php?>': function custom_feeds_feeds_presave(FeedsSource $source, $entity, $item) { // check that this is fired only for the importer being used if($source->importer->id=='recommended_product_import'){ // "equivalent" is the column name in excel sheet if(!strcmp($item['equivalent'],"")){ $entity->feeds_item->skip = TRUE; } } }