Great module!

For some reason the donation amount displays in the wrong spot in the cart (please see attached image). I've been troubleshooting this for a long time and I'm at a loss. Hopefully there is something obvious that I am missing. Any advice will be most appreciated. Thank you!

CommentFileSizeAuthor
uc_donation.gif8.04 KBAnonymous (not verified)

Comments

bcobb10b’s picture

Frankie4260 -- did you ever resolve this issue? I've installed the module & have the same problem -- the editable amount field shows in the same place as in your screen shot. It seems to have moved to this location when I deactivated the shipping module -- I need to confirm this.

Bill Cobb

matt_donnelly’s picture

I got this working OK on my site. In the Hook Functions (TAPIr) section of donation.module. (~line 450), I made some changes to function uc_donation_table_alter(). I also enabled the Amount column in the Table Display Settings under Ubercart Configuration.

Original code:
/**
 * Implementation of TAPIr's hook_table_alter().
 *
 * Adds a 'Amount' column to several product tables.
 */
function uc_donation_table_alter($table_id, $op, $args = NULL) {
  if (arg(0) !== 'donation') {
    switch ($table_id) {
      case 'uc_cart_view_table':
        switch ($op) {
          case 'fields':
            $fields[] = array(
              'name' => 'amount',
              'title' => t('Amount'),
              'weight' => 2.5,
              'enabled' => TRUE
            );
            return $fields;
          case 'data':
            $data = array();
            foreach (element_children($args['items']) as $i) {
              $data['amount'][] = array('data' => $args['items'][$i]['donate_price'] ? drupal_render($args['items'][$i]['donate_price']) : '','class'=>'amount');
            }
            return $data;
        }
        break;
    }
  }
}

My modified code

/**
 * Implementation of TAPIr's hook_table_alter().
 *
 * Adds a 'Amount' column to several product tables.
 */
 
function uc_donation_table_alter($table_id, $op, &$form) {
  if (arg(0) !== 'donation') {										
    switch ($table_id) {											
      case 'uc_cart_view_table':									
        switch ($op) {												
           case 'fields':											
            $fields[] = array(										
              'name' => 'amount',
              'title' => t('Amount'),
              'weight' => 2.5,
              'enabled' => TRUE
              
            );
            return $fields;
          case 'data':
            $data = array();
            
            foreach (element_children($form['items']) as $i) {

	   //kill the first non-functional donate_price box
                
            $data['amount'][] = array('data' => drupal_render($form['items'][$i]['donate_price']), 'align' => 'center', 'class' => 'amount');
                
            }
                                    
            return $data;
        }
        break;
    }
  }
}

Hope this helps. BTW I am no PHP expert.