Answers.Body: <p>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:</p>
  
  <pre><code>$map = array(
   "completed"        =&gt; 1,
   "payment_received" =&gt; 1,
   "pending"          =&gt; 2,
   "processing"       =&gt; 5,
   "canceled"         =&gt; 3,
   "abandoned"         =&gt; 3,
   "in_checkout"      =&gt; 5,
  );
  </code></pre>
  
  <p>Then I'd recommend making a bug report/patch <a href="https://www.drupal.org/node/2606644" rel="nofollow">on the issue you filed at the project page</a> so it gets into the module core if the maintainers agree.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-05T17:18:30.913Z
Answers.LastActivityDate: 2015-11-05T17:18:30.913Z
Answers.UserDisplayName: Laryn
Body: <p>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) purchases a product from the site, a contribution will be added into the CivCRM contact. If the user is anonymous, the system will create a user in Drupal as well as a contact in CiviCRM, linked by the email address. I notice some of the orders have a status of 'Abandoned' in Ubercart, but under CiviCRM's contribution tab for this contact, it is listed as 'Completed'. </p>
  
  <p>I have gone through the <code>uc_civicrm</code> module and I found the following code in uc_civicrm/uc_civicrm.module</p>
  
  <pre><code>function _uc_civicrm_map_contribution_status($order_status) {
    // NOTE: There may be a more "correct" way to do this.
    $map = array(
      "completed"        =&gt; 1,
      "payment_received" =&gt; 1,
      "pending"          =&gt; 2,
      "processing"       =&gt; 5,
      "canceled"         =&gt; 3,
      "in_checkout"      =&gt; 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' =&gt; $order_status), WATCHDOG_WARNING);
    }
  
    return $id;
  }
  </code></pre>
  
  <p>I want to synchronize Ubercart's order status with the CiviCRM contribution status. How can I do that?</p>
  
Tags: <civicontribute><drupal><ubercart>
Title: "Abandoned" Ubercart orders marked as "completed" in CiviCRM
ThreadText: # "Abandoned" Ubercart orders marked as "completed" in CiviCRM
  
  (Asked by: username_0 on 2015-11-02)
  
  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) purchases a product from the site, a contribution will be added into the CivCRM contact. If the user is anonymous, the system will create a user in Drupal as well as a contact in CiviCRM, linked by the email address. I notice some of the orders have a status of 'Abandoned' in Ubercart, but under CiviCRM's contribution tab for this contact, it is listed as 'Completed'.
  
  I have gone through the `uc_civicrm` module and I found the following code 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's order status with the CiviCRM contribution status. How can I do that?
  
  **Tags:** civicontribute, drupal, ubercart
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-11-05. Score: 1
  
  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](https://www.drupal.org/node/2606644) so it gets into the module core if the maintainers agree.
  
  
  ---
  
  