Hi,

How can I add the new created node content to the order invoice and to the confirmation email the client gets?

Thank you,
Emil

Comments

emilorol’s picture

Hi,

After some research I came out with this solution. As of now only add the node content to the order as an order pane. I am still working on the email and print version part.

<?php

/**
 * Implementation of hook_order_pane_alter()
 */
 
function YOUR-OWN-MODULE_order_pane_alter(&$panes) {
  foreach ($panes as &$pane) {
    if ($pane['id'] == 'uc_node_checkout') {
      $pane['show'] = array();
    }
  }
}

/**
 * Implementation of hook_order_pane()
 */
 
function YOUR-OWN-MODULE_order_pane() {
  $panes[] = array(
    'id' => 'YOUR-OWN-MODULE',
    'callback' => 'YOUR-OWN-MODULE_order_pane_nodes',
    'title' => t('Registration details'),
    'class' => 'abs-left',
    'weight' => 7,
    'show' => array('view', 'customer'),
  );
  return $panes;
}

/**
 * Handle the "Custom Products" order pane.
 */
function YOUR-OWN-MODULE_order_pane_nodes($op, $arg1) {
  switch ($op) {
    case 'view':
    case 'customer':
      $order = $arg1;
	  
	  foreach ($order->products as $product) {

        if (isset($product->data['node_checkout_nid'])) {
          $output .= YOUR-OWN-MODULE_for_classes($product->data['node_checkout_nid']);
        }

      }

      return $output;

  }
}

/*
 *	This function create the tables for the node checkout	
 */

function YOUR-OWN-MODULE_for_classes($nid) {
  $node = node_load($nid);
  //Do your stuff here
}
?>