According to this post:
http://drupal.org/node/1226240

nothing can be done from downpayments module to get the down payment price into the cart when using node checkout...soooo my question is, is there anything that can be done in node checkout to support this functionality?

thanks!!

Comments

funkeyrandy’s picture

FYI- if anyone needs help with this...i wound up *not* using node checkout and modifying the downpayment module to link items to nodes that needed to be associated:

replace 362-413 in the uc_node_downpayments.module with this:

 * Implements hook_cart_item().
 */
function uc_downpayment_cart_item($op, &$item) {
  if ($op == 'load') {
    if (!empty($item->data['downpayment']) && !$item->data['downpayment']->dpid) { // got down payment feature?

      if (!$item->data['downpayment']->full_price) {
        $item->data['downpayment']->full_price = $item->price;
        db_query("UPDATE {uc_cart_products} SET data = '%s', changed = %d WHERE nid = %d AND cart_item_id = '%s'", serialize($item->data), time(), $item->nid, $item->cart_item_id);
        cache_clear_all();
      }



$item->price = $item->data['downpayment']->amount;
if($item->teamid==''){
$item->teamid=$_GET['entry'];
db_query("UPDATE {uc_cart_products} SET changed = %d, data = '%s', teamid = '%s' WHERE nid = %d AND  cart_item_id = '%s'", time(), serialize($item->data), $item->teamid,$item->nid,$item->cart_item_id);
$item->title = $item->teamid;

}
$entry_nid=db_query("SELECT * FROM {uc_cart_products} WHERE cart_item_id  = '%s'", $item->cart_item_id);
while ($newentrynid = db_fetch_object($entry_nid)) {
$final_nid=$newentrynid->teamid;
}
$nodez=node_load($final_nid);
$item->title = $nodez->title.'-'.$final_nid;

    }
    elseif ($item->data['downpayment']->dpid) { // is it a down payment
      $item->price = $item->data['downpayment']->amount;
      $item->title = t('@title (Down payment: @dpid)', array('@title' => $item->title, '@dpid' => $item->data['downpayment']->dpid));
    }else{
	
		if($item->teamid==''){
		$item->teamid=$_GET['entry'];
		db_query("UPDATE {uc_cart_products} SET changed = %d, data = '%s', teamid = '%s' WHERE nid = %d AND  cart_item_id = '%s'", time(), serialize($item->data), $item->teamid,$item->nid,$item->cart_item_id);
	//	$item->title = $item->teamid;

		}
		$entry_nid=db_query("SELECT * FROM {uc_cart_products} WHERE cart_item_id  = '%s'", $item->cart_item_id);
		while ($newentrynid = db_fetch_object($entry_nid)) {
		$final_nid=$newentrynid->teamid;
		}
		if($final_nid !=''){
		$nodez=node_load($final_nid);
		$item->title = $nodez->title.'-'.$final_nid;
	}
}	
	
  }
}

add text table in uc_cart products:

DROP TABLE IF EXISTS `dr_uc_cart_products`;
CREATE TABLE IF NOT EXISTS `dr_uc_cart_products` (
  `cart_item_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cart_id` varchar(255) NOT NULL DEFAULT '0',
  `nid` int(10) unsigned NOT NULL DEFAULT '0',
  `qty` smallint(5) unsigned NOT NULL DEFAULT '0',
  `changed` int(11) NOT NULL DEFAULT '0',
  `data` text,
  `teamid` longtext NOT NULL,
  PRIMARY KEY (`cart_item_id`),
  KEY `cart_id` (`cart_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=289 ;

and finaly...add right after line 1608: "db_query("DELETE FROM {uc_cart_products} WHERE cart_id = '%s' AND nid = %d AND data = '%s'", $cart_id, $nid, serialize($data));"

this:

$profilerefs = db_query("SELECT node.nid AS nid FROM dr_node node LEFT JOIN dr_content_type_team_profile node_data_field_team_name_ref ON node.vid = node_data_field_team_name_ref.vid WHERE (node.type in ('team_profile')) AND (node_data_field_team_name_ref.field_team_name_ref_nid = %d)", $final_del_nid);
while ($profileref = db_fetch_object($profilerefs)) {
$finalteamref=$profileref->nid;
}
node_delete($finalteamref);
node_delete($final_del_nid);

}

of course change your fields to match!'...
then make sure your workflow is
1) add product to cart
2) redirect to node add form
3) redirect to cart

when you redirect to the cart after creating the node, add your newly created node nid as a query string using rules to redirect...like example.com/cart?entry=455
this creates a linkage between the downpayment and the node created after, uses the new node id as title, and deletes the new node if removed from the cart...hope this helps !

r

sokrplare’s picture

We have created a new module that enables UC Downpayment and Node Checkout to work together.

Please see http://drupal.org/node/1226240#comment-5444118

tr’s picture

Priority: Critical » Normal