From cd6323a4c53581be11373a75a89167463dcc79ad Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Mon, 21 May 2018 00:38:40 +0100 Subject: [PATCH] working with multiple guest purchases --- fulcrm_shoppingcart.module | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fulcrm_shoppingcart.module b/fulcrm_shoppingcart.module index b922ccf..f50ee7c 100644 --- a/fulcrm_shoppingcart.module +++ b/fulcrm_shoppingcart.module @@ -427,25 +427,23 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta if ( array_key_exists( 'ticket_for_persons', $form_state[ 'values' ] ) ) { foreach ( $form_state[ 'values' ][ 'ticket_for_persons' ] as $ticket_for_person ) { - $person_name = 'unnamed person'; + $add_person_name = 'unnamed person'; if ( $ticket_for_person === 'myself' ) { - $person_uuid = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ]; - $person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ]; + $add_person_uuid = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ]; + $add_person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ]; } else { - $person_uuid = fulcrm_crypto_get_object_id_form_value( 'person.uuid', $ticket_for_person ); - if ( $person_uuid ) - $person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'persons' ][ $person_uuid ][ 'name' ]; + $add_person_uuid = fulcrm_crypto_get_object_id_form_value( 'person.uuid', $ticket_for_person ); + if ( $add_person_uuid ) + $add_person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'persons' ][ $add_person_uuid ][ 'name' ]; } _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, - $person_uuid, $person_name, $product_id ); + $add_person_uuid, $add_person_name, $product_id ); } } else { - $person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ] ]; + $person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $person_uuid ]; _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, - $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ], - $person[ 'name' ], - $product_id ); + $person_uuid, $person[ 'name' ], $product_id ); } } else {