almost there with the data structure to send across

master
Marek Isalski 7 years ago
parent f2b3a7046d
commit 2bdf1ce2c7

@ -10,6 +10,10 @@ function fulcrm_shoppingcart_permission() {
function hook_fulcrm_shoppingcart_alter_person_add( $person ) {
}
function fulcrm_shoppingcart_fulcrm_shoppingcart_alter_person_add( $person ) {
return $person;
}
function hook_fulcrm_shoppingcart_person_add( $person, $redirect_destination ) {
}
@ -249,6 +253,8 @@ function _fulcrm_shoppingcart_person_add_form_submit_to_data( $form, &$form_stat
}
$person_data[ 'uuid' ] = fulcrm_uuid_uuid4();
return $person_data;
}
function fulcrm_shoppingcart_person_add_form_submit( $form, &$form_state ) {
@ -283,7 +289,7 @@ function fulcrm_shoppingcart_person_add_guest_form_submit( $form, &$form_state )
module_invoke_all( 'fulcrm_shoppingcart_person_add', $api_data[ 'data' ], array_key_exists( 'destination', $_GET ) ? $_GET[ 'destination' ] : variable_get( 'fulcrm_shoppingcart_proceed_url', url('<front>') ) );
$form_state[ 'fulcrm_collection' ][ 'person' ] = $person_data;
$form_state[ 'fulcrm_collection' ][ 'shoppingcart' ] = $api_data[ 'cart' ];
$form_state[ 'fulcrm_collection' ][ 'shoppingcart' ] = $api_data[ 'data' ];
} else {
drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' );
}
@ -321,7 +327,7 @@ function fulcrm_shoppingcart_person_add( $collection_id, $hmac ) {
}
}
function _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( &$form_state, $person_uuid, $person_name ) {
function _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( &$form_state, $cart, $person_uuid, $person_name, $product_id ) {
$shoppingitem_name = ( $form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'event' ][ 'name' ] . "\r\n" .
$form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'name' ] . ', ' . $person_name . "\r\n" .
$form_state[ 'fulcrm_shoppingcart' ][ 'product' ][ 'name' ] );
@ -417,12 +423,14 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
$person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'persons' ][ $person_uuid ][ 'name' ];
}
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $person_uuid, $person_name );
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart,
$person_uuid, $person_name, $product_id );
}
} else {
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state,
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart,
$form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ],
$form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ] );
$form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ],
$product_id );
}
} else {

Loading…
Cancel
Save