Skip to content

Instantly share code, notes, and snippets.

@Apina
Last active December 14, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apina/c203ea36cf9e300e2230 to your computer and use it in GitHub Desktop.
Save Apina/c203ea36cf9e300e2230 to your computer and use it in GitHub Desktop.
Can be added to the event_list_display.php to show the early bird discount is in effect and the value of the discount or the value after discount.
<?php
$early_full_cost = $event->event_cost;
$early_discount = $event->early_disc;
$early_perc = $event->early_disc_percentage;
$early_full_cost = $event->event_cost;
$perc_symbol = "";
$currency_symbol = "";
$early_date = $event->early_disc_date;
$early_currentdate = date('Y-m-d');
if(strtotime($early_currentdate) < strtotime($early_date)){
if ($early_discount === '') {} else { //if no discount amount then no early bird discount set so do nothing
if ($early_perc === 'Y') {$show_early = $early_discount; $perc_symbol = "%";
echo '<p id="p_event_price-1" class="event_price early_bird_custom_all"><span class="early_bird_custom_title">Early Bird Discount: </span>' . number_format($show_early, 2, '.', '') . $perc_symbol .'</p>';
} //else check to see if it is percentage and if so grab the percentage amount
else
{$show_early = $early_discount; $currency_symbol = ""; //$early_full_cost - $early_discount;} //if not percentage
// this will display the discounted price rather than the discount itself
//{$show_early = $early_full_cost - $early_discount; $currency_symbol = ""; //$early_full_cost - $early_discount;} //if not percentage
echo '<p id="p_event_price-1" class="event_price early_bird_custom_all"><span class="early_bird_custom_title">Early Bird Discount: </span>' . $org_options['currency_symbol'].number_format($show_early, 2, '.', '') . $perc_symbol .'</p>';
}
}
} else {}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment