Hola amigos del foro.
Solicito ayuda a la comunidad para que me apoyen con algunas ideas de como agrupar y convertir mi array origen y mostrar el array destino.
La casuistica es la siguiente.
Se trata de solicitar una disponibilidad para una reserva de 3 habitaciones para 2 noches , la ocupancia es la siguiente 2 adultos y 1 ninio, en la primera habitacion y el la segunta y tercera habitacion la ocupancia es de 2 adulstos y 0 ninios, como veran en el array de origen me devuelve 6 arreglos ya que se generan 3 habitaciones por cada noche .
Y entonces el array destino es mi problema porque , como veran en el array destino de agruparse para tener 3 array en los room , para eso el primer arreglo continene la solicitud de disponibilidad del primer cuarto 2 adultos y 1 niños así como el segundo 1 adulto y 0 niños pero con la particularidad que tiene un campo llamado [count] = 2 , que sirva para identificar cuando existe solicitudes iguales en un cuarto tal como se da en el cuarto 2 y cuarto 3.
Array Origien :
[values] => SimpleXMLElement Object
(
[date_in] => 20150331
[nights] => 2
[language_code] => 1
[rooms] => SimpleXMLElement Object
(
[numberofrooms] => 3
[room] => Array
(
[0] => SimpleXMLElement Object
(
[date] => 20150331
[type_room] => Doble
[rate] => 110.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 93.50
[service] => AI
[currency] => US$
[adults] => 2
[children] => 1
[childrenage1] => 1
[childrenage2] => 0
)
[1] => SimpleXMLElement Object
(
[date] => 20150331
[type_room] => Single
[rate] => 95.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 80.75
[service] => AI
[currency] => US$
[adults] => 1
[children] => 0
[childrenage1] => SimpleXMLElement Object
(
)
[childrenage2] => 0
)
[2] => SimpleXMLElement Object
(
[date] => 20150331
[type_room] => Single
[rate] => 95.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 80.75
[service] => AI
[currency] => US$
[adults] => 1
[children] => 0
[childrenage1] => SimpleXMLElement Object
(
)
[childrenage2] => 0
)
[3] => SimpleXMLElement Object
(
[date] => 20150401
[type_room] => Doble
[rate] => 110.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 93.50
[service] => AI
[currency] => US$
[adults] => 2
[children] => 1
[childrenage1] => 1
[childrenage2] => 0
)
[4] => SimpleXMLElement Object
(
[date] => 20150401
[type_room] => Single
[rate] => 95.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 80.75
[service] => AI
[currency] => US$
[adults] => 1
[children] => 0
[childrenage1] => SimpleXMLElement Object
(
)
[childrenage2] => 0
)
[5] => SimpleXMLElement Object
(
[date] => 20150401
[type_room] => Single
[rate] => 95.00
[comission_percentage] => 15.00
[net_rate_to_pay] => 80.75
[service] => AI
[currency] => US$
[adults] => 1
[children] => 0
[childrenage1] => SimpleXMLElement Object
(
)
[childrenage2] => 0
)
)
)
Array Destino
=========
Array
(
[destination] => STI
[consolidate] => 181128
[destiny] => Barahona, Republica Dominicana
[name] =>
[product] =>
[hotelcode] =>
[checkin] => 20150331
[checkout] => 20150302
[nights] => 2
[rooms] => 3[listrooms] => Array
(
[0] => Array
(
[numroom] => 1
[count] => 1
[adults] => 2
[children] => 1
[childrenages] => 1
)
[1] => Array
(
[numroom] => 1
[count] => 2
[adults] => 1
[children] => 0
[childrenages] => 0
)
)
[nationality] => 136
[partner] => 2
[agency] => 16
[pricetypeagency] => 1
[language] => es
[token] => j994hdvv9834njjddckecfronj483chg
)
Todas las ideas son muy bienvenidas para dar solución con este tema.