Manikandan S
Manikandan S

Reputation: 922

ubercart abandoned orders marked as completed in civicrm

I'm using drupal(7.38), civicrm(4.6.5), ubercart(7.x-3.8) and ubercart_civicrm(7.x-4.x-dev). Whenever a user(registered/anonymous) is purchase a product from the site, a contribution will be added into the civcrm user. If the user is anonymous, system will create the user by using email both in drupal as well as civicrm also. I notice some of the products status is 'Abandoned' in ubercart, but under the corresponding user contribution tab, the product is listing as Completed. I gone throw the uc_civicrm module at last I found some piece of codes in uc_civicrm/uc_civicrm.module

function _uc_civicrm_map_contribution_status($order_status) {
  // NOTE: There may be a more "correct" way to do this.
  $map = array(
    "completed"        => 1,
    "payment_received" => 1,
    "pending"          => 2,
    "processing"       => 5,
    "canceled"         => 3,
    "in_checkout"      => 5,
  );

  if (array_key_exists($order_status, $map)) {
    $id = $map[$order_status];
  }
  else {
    // Oh no.
    $id = 1;
    watchdog('uc_civicrm', 'There is no status that maps to %order_status, marking as "Complete"', array('%order_status' => $order_status), WATCHDOG_WARNING);
  }

  return $id;
}

I want to synchronize ubercart order status with civicrm contributions status. Please help me out this. Thanks in advance

Upvotes: 1

Views: 91

Answers (2)

Laryn
Laryn

Reputation: 111

If you want to map 'abandoned' to the 'canceled' status in CiviCRM (there is no "abandoned" status in CiviCRM) you could revise the above like so:

$map = array(
 "completed"        => 1,
 "payment_received" => 1,
 "pending"          => 2,
 "processing"       => 5,
 "canceled"         => 3,
 "abandoned"         => 3,
 "in_checkout"      => 5,
);

Then I'd recommend making a bug report/patch on the issue you filed at the project page so it gets into the module core if the maintainers agree.

Upvotes: 1

petednz - fuzion
petednz - fuzion

Reputation: 185

On the one site where we had CiviCRM and Ubercart well (it was Drupal 6) we ended up needing to use both - UC CiviCRM, - Ubercart CiviCRM Products but I see the latter only was released for D6

More recently for Commerce integration we have switched from using the module to using CiviCRM Entity and Drupal Rules.

Not sure how much the above helps but thought I should mention it.

Upvotes: 0

Related Questions