Home › Forums › Add-ons › Options Page › ACF options page and nested/multidimensional arrays
I’m trying to understand which is the best way to edit data in a multidimensional array like this through an ACF options page
<?php
/**
*
* Arrey prezzi date sistemazioni supplementi del booking
*
*/
$prezzi = [
'destinazione' => [
'corfu' => [
'nome-UTF8' => 'Corfù',
'data-partenza' => [
'2020-07-16' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 395.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 445.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
'2020-07-23' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 395.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 445.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
'2020-07-30' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 395.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 445.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
'2020-08-06' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 385.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 445.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
'2020-08-13' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 365.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 435.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
'2020-08-20' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 345.0,
'supplemento-monolocale-2-pax' => 50.0,
],
'comfort' => [
'quota-base' => 395.0,
'supplemento-monolocale-2-pax' => 60.0,
],
'superior' => [
'quota-base' => 405.0,
'supplemento-monolocale-2-pax' => 60.0,
],
],
],
],
],
'zante' => [
'nome-UTF8' => 'Zante',
'data-partenza' => [
'2020-07-17' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 395.0,
'bilocale-4-pax' => 415.0,
'studio-3-pax' => 405.0,
'studio-2-pax' => 425.0,
],
],
],
'2020-07-24' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 395.0,
'bilocale-4-pax' => 425.0,
'studio-3-pax' => 415.0,
'studio-2-pax' => 445.0,
],
],
],
'2020-07-31' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 395.0,
'bilocale-4-pax' => 425.0,
'studio-3-pax' => 415.0,
'studio-2-pax' => 445.0,
],
],
],
'2020-08-07' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 395.0,
'bilocale-4-pax' => 425.0,
'studio-3-pax' => 415.0,
'studio-2-pax' => 445.0,
],
],
],
'2020-08-14' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 385.0,
'bilocale-4-pax' => 425.0,
'studio-3-pax' => 415.0,
'studio-2-pax' => 445.0,
],
],
],
],
],
'pag' => [
'nome-UTF8' => 'Pag',
'data-partenza' => [
'2020-07-18' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 274.0,
'supplemento-mono-3-pax' => 30.0,
'supplemento-mono-2-pax' => 50.0,
],
],
],
'2020-07-25' => [
'soldout' => true,
'sistemazione' => [
'basic' => [
'quota-base' => 274.0,
'supplemento-mono-3-pax' => 30.0,
'supplemento-mono-2-pax' => 50.0,
],
],
],
'2020-08-01' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 274.0,
'supplemento-mono-3-pax' => 30.0,
'supplemento-mono-2-pax' => 50.0,
],
],
],
'2020-08-08' => [
'soldout' => false,
'sistemazione' => [
'basic' => [
'quota-base' => 274.0,
'supplemento-mono-3-pax' => 30.0,
'supplemento-mono-2-pax' => 50.0,
],
],
],
],
],
],
];
?>
this particular stucture is for obtain the price of some accomodation within an ajax price form. For the moment this is placed in a prices.php page and included into the ajax request, but I would like to have this in an option page so users can edit prices or even add more rows to existing array, essentialy only the deeper part of this array and the external part must be a repater so
this one
$prezzi['destinazione']
and this one
$prezzi['destinazione']['corfu']['data-partenza']['2020-07-16']['sistemazione']['basic']
I just need a starting point.. many thanks
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.