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

enzipher’s picture

Hi.

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

jimmi61’s picture

StatusFileSize
new54.55 KB
new25.4 KB

Apparently 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:

    $IMPORT_UNIQUE_ID_NAME   = 'ISBN-13';  // Import field that holds the unique identifier
    $IMPORT_UNIQUE_ID_IS_CCK = TRUE;    // Is the identifier a CCK field?

    $IMPORT_NTYPE            = 'libro';   // Node type to be imported
    $IMPORT_UPDATE_DATETIME  = TRUE;        // Settting: update date/time value?

Records with existing identifier are anyhow duplicated everytime. How may I debug the problem?

Thanks
Jimmi

ergonlogic’s picture

@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:

    $IMPORT_UNIQUE_ID_NAME   = 'field_isbn_13';  // Import field that holds the unique identifier
rosk0’s picture

Hi everyone! I have two node types to update them. How to be i my case?

enzipher’s picture

Hi 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

hernani’s picture

StatusFileSize
new3.16 KB

Hello,

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

ergonlogic’s picture

Thank you, hernani.

Please format this as a patch: http://drupal.org/patch/create, as it will facilitate code review.

iamdroid’s picture

Title: Implement settings page » No update by CCK field
Category: feature » support
iamdroid’s picture

samdds’s picture

Title: No update by CCK field » Implement settings page
Category: support » feature

Hello, 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

Enemy’s picture

Priority: Normal » Critical

* 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 :)

akaserer’s picture

hi

i would like to update product data from ubercart.

does it work with SKU number also??

    $IMPORT_UNIQUE_ID_NAME   = 'SKU';  // Import field that holds the unique identifier

otherwise i will use node-id as key.

thanks

smscotten’s picture

@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!

coolestdude1’s picture

Status: Active » Closed (fixed)

This was done on the latest commit should come up on dev version of master soon, let me know.

jmrivero’s picture

Component: User interface » Code
StatusFileSize
new1.76 KB

New 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.

jmrivero’s picture

Status: Closed (fixed) » Needs review
coolestdude1’s picture

Status: Needs review » Fixed

Done added and committed to the dev I might do a release soon for all these changes what do you think?

ergonlogic’s picture

@coolestdude1: Great work lately! Thank you for taking up the reins on this project.

I think this certainly deserves a release!

jmrivero’s picture

Well, 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.

jmrivero’s picture

One 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.

smscotten’s picture

jmrivero, 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.

jmrivero’s picture

Including 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.

coolestdude1’s picture

Status: Fixed » Needs work

Alright 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.

jmrivero’s picture

Status: Needs work » Needs review
StatusFileSize
new5.76 KB

Ok, 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.

coolestdude1’s picture

Darn 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.

mattcasey’s picture

StatusFileSize
new5.83 KB

patch 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.

rajritukumar’s picture

I want to update node with unique field.

coolestdude1’s picture

I have pushed the code for release in dev so go and test it out it was working just fine for me.