CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Duplication check from REST API (for OpenCart hook)
Pages: [1]

Author Topic: Duplication check from REST API (for OpenCart hook)  (Read 2872 times)

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Duplication check from REST API (for OpenCart hook)
May 10, 2010, 04:07:08 am
Hi folks,

Is there an existing way to run a duplication check from the REST or other external API, using normal CiviCRM admin config?

I'm working on a simple tie-in between Opencart (popular php shopping cart/ecommerce app) and CiviCRM, which I intend to share with the community once stable (there doesn't seem to be such a thing currently existing).

It's just a simple hook so my client's shop's customers details are automatically added to CiviCRM, or if they're already there, their record is updated with details of their purchases, even if the shop and crm are on different servers. Easy stuff, but it needs a duplication check and I don't want to dulpicate an existing duplication check methodology, if you see what I mean :-)

The intended process is something like this: launches dupe check REST request using Pear HTTPrequest, if finds one ID, updates than ID using REST, if multiple, emails the CiviCRM admin, if false, creates then updates the contact.

If not, I can make one, but I don't want to re-invent and duplicate the wheel - so any pointers would be appreciated on which the best functions to use would be long term. E.g. I see that the old &civicrm_contact_add function is deprecated in favour of seperate &...create and &...update functions, with no built in duplication check option. I'd be interested to understand the rationale here.

Thanks,

- Alan
« Last Edit: May 10, 2010, 04:36:30 am by alanms »

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: Duplication check from REST API (for OpenCart hook)
May 10, 2010, 04:33:37 am
Answered my own question, from closer inspection of the code turns out that the REST API already uses civicrm_contact_add by default and so can do the dedupe check with &dupe_check=true

Nice! Looking for a way to mention this in the wiki.

So one question - since the code says civicrm_contact_add is to be deprecated, is this likely to change in future versions, or is it safe to use long-term?
« Last Edit: May 10, 2010, 04:37:21 am by alanms »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Duplication check from REST API (for OpenCart hook)
May 10, 2010, 07:46:39 am
Hi,

You can call directly civicrm_contact_create (that is what contact_add calls anyway).

FYI, the dedupe rule is the one flagged strict (and you need to set the contact_type, obviously).

Simply add the param dedupe in the contact_create api on the wiki for the documentation (if it isn't there already)
X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Re: Duplication check from REST API (for OpenCart hook)
May 12, 2010, 03:16:58 am
I'm excited about the possibility of integration with OpenCart! Please keep us posted on your progress.

Thanks,
James

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: Duplication check from REST API (for OpenCart hook)
May 06, 2012, 03:32:36 pm
I occasionally get private messages about this. Just to say that while working on the opencart integration, I discovered that opencart had a number of security and architecture issues, and I discovered that the opencart maintainers were surprisingly unwilling to do anything about these. I don't know if this has changed since, but my judgement was that opencart wasn't something to work with and that the integration code I made would have a very short shelf life. If you're looking for Civi-Opencart integration I'd suggest that, unless Opencart has changed massively in the last couple of years, you look to shopping options with Drupal (or Joomla) such as Ubercart and Commerce module.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Duplication check from REST API (for OpenCart hook)

This forum was archived on 2017-11-26.