Need help🙂 . I`m building a form for meals delivery service. On the page1 customer puts in delivery date, on page2 he can see menu set for the date (in tabs) with dish names, images, igredients, calories, etc. Form uses data from two tables. The first one includs dates and uniq id`s of menu elements for each date:
id------date--------salad1--salad2--soup1--soup2 ...
1---2015-03-01-----s6--------s2-------u1------u8 ...
The second one has dish details:
id---uniq_id---naimenov---price-------ingred-------------image
1------s1----------Greek-----8,30------Cheese,...-------.../12.jpg
....
27----b10---------Tea-------1,30-----Tea,sugar,...------.../24.jpg
Now I need to return all rows from second DB, where uniq_id=uniq id of the meal, and find for each dish prices, ingredients, etc., to place them into Custom fields of the form.
I put two DBread actions, first one with string in condition field:
<?php
return array('Menu.date' => $form->data["deliverydate"]);
?>
and ModelID 'Menu'. First step is ok, it works. I can show data from this arrow.
But no suscess, if I use in DBread#2 Condition field next code:
<?php
return array('uniq_id' => $form->data['Menu'][0]['soup1']);
?>
<?php
return array('uniq_id' => $form->data['Menu'][0]['soup2']);
?>
<?php
return array('uniq_id' => $form->data['Menu'][0]['salad1']);
?>
Actually, if I try use in Custom next:
<?php
echo $form->data['Meals'][0]['price'];
echo $form->data['Meals'][1]['price'];
?>
nothing happens. But if I`m using the quotes ' ' around the $form[] in Conditions field:
<?php
return array('uniq_id' => '$form->data['Menu'][0]['soup1']');
?>
<?php
return array('uniq_id' => '$form->data['Menu'][0]['soup2']');
?>
<?php
return array('uniq_id' => '$form->data['Menu'][0]['salad1']');
?>
it works, Custom field shows data, but with error:
"Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/......../administrator/components/com_chronoforms5/chronoforms/actions/db_read/db_read.php(67) : eval()'d code on line 2".
Can anyone help me? Something wrong with synthax, or there is another way to make this form, using php and CF 5 features?
Thnx in advance for some snippets.