You are here

function uc_webform_cart_item in Ubercart Webform Integration 6

Implementation of hook_cart_item().

File

./uc_webform.module, line 632
Provides components to the Webform module utilizing the Ubercart package.

Code

function uc_webform_cart_item($op, &$item) {
  switch ($op) {
    case 'remove':
      $data = unserialize($item->data);
      if ($data['webform_ctype'] == 'product_list') {
        db_query("DELETE FROM {webform_submitted_data} WHERE nid = %d AND sid = %d AND data = '%s'", $data['webform_nid'], $data['webform_sid'], $item->nid);
      }
      elseif ($data['webform_ctype'] == 'product') {
        db_query("DELETE FROM {webform_submitted_data} WHERE nid = %d AND sid = %d AND cid = %d", $data['webform_nid'], $data['webform_sid'], $data['webform_cid']);
      }
      elseif ($data['webform_ctype'] == 'product_grid') {
        db_query("DELETE FROM {webform_submitted_data} WHERE nid = %d AND sid = %d AND cid = %d", $data['webform_nid'], $data['webform_sid'], $data['webform_cid']);
      }
      break;
  }
}