module starting to work; needs to add in fulcrm_collection now

master
Marek Isalski 8 years ago
parent 80e52bb79f
commit fa6fb457c3

@ -97,13 +97,32 @@ function fulcrm_shoppingcart_get_session_cart( $create = true ) {
function fulcrm_shoppingcart_buy( $product_id ) {
$api_data = fulcrm_apiv2_GET( 'product/' . $product_id . '/',
$query = array( 'expand' => implode( ',', array( 'content_object', 'selector_object' ) ) ) );
return print_r( $api_data, 1 );
$query = array( 'expand' => implode( ',', array( 'content_object',
'selector_object',
'person_ddatacollection',
'organisation_ddatacollection',
'thing_ddatacollection',
'transaction_ddatacollection',
'lineitem_ddatacollection',
) ) ) );
if ( $api_data[ 'success' ] ) {
switch ( fulcrm_apiv2_url_to_type( $api_data[ 'data' ][ 'content_object' ][ 'url' ] ) ) {
case 'eventbookingtype':
break;
default:
return 'cannot handle these products yet';
}
return 'ok!';
} else {
return 'error adding item to shopping basket';
}
}
function fulcrm_shoppingcart_cart() {
$cart = fulcrm_shoppingcart_get_session_cart( false );
return theme( 'fulcrm_shopping_cart', array( 'cart' => $cart ) );
return theme( 'fulcrm_shoppingcart_cart', array( 'cart' => $cart ) );
}
function fulcrm_shoppingcart_checkout() {

@ -1 +1,16 @@
fulcrm_shoppingcart_cart.tpl.php
<table class="table">
<caption>Your shopping cart</caption>
<thead>
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php print theme( 'fulcrm_shoppingcart_items', array( 'items' => $cart[ 'shoppingitems' ] ) ); ?>
</tbody>
</table>

@ -1 +1,5 @@
<?php /* fulcrm-shoppingcart-item.tpl.php */
<tr>
<td><?php print check_plain( $item[ 'name' ] ); ?></td>
<td><?php print check_plain( $item[ 'product' ][ '_price' ][ 'format_total_net' ] ); ?></td>
<td><?php print check_plain( $item[ 'quantity' ] ); ?></td>
</tr>

@ -1 +1,3 @@
<?php /* fulcrm-shoppingcart-items.tpl.php */
<?php foreach ( $items as $item ): ?>
<?php print theme( 'fulcrm_shoppingcart_item', array( 'item' => $item ) ); ?>
<?php endforeach; ?>

Loading…
Cancel
Save