I have a multiselect field in a structure field. I get the data from the multiselect field using the query: site.find(“…”).children.published. That works too. Now I need the individual values from the multiselect field in the template.
$page->fieldName()->toPages(',') // comma here needed for comma separated values, for a pages field, you would remove the param
then loop through that collection
Ok this works here. Now I have a price field for each package which I would like to add up.
How can I now save the individual prices as a variable?
<?php $packages = $page->bundle()->toStructure(); foreach ($packages as $package): ?>
<?php foreach ($package->events_bundle()->toPages(',') as $event): ?>
<?= $event->price()->esc() ?>
<?php endforeach ?>
<?php endforeach ?>