Currently, menu and admin form placeholders are present, but not fully implemented, therefore lines 44-48 of node_import_update.module contain the import parameters:
$IMPORT_UNIQUE_ID_NAME = 'title'; // Import field that holds the unique identifier
$IMPORT_UNIQUE_ID_IS_CCK = FALSE; // Is the identifier a CCK field?
$IMPORT_NTYPE = 'product'; // Node type to be imported
$IMPORT_UPDATE_DATETIME = TRUE; // Settting: update date/time value?
By default, it will update products using the title as the unique field.
We ought to move these into a settings form, so that it's exposed through the UI. A good first step would probably be to use the partially implemented dedicated settings form. Eventually, we should probably move this into the Node Import wizard.
Comments
Comment #1
enzipher commentedHi.
As this module takes effect when enabled there should be an option somewhere to enable/disable import updates completely. Thought I would mention that as a reminder.
Cheers
Comment #2
jimmi61 commentedApparently it does not work. I have a content type "Libro" as defined in cck.jpg, and I would like to check the identifier in the field "ISBN-13" (see list of fields fields.jpg). I therefore modified the lines 44-48 as follow:
Records with existing identifier are anyhow duplicated everytime. How may I debug the problem?
Thanks
Jimmi
Comment #3
ergonlogic@jimmi61: Thank you for testing this module, but in the future, please start a new issue for support requests. It will make it easier to keep conversation threads straight.
That said, try using the machine-readable name:
Comment #4
rosk0Hi everyone! I have two node types to update them. How to be i my case?
Comment #5
enzipher commentedHi there,
You should be able to import each content type separately, for each one making necessary changes to the modules hardcoded settings as described earlier.
Cheers
Comment #6
hernani commentedHello,
I implemented settings using node_import_hooks. It works against last development versions.
The zip contains node_import.module (that only contains a hook for form_alter and it is needed to provide a support inc to node_import) and contains node_import_update.inc that should be place under node_import/supported/node_import_update.
Cheers
Hernani
Comment #7
ergonlogicThank you, hernani.
Please format this as a patch: http://drupal.org/patch/create, as it will facilitate code review.
Comment #8
iamdroid commentedComment #9
iamdroid commentedComment #10
samdds commentedHello, I tried your patch (#6), but it doesnt work, it are always new nodes which are created. I have a column in my csv (nid), which I select as the unique id.
Please help
Comment #11
Enemy commented* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/***/includes/database.mysql.inc on line 321.
* user warning: Unknown column 'n.field_sku' in 'where clause' query: SELECT n.nid, n.vid FROM shop_node n WHERE n.type = "software" AND n.field_sku = "" in /home/****/sites/all/modules/node_import/supported/node_import_update/node_import_update.module on line 54.
module no update data.
help me plz :)
Comment #12
akaserer commentedhi
i would like to update product data from ubercart.
does it work with SKU number also??
otherwise i will use node-id as key.
thanks
Comment #13
smscotten commented@akaserer in the future please start a new issue for support requests.
In this case there is such a thread here: #995114: Expose Ubercart fields for use as unique ID. HTH!
Comment #14
coolestdude1 commentedThis was done on the latest commit should come up on dev version of master soon, let me know.
Comment #15
jmrivero commentedNew patch against dev to add a select control listing all content types in the settings page instead of asking the user to write the machine name.
Comment #16
jmrivero commentedComment #17
coolestdude1 commentedDone added and committed to the dev I might do a release soon for all these changes what do you think?
Comment #18
ergonlogic@coolestdude1: Great work lately! Thank you for taking up the reins on this project.
I think this certainly deserves a release!
Comment #19
jmrivero commentedWell, with the UI implementation and no critical bugs it may be a good idea to have a release yes.
Maybe write some documentation, a readme.txt to pack with the module at least.
Comment #20
jmrivero commentedOne more thing, im not sure if implementing the UC SKU feature in the settings page is a good idea, this is one use case, but there can be many other modules using internal IDs and it wont be practical to add a new feature every time one of this modules needs to use NIU. I think that maybe it will be better to leave this kind of features as patches. Just my thoughts.
Comment #21
smscotten commentedjmrivero, I agree in principle, but judging by the comments in this and other threads (including the threads about Feeds) Ubercart is such a common use-case for this kind of module that the upside of keeping the Ubercart support in the module in my opinion outweighs the downside of slightly lost elegance.
It's annoying enough (for those of us who see update as being intrinsic to import) that NIU was not accepted as part of Node Import, even as an optional included module. Lets not make a large portion of NIU users have to hunt for a patch to a submodule if they don't have to.
If it's really bothersome, I suppose that the UC support could be added as its own module to be enabled separately, but I still think that it ought to be distributed along with NIU.
There's clearly room for reasonable people to disagree on this, and I think it would be up to whoever was willing to actually take the time to change the code anyway, but my suggestion would be either to make UC support a submodule that is distributed along with NIU or to leave it as is. If someone's going to go to the effort to change the code, it shouldn't be just to make things less convenient for a substantial subset of users.
Comment #22
jmrivero commentedIncluding UC support as another module included inside NIU could be a good idea, not only to keep NIU focused in one feature, but to build the interface to allow other modules to add this kind of support for specific use cases, then if another module needs to use a particular field as ID, it cna be added with no problem as another module. This same aproach could be used for the current CCK function thought.
Comment #23
coolestdude1 commentedAlright cool I will be writing a read-me as stated in #19 and also will be externalizing that feature into an add-on module no big deal should be done quickly barring any other of my tasks don't get in the way. Thanks everyone.
Comment #24
jmrivero commentedOk, made a new patch against dev to include the different identifier types in a select control, im not sure what can happen if a user selects both, cck and UC field types as IDs by checking both of them in the settings form.
Also changed the IF block for a switch, thinking on future ID types that could be added.
Thought that it could be a good idea to implement this ID types as .inc files in a contrib folder in the module, then just by adding new .inc files the module should be able to read them and add the new ID types dynamically.
Comment #25
coolestdude1 commentedDarn my boss has dumped a bunch of work onto me so this will take me a bit longer than expected sorry about that guys/girls.
Comment #26
mattcasey commentedpatch from #24 is good, it's much less confusing, but it failed when I tried to apply it since there's no header. I also noticed that now one of the function is included in dev, so I manually updated and rerolled the patch for the most recent dev.
Comment #27
rajritukumar commentedI want to update node with unique field.
Comment #28
coolestdude1 commentedI have pushed the code for release in dev so go and test it out it was working just fine for me.