Hi,

this is the continuation of my comment on the #813978: Implement settings page issue, for which I should apologize :)

I tested the ergonlogic's suggestion, but also with the machine readable name it does not work. Is it a problem if the field name in the importing file is different than the CCK one's?

Thanks again,
Jimmi

CommentFileSizeAuthor
#6 node_import_update_01072011.patch3.56 KBjmrivero

Comments

jimmi61’s picture

Title: Using CCK field does not work » Things that work and do not work, IMHO of course :) [was: Using CCK field does not work]

I spent sometime in testing this nice addition and, compared with my expectation, I had the following problems:

- I did several tests, changing the hard coded settings and name of fields, but I was not able to use a CCK field as unique identifier.

- It is not working with Node Import via cron. The patch #422282-13: Update existing nodes on import does it and, moreover, allows to choose the unique identifier in a list, working also with CCK fields. Perhaps merging the two codes would be an improvement.

- One feature I really need is to update only the fields that have a value, leaving empty fields untouched, but it seems not to be an easy task.

I ought to help you guys in developing these nice things, but my skill is still not that good. I will try looking into the code and see if I understand anything.

Thanks for now
Jimmi

Krotty’s picture

Title: Things that work and do not work, IMHO of course :) [was: Using CCK field does not work] » Using CCK field does not work

Fix for "CCK field as unique identifier"

      // Check if item already exists
      if ($IMPORT_UNIQUE_ID_IS_CCK) {
        // get unique id from cck fields
        //$unique_id_value = $form['#post']['cck:field_import_id:value'][0];
        $unique_id_value = $form['#post']['cck:'.$IMPORT_UNIQUE_ID_NAME.':value'][0];
        // build query
        //$query = 'SELECT c.nid, c.vid FROM {content_type_%s} c WHERE c.%s = "%s"';
        $query = 'SELECT c.nid, c.vid FROM {content_type_%s} c WHERE c.%s_value = "%s"';
      }
oliveyrc’s picture

This worked like a charm for me.

Rich

Coupon Code Swap’s picture

Worked for me, thanks!

coolestdude1’s picture

Can some one push a patch and release?

jmrivero’s picture

Status: Active » Needs review
StatusFileSize
new3.56 KB

Added this fix to a patch and made a settings form for this module to avoid touching the code.

welly’s picture

Thanks for the patch. Works great! Although I had to manually apply the patch changes as it looks to be a Netbeans specific patch?

welly’s picture

Status: Needs review » Reviewed & tested by the community
jmrivero’s picture

Yes, it was generated with Netbeans but it should work with any Diff tool thought.

coolestdude1’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Settings page added as per patch committed to master branch