very basic checking out
This commit is contained in:
parent
db43364b17
commit
350c4d9e82
@ -63,6 +63,15 @@ function fulcrm_shoppingcart_theme( $existing, $type, $theme, $path ) {
|
||||
'fulcrm_shoppingcart_cart_item' => array( 'variables' => array( 'shoppingitem' => null ), // data returned from fulcrm API
|
||||
'template' => 'fulcrm_shoppingcart_cart_item',
|
||||
),
|
||||
'fulcrm_shoppingcart_transaction_checkout' => array( 'variables' => array( 'transaction' => null ), // data returned from fulcrm API
|
||||
'template' => 'fulcrm_shoppingcart_transaction_checkout',
|
||||
),
|
||||
'fulcrm_shoppingcart_transaction_items' => array( 'variables' => array( 'items' => null ), // data returned from fulcrm API
|
||||
'template' => 'fulcrm_shoppingcart_transaction_items',
|
||||
),
|
||||
'fulcrm_shoppingcart_transaction_item' => array( 'variables' => array( 'item' => null ), // data returned from fulcrm API
|
||||
'template' => 'fulcrm_shoppingcart_transaction_item',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -376,5 +385,18 @@ function fulcrm_shoppingcart_cart() {
|
||||
|
||||
function fulcrm_shoppingcart_checkout() {
|
||||
$cart = fulcrm_shoppingcart_get_session_cart( false );
|
||||
return print_r( $cart, 1 );
|
||||
if ( $cart && array_key_exists( 'url', $cart ) ) {
|
||||
$transaction_data = fulcrm_apiv2_POST( $cart[ 'url' ] . 'transaction/', array(), $query = array( 'expand' => implode( ',', array( 'd',
|
||||
'lineitems',
|
||||
'lineitems.d',
|
||||
'lineitems.content_object',
|
||||
// XXX 'lineitems.content_object.d',
|
||||
'paymentitems',
|
||||
'paymentitems.d',
|
||||
) ) ) );
|
||||
if ( $transaction_data[ 'success' ] )
|
||||
return theme( 'fulcrm_shoppingcart_transaction_checkout', array( 'transaction' => $transaction_data[ 'data' ] ) );
|
||||
return 'problem 2';
|
||||
}
|
||||
return 'problem 1';
|
||||
}
|
||||
|
33
fulcrm_shoppingcart_transaction_checkout.tpl.php
Normal file
33
fulcrm_shoppingcart_transaction_checkout.tpl.php
Normal file
@ -0,0 +1,33 @@
|
||||
<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>
|
||||
<tr>
|
||||
<td><a class="btn btn-success" href="<?php check_plain( variable_get( 'fulcrm_shoppingcart_proceed_url', url('<front>') ) )?>"><?php print check_plain( variable_get( 'fulcrm_shoppingcart_proceed_text', '' ) ); ?></a></td>
|
||||
<td colspan="2"> </td>
|
||||
<td class="text-right"><?php foreach ( ( $transaction[ '_paymentmethods' ][ 'preferred' ] + $transaction[ '_paymentmethods' ][ 'other' ] ) as $paymentmethod ): ?><a class="btn btn-primary" href="<?php print $paymentmethod[ 'payment_url' ]; ?>"><?php print check_plain( $paymentmethod[ 'name' ] ); ?></a><?php endforeach; ?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
6
fulcrm_shoppingcart_transaction_item.tpl.php
Normal file
6
fulcrm_shoppingcart_transaction_item.tpl.php
Normal file
@ -0,0 +1,6 @@
|
||||
<tr>
|
||||
<td><!-- <span class="pull-right"><a class="btn btn-xs btn-danger" title="Remove from cart" href="<?php /* print fulcrm_shoppingcart_remove_url( $item[ 'id' ] ); */ ?>"><span class="glyphicon glyphicon-trash"></span></a></span>--> <?php print nl2br( check_plain( $item[ 'name' ] ) ); ?></td>
|
||||
<td class="text-right"><?php print check_plain( $item[ '_price' ][ 'format_item_net' ] ); ?></td>
|
||||
<td class="text-right"><?php print check_plain( $item[ 'quantity' ] ); ?></td>
|
||||
<td class="text-right"><?php print check_plain( $item[ '_price' ][ 'format_total' ] ); ?></td>
|
||||
</tr>
|
3
fulcrm_shoppingcart_transaction_items.tpl.php
Normal file
3
fulcrm_shoppingcart_transaction_items.tpl.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php foreach ( $items as $item ): ?>
|
||||
<?php print theme( 'fulcrm_shoppingcart_transaction_item', array( 'item' => $item ) ); ?>
|
||||
<?php endforeach; ?>
|
Loading…
x
Reference in New Issue
Block a user