I am hoping that Physical Fields can be integrated with Commerce Feeds to allow batch importing of product sku weights. What is the possibility of this?

Comments

ollie222’s picture

I too would find this useful functionality.

Patricec’s picture

+1
I second the request. Being able to import physical fields would be extremely useful. Thanks much.

Edit : I just posted a patch that helps import physical weight using Commerce Feeds. See http://drupal.org/node/1293820

pcambra’s picture

Title: Integrate with Commerce Feeds » Integrate with Feeds
Category: feature » task
Status: Active » Needs review
StatusFileSize
new3.13 KB

After lots of discussion, I think that, as physical products are thought to be in other entity types, not only commerce products, the feeds integration belongs here more than to commerce feeds.
Patch attached, it's been widely tested inside commerce feeds.

Credits: The initial author of the patch is Patricec and andyg5000 has pushed it a lot forward, see #1293820: Integrate with the Commerce Physical Product / Physical Fields

wgsimon’s picture

Do we not need something like this in physical.module in addition to the contents of the patch?

/**
 * Implements hook_feeds_processor_targets_alter().
 */
function commerce_physical_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
  module_load_include('inc', 'physical', 'mappers/physical.feeds');
  physical_feeds_processor_targets_alter($targets, $entity_type, $bundle_name);
}
andyg5000’s picture

Hey Will,
The current recommended version of Feeds (7.x-2.0-alpha5) will automatically add physical.feeds.inc file. If the feeds module is older, you just need to make sure that that file is included somewhere in physical.module so hook_feeds_processor_targets_alter() is executed properly.
Thanks,
Andy

johnv’s picture

Status: Needs review » Reviewed & tested by the community

IMO this works flawless.

lima2x’s picture

Category: task » feature

Hi,
I would need this importation of physical fields with Feeds, but I can't see this addition in 7.x-2.0-alpha5 ?
How shall add this patch ?
Thank you

brephraim’s picture

I have applied this patch, but I still am not seeing the weight field as an available target for feed imports.

I am using Feeds 7.x-2.0-alpha5, Commerce Feeds 7.x-1.2, and Physical 7.x-1.x-dev.

andyf’s picture

#3 is working for me, I'm importing the weight but not the unit. Details the same as @brephraim's above.

brephraim’s picture

Scratch that, it was a dumb user error. This works great for me.

EDIT: I didn't try to import the unit, though.

imiksu’s picture

Working for me too.

webrant’s picture

Applied patch to Commerce Feeds 7.x-1.3 but now get a 500 error whenever I try to access feeds/product_importer/mapping. Has the patch been used by anyone with the latest release of commerce feeds?

johnv’s picture

@webrant, I only used it with my self-made mapper and nodes, not products.

webrant’s picture

Thanks johnv. Has anyone successfully used the patch with Commerce Feeds 7.x-1.3 and the product importer?

Horroshow’s picture

Applied the patch but still can't see the field in either products or nodes importer. I'm using Commerce Feeds 7.x-1.3. Any clue?

Horroshow’s picture

I forgot modules versions I installed:
Feeds 7.x-2.0-alpha5
Commerce Feeds 7.x-1.3

Could it be related? What version are you using to make the patch work?

Horroshow’s picture

Ok, the patch created the file physical.feeds.inc at the root. I just had to move it to /sites/all/modules/physical and the fields appeared in my feed product importer. Yeah! Thanks all!

pcambra’s picture

Ok, the patch created the file physical.feeds.inc at the root

You always need to apply the module patches from the "module root" folder.

3rdLOF’s picture

Not working at all with the latest DEV versions of Commerce Feeds and Feeds.

Patched fine, not showing up at all.

3rdLOF’s picture

A) Like a few others, stupid mistake after 16hours of coding. Too stupid to mention.
B) Clearing the cache is a must.

shaneonabike’s picture

Yep I fourth this in that it's working. Can we not apply this to the actual module PLEASE PLEASE!

deggertsen’s picture

Title: Integrate with Feeds » Integrate with Feeds (Patch Ready)

Yet another confirmation that this works. Please apply the patch.

myoung008’s picture

Works great with product importer. Please apply patch.

johns10’s picture

When I try to apply the patch I get fatal: corrupt patch at line 99

johns10’s picture

Nevermind - had missing newline at end of file.

johns10’s picture

Similarly, patch works fine. However, I cannot map to physical fields when I'm setting up my importer:

Commerce Feeds 7.x-1.3
Feeds 7.x-2.0-alpha8

Am I missing something here?
I am feeding in to product bundles, not nodes.

summit’s picture

Hi, Is this patch https://drupal.org/files/1372070-integrate_with_feeds.patch committed please?
greetings, Martijn

wgsimon’s picture

Hi. This patch works for me. Is it possible to get it committed? I'm using Feeds 7.x-2.0-alpha8.

rogical’s picture

patch works

2ndChanceTech’s picture

Patch worked great with multiple cvs importing just dimensions (I didn't try weight or units).
Thank you! Just what I needed.

JemBijoux’s picture

Would be great to see this committed! I had run this patch in the past, but an update today to the latest dev version seems to have undone it.

Kiendeleo’s picture

I to would like to see this committed.

msamavi’s picture

Not working here!

Feeds 7.x-2.0-alpha8
Commerce Feeds 7.x-1.3+5-dev

msamavi’s picture

Thanks Horroshow, your comment helped.

vegantriathlete’s picture

Here's another RTBC. Please do get this committed. Thanks so much to those who wrote the patch!

Kiendeleo’s picture

We could really use this please get this commited

amysragbag’s picture

Issue summary: View changes

I applied the patch and I see that physical.feeds.inc is there in commerce_feeds/mappers but the options to add product weight and dimensions as targets are missing from the feeds/products_importer/mapping page. I am using Physical Fields 7.x-1.x-dev, Commerce Feeds 7.x-1.3, and Feeds Import 7.x-2.0-alpha8. Do you recommend checking or trying anything to get it working?

lunk rat’s picture

@amysragbag and @msamavi if you are patching with patch command, please make sure you are using the -p1 switch, like this:

patch -p1 < 1372070-integrate_with_feeds.patch

Then verify that physical.feeds.inc has been created in your modules/physical directory.

- lunk_rat

jimmynash’s picture

Patch applied fine for me. Import worked well. Just chiming in.

Thanks to all for the work!

crasx’s picture

Why has this not been integrated yet?

zkrebs’s picture

When importing weight:unit what should the data look like?

spanac’s picture

#3 Works great with latest Feeds 7.x-2.0-alpha8 and Physical Fields 7.x-1.x-dev (2013-Oct-01). Thank you all for making this :) @rszrama please commit this to the next dev version of Physical Fields.

For others having problems with implementation, just make sure that you have physicalphysical.feeds.inc at /sites/all/modules/physicalphysical.feeds.inc and flush all caches at admin/config/development/performance

czigor’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.15 KB
new746 bytes

Let's include the Volume field as well.

czigor’s picture

Status: Needs review » Reviewed & tested by the community

I just realised that the volume field only exists as patch. See #2483243: Add field for physical volume. So never mind my patch.

summit’s picture

Hi, couldn't the volume field be added also, and not only for patch?
greetings, Martijn

czigor’s picture

StatusFileSize
new3.17 KB
new289 bytes

This patch is still not for review until the volume patch #2483243: Add field for physical volume gets in. I need this here for drush make purposes.

ecvandenberg’s picture

Spanac made a typo at #42 which made me wonder how that would work...

He means:

For others having problems with implementation, just make sure that you have physical.feeds.inc at /sites/all/modules/physical/physical.feeds.inc and flush all caches at admin/config/development/performance

andyg5000’s picture

StatusFileSize
new796 bytes
new3.15 KB

@czigor, You should open a new issue with your volume patch. Hopefully we can get this one and the other volume stuff committed soon. That being said, I did run across a small issue with @pcambra's patch which just needed 2 trim() calls. Without them, spaces in the data cause the fields to be skipped and can lead to data loss.

czigor’s picture

@andyg5000 Created #2756893: Integrate volume with feeds for that.

nimek’s picture

Patch is wrong - in current state it will only works with nodes !

line 58

 $info_instance = field_info_instance($entity_type, $field_name, $bundle);

Solution to make it work with taxonomy terms

 $bundle = isset($entity->type) ? $entity->type : $entity->vocabulary_machine_name;
  $info_instance = field_info_instance($entity_type, $field_name, $bundle);

Or even more generic for all entity types

$entity_info = entity_get_info($entity_type);
  if (empty($entity_info['entity keys']['bundle'])) {
   $bundle = $entity_type;
  } else {
    $bundle = $entity->{$entity_info['entity keys']['bundle']};
  }
$info_instance = field_info_instance($entity_type, $field_name, $bundle);
joelpittet’s picture

Status: Reviewed & tested by the community » Needs work

I think #50 is correct, the code snippets need coding standards cleanup, isn't there a helper for getting the bundle though? I know entity_metadata_wrapper() will have ->getBundle(), but seems like a bit of a waste to wrap if we don't need to.

nimek’s picture

 $entity_type = $source->importer->processor->entityType();
  list($entity_id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  $info_instance = field_info_instance($entity_type, $field_name, $bundle);
joelpittet’s picture

@nimek, could you provide that as an update to the patch please?

czigor’s picture

Status: Needs work » Needs review
StatusFileSize
new3.2 KB
new670 bytes

Thanks, @nimek, updated the patch in #48.

  • czigor committed 1ae44e8 on 7.x-1.x authored by andyg5000
    Issue #1372070 by czigor, andyg5000, pcambra, nimek, Patricec: Integrate...
czigor’s picture

Status: Needs review » Fixed

Committed, thanks to all who contributed to this!

geek-merlin’s picture

Thanks you brought this home finally!

gturnbull’s picture

I tested patch 54 and it is working well for me. Thank for committing it!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.