Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Use page template mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
ecartz committed May 30, 2020
1 parent 6790861 commit b57b209
Show file tree
Hide file tree
Showing 36 changed files with 147 additions and 2,060 deletions.
14 changes: 1 addition & 13 deletions account.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@

require "includes/languages/$language/account.php";

$breadcrumb->add(NAVBAR_TITLE, tep_href_link('account.php', '', 'SSL'));
require $oscTemplate->map_to_template(__FILE__, 'page');

require 'includes/template_top.php';

if ($messageStack->size('account') > 0) {
echo $messageStack->output('account');
}
?>

<div class="row"><?php echo $oscTemplate->getContent('account'); ?></div>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
33 changes: 1 addition & 32 deletions account_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,6 @@
}
}

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_edit.php', '', 'SSL'));
require $oscTemplate->map_to_template(__FILE__, 'page');

require 'includes/template_top.php';
?>

<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>

<?php
if ($messageStack->size($message_stack_area) > 0) {
echo $messageStack->output($message_stack_area);
}

echo tep_draw_form('account_edit', tep_href_link('account_edit.php', '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process');
?>

<div class="text-danger text-right"><?php echo FORM_REQUIRED_INFORMATION; ?></div>

<?php
$customer_data->display_input($customer_data->get_fields_for_page('account_edit'), $customer->fetch_to_address());
echo $OSCOM_Hooks->call('siteWide', 'injectFormDisplay');
?>

<div class="buttonSet">
<div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fas fa-angle-right', null, 'primary', null, 'btn-success btn-lg btn-block'); ?></div>
<p><?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fas fa-angle-left', tep_href_link('account.php', '', 'SSL')); ?></p>
</div>

</form>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
82 changes: 1 addition & 81 deletions account_history.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,86 +16,6 @@

require "includes/languages/$language/account_history.php";

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_history.php', '', 'SSL'));
require $oscTemplate->map_to_template(__FILE__, 'page');

require 'includes/template_top.php';
?>

<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>

<?php
if (tep_count_customer_orders() > 0) {
$history_query_raw = sprintf(<<<'EOSQL'
SELECT o.*, ot.text as order_total, s.orders_status_name
FROM orders o INNER JOIN orders_total ot ON o.orders_id = ot.orders_id INNER JOIN orders_status s ON o.orders_status = s.orders_status_id
WHERE ot.class = 'ot_total' AND s.public_flag = 1 AND s.language_id = %d AND o.customers_id = %d
ORDER BY orders_id DESC
EOSQL
, (int)$_SESSION['languages_id'], (int)$_SESSION['customer_id']);
$history_split = new splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY);
$history_query = tep_db_query($history_split->sql_query);
?>
<div class="table-responsive">
<table class="table table-hover table-striped">
<caption class="sr-only"><?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></caption>
<thead class="thead-dark">
<tr>
<th scope="col"><?php echo TEXT_ORDER_NUMBER; ?></th>
<th scope="col" class="d-none d-md-table-cell"><?php echo TEXT_ORDER_STATUS; ?></th>
<th scope="col"><?php echo TEXT_ORDER_DATE; ?></th>
<th scope="col" class="d-none d-md-table-cell"><?php echo TEXT_ORDER_PRODUCTS; ?></th>
<th scope="col"><?php echo TEXT_ORDER_COST; ?></th>
<th class="text-right" scope="col"><?php echo TEXT_VIEW_ORDER; ?></th>
</tr>
</thead>
<tbody>
<?php
while ($history = tep_db_fetch_array($history_query)) {
$products_query = tep_db_query("select sum(products_quantity) as count from orders_products where orders_id = '" . (int)$history['orders_id'] . "'");
$products = tep_db_fetch_array($products_query);
?>
<tr>
<th scope="row"><?php echo $history['orders_id']; ?></th>
<td class="d-none d-md-table-cell"><?php echo $history['orders_status_name']; ?></td>
<td><?php echo tep_date_short($history['date_purchased']); ?></td>
<td class="d-none d-md-table-cell"><?php echo $products['count']; ?></td>
<td><?php echo strip_tags($history['order_total']); ?></td>
<td class="text-right"><?php echo tep_draw_button(BUTTON_VIEW_ORDER, null, tep_href_link('account_history_info.php', tep_get_all_get_params(['order_id']) . 'order_id=' . (int)$history['orders_id'], 'SSL'), 'primary', NULL, 'btn-primary btn-sm'); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>

<div class="row align-items-center">
<div class="col-sm-6 d-none d-sm-block">
<?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?>
</div>
<div class="col-sm-6">
<?php echo $history_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(['page', 'info', 'x', 'y'])); ?>
</div>
</div>

<?php
} else {
?>

<div class="alert alert-info" role="alert">
<p><?php echo TEXT_NO_PURCHASES; ?></p>
</div>

<?php
}
?>

<div class="buttonSet my-2">
<?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fas fa-angle-left', tep_href_link('account.php', '', 'SSL'), null, null, 'btn-light'); ?>
</div>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
123 changes: 7 additions & 116 deletions account_history_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,130 +18,21 @@
tep_redirect(tep_href_link('account_history.php', '', 'SSL'));
}

$customer_info_query = tep_db_query("SELECT o.customers_id FROM orders o, orders_status s WHERE o.orders_id = ". (int)$_GET['order_id'] . " AND o.orders_status = s.orders_status_id AND s.language_id = " . (int)$languages_id . " AND s.public_flag = 1");
$customer_info_query = tep_db_query(sprintf(<<<'EOSQL'
SELECT o.customers_id
FROM orders o INNER JOIN orders_status s ON o.orders_status = s.orders_status_id
WHERE s.public_flag = 1 AND o.orders_id = %d AND s.language_id = %d
EOSQL
, (int)$_GET['order_id'], (int)$_SESSION['languages_id']));
$customer_info = tep_db_fetch_array($customer_info_query);
if ($customer_info['customers_id'] != $_SESSION['customer_id']) {
tep_redirect(tep_href_link('account_history.php', '', 'SSL'));
}

require "includes/languages/$language/account_history_info.php";

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_history.php', '', 'SSL'));
$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $_GET['order_id']), tep_href_link('account_history_info.php', 'order_id=' . $_GET['order_id'], 'SSL'));

$order = new order($_GET['order_id']);

require 'includes/template_top.php';
?>

<div class="row">
<div class="col-7"><h1 class="display-4"><?php echo HEADING_TITLE; ?></h1></div>
<div class="col text-right">
<h4><?php echo sprintf(HEADING_ORDER_NUMBER, $_GET['order_id']) . ' <span class="badge badge-secondary">' . $order->info['orders_status'] . '</span>'; ?></h4>
<p><?php echo '<strong>' . HEADING_ORDER_DATE . '</strong> ' . tep_date_long($order->info['date_purchased']); ?></p>
</div>
</div>

<div class="row">
<div class="col-sm-7">
<table class="table table-hover table-bordered">
<thead class="thead-dark">
<tr>
<th colspan="2"><?php echo HEADING_PRODUCTS; ?></th>
<?php
if (count($order->info['tax_groups']) > 1) {
?>
<th class="text-right"><?php echo HEADING_TAX; ?></th>
<?php
}
?>
<th class="text-right"><?php echo HEADING_TOTAL; ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($order->products as $product) {
echo '<tr>';
echo '<td align="right" width="30">' . $product['qty'] . '</td>';
echo '<td>' . $product['name'];
foreach (($product['attributes'] ?? []) as $attribute) {
echo '<br><small><i> - ' . $attribute['option'] . ': ' . $attribute['value'] . '</i></small>';
}
echo '</td>';

if (count($order->info['tax_groups']) > 1) {
echo '<td valign="top" class="text-right">' . tep_display_tax_value($product['tax']) . '%</td>';
}

echo '<td class="text-right">' . $currencies->format(tep_add_tax($product['final_price'], $product['tax']) * $product['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>';
echo '</tr>';
}

foreach ($order->totals as $total) {
echo '<tr>';
echo '<td colspan="4" class="text-right">' . $total['title'] . ' ' . $total['text'] . '</td>';
echo '</tr>';
}
?>
<tbody>
</table>
</div>
<div class="col">
<div class="border">
<ul class="list-group list-group-flush">
<?php
$address = $customer_data->get_module('address');
if ($order->delivery) {
echo '<li class="list-group-item">';
echo SHIPPING_FA_ICON;
echo '<b>' . HEADING_DELIVERY_ADDRESS . '</b><br>';
echo $address->format($order->delivery, 1, ' ', '<br>');
echo '</li>';
}
?>
<li class="list-group-item">
<?php
echo PAYMENT_FA_ICON;
echo '<b>' . HEADING_BILLING_ADDRESS . '</b><br>';
echo $address->format($order->billing, 1, ' ', '<br>');
?>
</li>
</ul>
</div>
</div>
</div>

<h4><?php echo HEADING_ORDER_HISTORY; ?></h4>

<ul class="list-group">
<?php
$statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '" . (int)$_GET['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' and os.public_flag = '1' order by osh.date_added");
while ($statuses = tep_db_fetch_array($statuses_query)) {
echo '<li class="list-group-item d-flex justify-content-between align-items-center">';
echo '<h6>' . $statuses['orders_status_name'] . '</h6>';
echo (empty($statuses['comments']) ? '' : '<p>' . nl2br(tep_output_string_protected($statuses['comments'])) . '</p>');
echo '<span class="badge badge-secondary badge-pill"><i class="far fa-clock mr-1"></i>' . $statuses['date_added'] . '</span>';
echo '</li>';
}
?>
</ul>

<?php
if (DOWNLOAD_ENABLED == 'true') {
include 'includes/modules/downloads.php';
}
?>
require $oscTemplate->map_to_template(__FILE__, 'page');

<?php
echo $OSCOM_Hooks->call('account_history_info', 'orderDetails');
?>

<div class="buttonSet my-2">
<?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fas fa-angle-left', tep_href_link('account_history.php', tep_get_all_get_params(['order_id']), 'SSL'), null, null, 'btn-light'); ?>
</div>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
30 changes: 1 addition & 29 deletions account_newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,6 @@
tep_redirect(tep_href_link('account.php', '', 'SSL'));
}

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_newsletters.php', '', 'SSL'));
require $oscTemplate->map_to_template(__FILE__, 'page');

require 'includes/template_top.php';
?>

<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_form('account_newsletter', tep_href_link('account_newsletters.php', '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process'); ?>

<div class="form-group row align-items-center">
<div class="col-form-label col-sm-4 text-left text-sm-right"><?php echo MY_NEWSLETTERS_GENERAL_NEWSLETTER; ?></div>
<div class="col-sm-8 pl-5 custom-control custom-switch">
<?php
echo tep_draw_checkbox_field('newsletter_general', '1', ($customer_data->get('newsletter', $newsletter) == '1'), 'class="custom-control-input" id="inputNewsletter"');
echo '<label for="inputNewsletter" class="custom-control-label text-muted"><small>' . MY_NEWSLETTERS_GENERAL_NEWSLETTER_DESCRIPTION . '&nbsp;</small></label>';
?>
</div>
</div>

<div class="buttonSet">
<div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_UPDATE_PREFERENCES, 'fas fa-users-cog', null, 'primary', null, 'btn-success btn-lg btn-block'); ?></div>
<p><?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fas fa-angle-left', tep_href_link('account.php', '', 'SSL')); ?></p>
</div>

</form>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
73 changes: 1 addition & 72 deletions account_notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,77 +61,6 @@
tep_redirect(tep_href_link('account.php', '', 'SSL'));
}

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_notifications.php', '', 'SSL'));
require $oscTemplate->map_to_template(__FILE__, 'page');

require 'includes/template_top.php';
?>

<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_form('account_notifications', tep_href_link('account_notifications.php', '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process'); ?>

<div class="alert alert-info" role="alert">
<?php echo MY_NOTIFICATIONS_DESCRIPTION; ?>
</div>

<div class="form-group row align-items-center">
<div class="col-form-label col-sm-4 text-left text-sm-right"><?php echo GLOBAL_NOTIFICATIONS_TITLE; ?></div>
<div class="col-sm-8">
<div class="custom-control custom-switch">
<?php echo tep_draw_checkbox_field('product_global', '1', ($global['global_product_notifications'] == '1'), 'class="custom-control-input" id="inputGlobalNotification"');
echo '<label for="inputGlobalNotification" class="custom-control-label">' . GLOBAL_NOTIFICATIONS_DESCRIPTION . '&nbsp;</label>';
?>
</div>
</div>
</div>

<?php
if ($global['global_product_notifications'] != '1') {
$products_check_query = tep_db_query("SELECT COUNT(*) AS total FROM products_notifications WHERE customers_id = " . (int)$_SESSION['customer_id']);
$products_check = tep_db_fetch_array($products_check_query);
if ($products_check['total'] > 0) {
?>

<div class="w-100"></div>
<div class="alert alert-warning" role="alert"><?php echo NOTIFICATIONS_DESCRIPTION; ?></div>

<div class="form-group row align-items-center">
<div class="col-form-label col-sm-4 text-left text-sm-right"><?php echo MY_NOTIFICATIONS_TITLE; ?></div>
<div class="col-sm-8">
<?php
$products_query = tep_db_query("SELECT pd.products_id, pd.products_name FROM products_description pd, products_notifications pn WHERE pn.customers_id = " . (int)$_SESSION['customer_id'] . " AND pn.products_id = pd.products_id AND pd.language_id = " . (int)$_SESSION['languages_id'] . " ORDER BY pd.products_name");
while ($products = tep_db_fetch_array($products_query)) {
echo '<div class="custom-control custom-switch">';
echo tep_draw_checkbox_field('products[]', $products['products_id'], true, 'class="custom-control-input" id="input_' . $products['products_id'] . 'Notification"');
echo '<label for="input_' . $products['products_id'] . 'Notification" class="custom-control-label">' . $products['products_name'] . '</label>';
echo '</div>';
}
?>
</div>
</div>

<?php
} else {
?>

<div class="alert alert-warning" role="alert">
<?php echo NOTIFICATIONS_NON_EXISTING; ?>
</div>

<?php
}
}
?>

<div class="buttonSet">
<div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_UPDATE_PREFERENCES, 'fas fa-users-cog', null, 'primary', null, 'btn-success btn-lg btn-block'); ?></div>
<p><?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fas fa-angle-left', tep_href_link('account.php', '', 'SSL')); ?></p>
</div>

</form>

<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
Loading

0 comments on commit b57b209

Please sign in to comment.