Ok, it's probably me, but I can't make this work as I expect.
I have data in a page (entered via a databound form). It's bookings for an event, with standard and student tickets available. I want to output a table of all bookings, with totals at the bottom (an overall total and totals for each type of ticket)
The 'student_ticket' and 'standard_ticket' fields are validated as 'decimal', so should be valid numbers for arithmetic purposes.
Here's what I'm doing:
Although I have several rows of test data in there, and the names, emails and numbers of tickets appear in the table correctly, the value returned by <cms:show total /> is zero, and the other two table cells which should contain totals are empty. The final table row is output as:
What's going on? (or to be more accurate, isn't going on!)
I have data in a page (entered via a databound form). It's bookings for an event, with standard and student tickets available. I want to output a table of all bookings, with totals at the bottom (an overall total and totals for each type of ticket)
The 'student_ticket' and 'standard_ticket' fields are validated as 'decimal', so should be valid numbers for arithmetic purposes.
Here's what I'm doing:
- Code: Select all
<cms:set student_total '0' scope='global'/>
<cms:set standard_total '0' scope='global'/>
<cms:set total '0' scope='global' />
<table class='table'>
<tr><th>Name</th><th>Email</th><th>Standard</th><th>Student</th></tr>
<cms:pages masterpage='booking.php'>
<tr>
<td><cms:show booking_name /></td>
<td><cms:show email /></td>
<td><cms:show standard_tickets /></td>
<td><cms:show student_tickets /></td>
</tr>
<cms:set standard_total = "<cms:add standard_total standard_tickets />" />
<cms:set student_total = "<cms:add student_total student_tickets />" />
</cms:pages>
<cms:set total = "<cms:add student_total standard_total />" />
<tr>
<td><strong>Totals</strong></td>
<td><cms:show total /></td>
<td><cms:show standard_total /></td>
<td><cms:show student_total /></td>
</tr>
</table>
Although I have several rows of test data in there, and the names, emails and numbers of tickets appear in the table correctly, the value returned by <cms:show total /> is zero, and the other two table cells which should contain totals are empty. The final table row is output as:
- Code: Select all
<tr>
<td><strong>Totals</strong></td>
<td>0</td>
<td></td>
<td></td>
</tr>
What's going on? (or to be more accurate, isn't going on!)