tidy up for showing a complete transaction

master
Marek Isalski 9 years ago
parent e386754095
commit b67436c465

@ -84,6 +84,9 @@ function fulcrm_shoppingcart_theme( $existing, $type, $theme, $path ) {
'fulcrm_shoppingcart_transaction_item' => array( 'variables' => array( 'item' => null ), // data returned from fulcrm API
'template' => 'fulcrm_shoppingcart_transaction_item',
),
'fulcrm_shoppingcart_transaction_complete' => array( 'variables' => array( 'transaction' => null ), // data returned from fulcrm API
'template' => 'fulcrm_shoppingcart_transaction_complete',
),
'fulcrm_shoppingcart_transaction_mailshots' => array( 'variables' => array( 'transaction' => null ), // data returned from fulcrm API
'template' => 'fulcrm_shoppingcart_transaction_mailshots',
),
@ -420,12 +423,6 @@ function fulcrm_shoppingcart_checkout() {
$transaction_data2 = fulcrm_apiv2_PATCH( $transaction_data[ 'data' ][ 'url' ],
$transaction_push, $query = array( 'expand' => implode( ',', array( 'd',
// 'lineitems',
// 'lineitems.d',
// 'lineitems.content_object',
// XXX 'lineitems.content_object.d',
// 'paymentitems',
// 'paymentitems.d',
) ) ) );
if ( $transaction_data2[ 'success' ] ) {
return theme( 'fulcrm_shoppingcart_transaction_checkout', array( 'transaction' => $transaction_data2[ 'data' ] ) );
@ -451,15 +448,7 @@ function fulcrm_shoppingcart_checkout_success( $transaction_id, $hmac ) {
if ( $transaction_data[ 'success' ] ) {
if ( $transaction_data[ 'data' ][ 'completed' ] )
drupal_set_message( t('Thank you for your order.'), 'status' );
$rval = '';
if ( $transaction_data[ 'data' ][ 'mailshots' ] )
$rval .= theme( 'fulcrm_shoppingcart_transaction_mailshots', array( 'transaction' => $transaction_data[ 'data' ] ) );
$rval .= '<pre>' . print_r( $transaction_data[ 'data' ], 1 ) . '</pre>'; // XXX debug
return $rval;
return theme( 'fulcrm_shoppingcart_transaction_complete', array( 'transaction' => $transaction_data[ 'data' ] ) );
} else {
drupal_set_message( t('Although your transaction appears to have completed successfully, there has been a problem fetching the full transaction data.'), 'error' );
}

@ -0,0 +1,30 @@
<?php print theme( 'fulcrm_shoppingcart_transaction_mailshots', array( 'transaction' => $transaction ) ); ?>
<table class="table">
<caption>Your order</caption>
<thead>
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php print theme( 'fulcrm_shoppingcart_transaction_items', array( 'items' => $transaction[ 'lineitems' ] ) ); ?>
</tbody>
<tfoot>
<tr>
<th colspan="3">
Total
</th>
<th>
<?php print $transaction[ '_price' ][ 'format_total' ]; ?>
</th>
</tr>
</tfoot>
</table>

@ -1,5 +1,5 @@
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">Emails about your Transaction</h3></div>
<div class="panel-heading"><h3 class="panel-title">Emails about your transaction</h3></div>
<ul class="list-group">
<?php foreach ( $transaction[ 'mailshots' ] as $mailshot ): ?>
<?php print theme( 'fulcrm_shoppingcart_transaction_mailshot', array( 'mailshot' => $mailshot ) ); ?>

Loading…
Cancel
Save