Add initial files and database migration for ticket pricing system
- Created new directories and index files for controls, factory, and views. - Added .htaccess files for URL rewriting in layout and images directories. - Included a logo image in the layout/images directory. - Implemented load_prices.php to load ticket prices from the database into settings. - Developed admin panel settings page for enabling ticket sales. - Created tickets management page in the admin panel to display and edit ticket prices. - Added upgrade.php for database migrations, including creating the ticket_prices table and adding weekend price column.
This commit is contained in:
@@ -8,7 +8,9 @@ class Tickets
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if ( !$settings['tickets']['enable_sell'] )
|
||||
$enable_sell = \factory\Apanel::getSetting('enable_sell', '1');
|
||||
|
||||
if ( !$enable_sell || $enable_sell === '0' )
|
||||
return \Tpl::view( 'tickets/disabled-sell' );
|
||||
|
||||
return \Tpl::view('tickets/main-view', [
|
||||
@@ -51,8 +53,13 @@ class Tickets
|
||||
$addon = 0;
|
||||
}
|
||||
|
||||
$is_weekend = $selected_date && in_array((new \DateTime($selected_date))->format('N'), ['6', '7']);
|
||||
$base_price = $is_weekend
|
||||
? ($settings['tickets'][$ticket_id]['price_weekend'] ?? $settings['tickets'][$ticket_id]['price'])
|
||||
: $settings['tickets'][$ticket_id]['price'];
|
||||
|
||||
$basket[$ticket_id][$diffDays]['ticket_id'] = $ticket_id;
|
||||
$basket[$ticket_id][$diffDays]['ticket_price'] = $settings['tickets'][$ticket_id]['price'] + $addon;
|
||||
$basket[$ticket_id][$diffDays]['ticket_price'] = $base_price + $addon;
|
||||
$basket[$ticket_id][$diffDays]['product_id'] = $settings['tickets'][$ticket_id]['product_id'];
|
||||
$basket[$ticket_id][$diffDays]['quantity'] = 1;
|
||||
$basket[$ticket_id][$diffDays]['date'] = $selected_date;
|
||||
|
||||
Reference in New Issue
Block a user