detect when there is an eventbooking ddatacollection to gather

master
Marek Isalski 5 years ago
parent 207812aa8a
commit 1d7810da83

@ -442,6 +442,11 @@ function _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( &$form_s
),
);
if ( $form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'eventbooking_ddatacollection' ] ) {
$item[ 'd' ][ 'fulcrm' ][ 'eventbooking' ][ 'd' ][ 'fulcrm_collections' ] = array( $form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'eventbooking_ddatacollection' ][ 's' ] );
$item[ 'd' ][ 'fulcrm' ][ 'eventbooking' ][ 'd' ][ '_structure' ] = $form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'eventbooking_ddatacollection' ][ '_structure' ];
}
$api_data = fulcrm_apiv2_POST( 'shoppingitem/', $item, $query = array( 'expand' => 'd' ) );
fulcrm_shoppingcart_invalidate_cache();
if ( $api_data[ 'success' ] ) {
@ -1224,9 +1229,27 @@ function fulcrm_shoppingcart_donate() {
return drupal_goto( 'fulcrm/checkout' );
}
function fulcrm_shoppingcart_pre_cart_step( &$cart ) {
die( 'DIE: ' . print_r( $cart, 1 ) );
}
function fulcrm_shoppingcart_has_pre_cart_step( &$cart ) {
foreach ( $cart[ 'shoppingitems' ] as $k => $item ) {
if ( array_key_exists( 'eventbooking', $item[ 'd' ][ 'fulcrm' ] ) ) {
if ( array_key_exists( '_structure', $item[ 'd' ][ 'fulcrm' ][ 'eventbooking' ][ 'd' ] ) )
return true;
}
}
return false;
}
function fulcrm_shoppingcart_checkout() {
$cart = fulcrm_shoppingcart_get_session_cart( false );
if ( $cart && array_key_exists( 'url', $cart ) ) {
if ( fulcrm_shoppingcart_has_pre_cart_step( $cart ) ) {
return fulcrm_shoppingcart_pre_cart_step( $cart );
}
$hook_results = module_invoke_all( 'fulcrm_shoppingcart_pre_cart_to_transaction', $cart );
foreach ( $hook_results as $hook_result )
return $hook_result;

Loading…
Cancel
Save