You are here

THEMING.txt in Ubercart Webform Checkout Pane 7.3

Same filename and directory in other branches
  1. 6.3 THEMING.txt
Here is a code snippet that you can use to display Webform pane values into your invoices.
Feel free to edit it to adjust your needs.

=============================================================
== Place the following into your theme/preprocess function ==
=============================================================
<?php 
  $webformPaneValues = array();

  $webforms = _uc_webform_pane_get_nodes();
  foreach ($webforms as $webform) {
    $components = array();
    $nid = $webform->nid;
    $node = node_load($nid);
    
    if(FALSE !== $node){
      foreach ($node->webform['components'] as $field){
	$components[] = array(
	  'name' => check_plain($field->name),
	  'value' => ${'order_webform_'.$nid.'_'.$field['form_key']},
	);
      }
      
      $webformPaneValues[] = array(
	'title' => check_plain($node->title),
	'components' => $components,
      );
    }
  }
  
  // Now, just pass $webformPaneValues to the template, for example through the template variables
  $tplVars = array(
    'your-variable-1' => $yourVariable1,
    'your-variable-2' => $yourVariable2,
    'webformPaneValues' => $webformPaneValues,
  );
  return theme('your-theme-hook', $tplVars)
?>

====================================================
== Place the following into your invoice template ==
====================================================
<?php if($webformPaneValues): ?>
  <table>
    <?php foreach($webformPaneValues as $webformPaneValue): ?>
      <tr>
	<td colspan="2" bgcolor="#006699">
	  <strong><?php print $webformPaneValue['title']; ?></strong>
	</td>
      </tr>
      <tr>
	<td colspan="2">
	  <table border="0" cellpadding="1" cellspacing="0" width="100%">
	    <?php foreach ($webformPaneValue['components'] as $component): ?>
	      <tr>
		<td nowrap="nowrap">
		  <strong><?php print $component['name']; ?>:</strong>
		</td>
		<td width="98%">
		  <?php print $component['value'] ?>
		</td>
	      </tr>  
	    <?php endforeach; ?>
	  </table>
	</td>
      </tr>
    <?php endforeach; ?>
  </table>
<?php endif; ?>

File

THEMING.txt
View source
  1. Here is a code snippet that you can use to display Webform pane values into your invoices.
  2. Feel free to edit it to adjust your needs.
  3. =============================================================
  4. == Place the following into your theme/preprocess function ==
  5. =============================================================
  6. $webformPaneValues = array();
  7. $webforms = _uc_webform_pane_get_nodes();
  8. foreach ($webforms as $webform) {
  9. $components = array();
  10. $nid = $webform->nid;
  11. $node = node_load($nid);
  12. if(FALSE !== $node){
  13. foreach ($node->webform['components'] as $field){
  14. $components[] = array(
  15. 'name' => check_plain($field->name),
  16. 'value' => ${'order_webform_'.$nid.'_'.$field['form_key']},
  17. );
  18. }
  19. $webformPaneValues[] = array(
  20. 'title' => check_plain($node->title),
  21. 'components' => $components,
  22. );
  23. }
  24. }
  25. // Now, just pass $webformPaneValues to the template, for example through the template variables
  26. $tplVars = array(
  27. 'your-variable-1' => $yourVariable1,
  28. 'your-variable-2' => $yourVariable2,
  29. 'webformPaneValues' => $webformPaneValues,
  30. );
  31. return theme('your-theme-hook', $tplVars)
  32. ?>
  33. ====================================================
  34. == Place the following into your invoice template ==
  35. ====================================================
  36. :