Skip to content

Commit

Permalink
Get fallback values for pricing UI if not saved; don't echo checked
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Dec 19, 2023
1 parent 314566b commit 63fedf4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/mt-processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ function mt_registration_fields( $form, $has_data, $data, $public = 'admin' ) {
</fieldset>
<fieldset><legend>' . __( 'Ticket Counting Method', 'my-tickets' ) . "</legend>
<p>
<input type='radio' name='mt_counting_method' id='mt_counting_method_discrete' value='discrete' " . checked( $method, 'discrete' ) . " /> <label for='mt_counting_method_discrete'>" . __( 'Discrete - (Section A, Section B, etc.)', 'my-tickets' ) . "</label><br />
<input type='radio' name='mt_counting_method' id='mt_counting_method_continuous' value='continuous' " . checked( $method, 'continuous' ) . " /> <label for='mt_counting_method_continuous'>" . __( 'Continuous - (Adult, Child, Senior)', 'my-tickets' ) . "</label><br />
<input type='radio' name='mt_counting_method' id='mt_counting_method_event' value='event' " . checked( $method, 'event' ) . " /> <label for='mt_counting_method_event'>" . __( 'Events (Jan 1st, 2pm)', 'my-tickets' ) . '</label>
<input type='radio' name='mt_counting_method' id='mt_counting_method_discrete' value='discrete' " . checked( $method, 'discrete', false ) . " /> <label for='mt_counting_method_discrete'>" . __( 'Discrete - (Section A, Section B, etc.)', 'my-tickets' ) . "</label><br />
<input type='radio' name='mt_counting_method' id='mt_counting_method_continuous' value='continuous' " . checked( $method, 'continuous', false ) . " /> <label for='mt_counting_method_continuous'>" . __( 'Continuous - (Adult, Child, Senior)', 'my-tickets' ) . "</label><br />
<input type='radio' name='mt_counting_method' id='mt_counting_method_event' value='event' " . checked( $method, 'event', false ) . " /> <label for='mt_counting_method_event'>" . __( 'Events (Jan 1st, 2pm)', 'my-tickets' ) . '</label>
</p>
</fieldset></div>';
if ( false !== $description ) {
Expand Down Expand Up @@ -380,6 +380,9 @@ function mt_registration_fields( $form, $has_data, $data, $public = 'admin' ) {
* @return string
*/
function mt_prices_table( $registration = array() ) {
if ( empty( $registration ) ) {
$registration = mt_get_settings( 'defaults' )['continuous'];
}
$counting = $registration['counting_method'];
$available = '';
$tickets = ( isset( $registration['tickets'] ) ) ? $registration['tickets'] : false;
Expand Down

0 comments on commit 63fedf4

Please sign in to comment.