Hi,
Not sure if is a bug.
Using feeds and related modules to import from CSV files.
: nodes.csv: sku, title
: brands.csv: sku, brand
Content type to insert or update nodes has fields: sku, title, brand (term reference)
I've created a importer for nodes.csv to create nodes. Then, I run another importer too UPDATE brand field for the existing sku's.
brands importer > Node processor settings:
✓ Do not insert new nodes
✓ Update existing nodes
✓ Skip non-existent nodes
This setup does not update nodes. The UI show "There are no new nodes."
If I choose:
✓ Insert new nodes (instead of "Do not insert new nodes") new nodes are created as expected
The result expected with "✓ Update existing nodes " and " ✓ Do not insert new nodes" is the nodes being updated with the brand.
I've played with the mappings adding "sku > guid as unique" for both importers and other things without any better results.
Thanks
Comments
Comment #2
alex.cunha CreditAttribution: alex.cunha commentedComment #3
alex.cunha CreditAttribution: alex.cunha commentedComment #4
alex.cunha CreditAttribution: alex.cunha commentedComment #5
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedUpdating existing nodes should work. The GUID value is only unique per importer (and feed node, if used). Maybe an issue with the SKU mapper?
If you can provide an export of both your feeds importers + two sample files, it would be easier for me to replicate the problem.
Comment #6
alex.cunha CreditAttribution: alex.cunha commentedThanks
I'm testing different fields mappings. Removed the GUID for testing.
There is a way to force sku (or any filed) to be used as unique?
Comment #7
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI assume that for the SKU field you are using the Ubercart Field Mappers module? That module does indeed not support using SKU as unique target, but there is a patch available to add that: #1039616: Make Model/SKU a unique target. The latest patch there is for D7, despite the version info.
If you are using Commerce Feeds instead, that module does support the SKU field as unique target (though for Commerce of course).
To use an other field as unique target, see https://www.drupal.org/node/1307732#field_as_unique_id_7. Easiest way is to use the Field validation module and use a text field as unique.
Comment #8
nithinkolekar CreditAttribution: nithinkolekar commented@MegaChriz
are you sure about it? shouldn't GUID unique per bundle/node type instead of importer? I tested for updating and inserting but I think feed import is not taking care GUID and creating duplicate nodes although "Update existing nodes" and "Insert new nodes" are set enabled.
That makes another related issue #1286298: Don't create new items, only update existing to reopen. Could you please reopen that issue so that I can share info there?
Comment #9
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedYes, I'm sure that the GUID is only unique per importer. There is a feature request to make the GUID value unique across multiple importers, see #1539224: Add support for unique fields to be unique site wide.
The issue reported here seems to be that the SKU from the Ubercart Field Mappers module couldn't be set as unique, for which a fix is available in #1039616: Make Model/SKU a unique target. And as said, setting GUID as unique target for two different importers will not make items imported with importer 1 to be updated with importer 2.
I rather leave #1286298: Don't create new items, only update existing closed, as that was about adding the feature of "only update existing". That one was done and backed up with a test to ensure it is working (at least in a basic setup). If you have an issue with the insert new nodes and update existing nodes setting, I think it would be better if you create a new issue for it and in there provide the exact steps to reproduce the issue. One possible cause where the GUID as unique value may not be working as expected is if your source is case sensitive. The GUID value is currently case insensitive (as is the rest of the Drupal database by default). There was an issue reported about that in #2697249: Diacritical / punctuation marks are disregarded and separate fields are overwritten with the same value.
Comment #11
alex.cunha CreditAttribution: alex.cunha commentedMegaChriz :
This explains why with the second importer to update nodes, there's no update.
MegaChriz:
Not using ubercart, but commerce modules.
To understand if there is any interference from commerce modules into this feeds situation, I created new content type not linked to product entity. Added an insert importer and update importer. sku field (from csv source) maps to GUID and is used as unique. When I run the update importer, doesn't update. I think this confirms "the GUID value is only unique per importer" as the first importer always updates (if I change the CV file) and the second (the update) doesn't.
Wondering why the GUID is limited to the scope of just one importer...
I need to mimic the same process I was using to import and update content from CSV as I use on other web app. Periodically I need to update fields (commerce product display) from CSV files.
So my question, is: How to update fields from CSV where there's is a unique key (like product code/sku) to update existing nodes? How do you do this, guys?
Meanwhile, checking Add support for unique fields to be unique site wide.
Comment #12
alex.cunha CreditAttribution: alex.cunha commentedThe patch #78 provides "GUID is unique per Feed source" option and solves this reported issue.
See more: "Add support for unique fields to be unique site wide"
Wishing next feeds module update include this patch.
Many thanks