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

Commit

Permalink
Merge pull request #1041 from gburton/1.0.7.15
Browse files Browse the repository at this point in the history
1.0.7.15
  • Loading branch information
ecartz authored Feb 10, 2021
2 parents 6d0b9e7 + 6082356 commit d31f384
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 66 deletions.
8 changes: 6 additions & 2 deletions admin/action_recorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@
<?php
$filter = [];

if (isset($_GET['module']) && in_array($_GET['module'], $modules)) {
$filter[] = " module = '" . tep_db_input($_GET['module']) . "' ";
if (isset($_GET['module'])) {
if (in_array($_GET['module'], $modules)) {
$filter[] = " module = '" . tep_db_input($_GET['module']) . "' ";
} else {
unset($_GET['module']);
}
}

if (!empty($_GET['search'])) {
Expand Down
2 changes: 1 addition & 1 deletion admin/products_attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@
<div class="col-3">
<select name="option_id" class="form-control">
<?php
$options = tep_db_query("SELECT products_options_id, products_options_name FROM products_options WHERE language_id = '" . $_SESSION['languages_id'] . "' ORDER BY products_options_name");
$options = tep_db_query("SELECT * FROM products_options WHERE language_id = '" . $_SESSION['languages_id'] . "' ORDER BY products_options_name");
while ($options_values = $options->fetch_assoc()) {
echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
}
Expand Down
56 changes: 28 additions & 28 deletions includes/modules/content/index_products/cm_ip_product_listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function __construct() {
}

function execute() {
global $cPath, $current_category_id, $messageStack, $currencies, $PHP_SELF;
global $current_category_id, $messageStack, $currencies, $PHP_SELF;

$listing_sql = <<<'EOSQL'
SELECT p.*, pd.*, m.*,
Expand All @@ -36,84 +36,84 @@ function execute() {
// show the products of a specified manufacturer
if (empty($_GET['manufacturers_id'])) {
// show the products in a given category
if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
if (isset($_GET['filter_id']) && !Text::is_empty($_GET['filter_id'])) {
// We are asked to show only a specific manufacturer
$listing_sql .= <<<'EOSQL'
$listing_sql .= sprintf(<<<'EOSQL'
INNER JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
INNER JOIN products_to_categories p2c ON p.products_id = p2c.products_id
WHERE p.products_status = 1 AND m.manufacturers_id =
WHERE p.products_status = 1 AND m.manufacturers_id = %d AND pd.language_id = %d AND p2c.categories_id = %d
EOSQL
. (int)$_GET['filter_id'] . " AND pd.language_id = " . (int)$_SESSION['languages_id'] . " AND p2c.categories_id = " . (int)$current_category_id;
, (int)$_GET['filter_id'], (int)$_SESSION['languages_id'], (int)$current_category_id);
} else {
// We show them all
$listing_sql .= <<<'EOSQL'
$listing_sql .= sprintf(<<<'EOSQL'
INNER JOIN products_to_categories p2c ON p.products_id = p2c.products_id
LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
INNER JOIN products_to_categories p2c
WHERE p.products_status = 1 AND p.products_id = p2c.products_id AND pd.products_id = p2c.products_id AND pd.language_id =
WHERE p.products_status = 1 AND pd.language_id = %d AND p2c.categories_id = %d
EOSQL
. (int)$_SESSION['languages_id'] . " AND p2c.categories_id = " . (int)$current_category_id;
, (int)$_SESSION['languages_id'], (int)$current_category_id);
}
} else {
if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
if (isset($_GET['filter_id']) && !Text::is_empty($_GET['filter_id'])) {
// We are asked to show only a specific category
$listing_sql .= <<<'EOSQL'
$listing_sql .= sprintf(<<<'EOSQL'
INNER JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
INNER JOIN products_to_categories p2c ON p.products_id = p2c.products_id
WHERE p.products_status = 1 AND m.manufacturers_id =
WHERE p.products_status = 1 AND m.manufacturers_id = %d AND pd.language_id = %d AND p2c.categories_id = %d
EOSQL
. (int)$_GET['manufacturers_id'] . " AND pd.language_id = " . (int)$_SESSION['languages_id'] . " AND p2c.categories_id = " . (int)$_GET['filter_id'];
, (int)$_GET['manufacturers_id'], (int)$_SESSION['languages_id'], (int)$_GET['filter_id']);
} else {
// We show them all
$listing_sql .= <<<'EOSQL'
$listing_sql .= sprintf(<<<'EOSQL'
INNER JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
WHERE p.products_status = 1 AND pd.language_id =
WHERE p.products_status = 1 AND pd.language_id = %d AND m.manufacturers_id = %d
EOSQL
. (int)$_SESSION['languages_id'] . " AND m.manufacturers_id = " . (int)$_GET['manufacturers_id'];
, (int)$_SESSION['languages_id'], (int)$_GET['manufacturers_id']);
}
}

$listing_sql .= $GLOBALS['OSCOM_Hooks']->call('filter', 'injectSQL');
require 'includes/system/segments/sortable_product_columns.php';

// optional Product List Filter
$output = null;
$output = '';
if (PRODUCT_LIST_FILTER > 0) {
if (empty($_GET['manufacturers_id'])) {
$filterlist_sql = <<<'EOSQL'
$filterlist_sql = sprintf(<<<'EOSQL'
SELECT DISTINCT m.manufacturers_id AS id, m.manufacturers_name AS name
FROM products p, products_to_categories p2c, manufacturers m
WHERE p.products_status = 1
AND p.manufacturers_id = m.manufacturers_id
AND p.products_id = p2c.products_id
AND p2c.categories_id =
AND p2c.categories_id = %d
ORDER BY m.manufacturers_name
EOSQL
. (int)$current_category_id . " ORDER BY m.manufacturers_name";
, (int)$current_category_id);
} else {
$filterlist_sql = <<<'EOSQL'
$filterlist_sql = sprintf(<<<'EOSQL'
SELECT DISTINCT c.categories_id AS id, cd.categories_name AS name
FROM products p, products_to_categories p2c, categories c, categories_description cd
WHERE p.products_status = 1
AND p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id
AND p2c.categories_id = cd.categories_id
AND cd.language_id =
AND cd.language_id = %d AND p.manufacturers_id = %d
ORDER BY cd.categories_name
EOSQL
. (int)$_SESSION['languages_id'] . " AND p.manufacturers_id = " . (int)$_GET['manufacturers_id']
. " ORDER BY cd.categories_name";
, (int)$_SESSION['languages_id'], (int)$_GET['manufacturers_id']);
}

$filterlist_query = tep_db_query($filterlist_sql);
if (tep_db_num_rows($filterlist_query) > 1) {
if (mysqli_num_rows($filterlist_query) > 1) {
if (empty($_GET['manufacturers_id'])) {
$output = tep_draw_hidden_field('cPath', $cPath);
$output = tep_draw_hidden_field('cPath', $GLOBALS['cPath']);
$options = [['id' => '', 'text' => TEXT_ALL_MANUFACTURERS]];
} else {
$output = tep_draw_hidden_field('manufacturers_id', $_GET['manufacturers_id']);
$options = [['id' => '', 'text' => TEXT_ALL_CATEGORIES]];
}

$output .= tep_draw_hidden_field('sort', $_GET['sort']);
while ($filterlist = tep_db_fetch_array($filterlist_query)) {
while ($filterlist = $filterlist_query->fetch_assoc()) {
$options[] = ['id' => $filterlist['id'], 'text' => $filterlist['name']];
}

Expand Down
2 changes: 1 addition & 1 deletion includes/modules/header_tags/ht_product_opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ht_product_opengraph extends abstract_module {
function execute() {
global $product;

if (isset($product) && $product->get('status')) {
if (isset($product) && is_callable([$product, 'get']) && $product->get('status')) {
$data = [
'og:type' => 'product',
'og:title' => $product->get('name'),
Expand Down
2 changes: 1 addition & 1 deletion includes/modules/payment/paypal_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function process_button() {
'currency_code' => $_SESSION['currency'],
'invoice' => $this->extract_order_id(),
'custom' => $_SESSION['customer_id'],
'notify_url' => tep_href_link('ext/modules/payment/paypal/standard_ipn.php', (isset($ipn_language) ? 'language=' . $ipn_language : ''), false, false),
'notify_url' => tep_href_link('ext/modules/payment/paypal/standard_ipn.php', (isset($ipn_language) ? 'language=' . $ipn_language : ''), 'SSL', false, false),
'rm' => '2',
'return' => tep_href_link('checkout_process.php'),
'cancel_return' => tep_href_link('checkout_payment.php'),
Expand Down
4 changes: 2 additions & 2 deletions includes/modules/payment/rbsworldpay_hosted.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function process_button() {
. tep_draw_hidden_field('M_sid', session_id())
. tep_draw_hidden_field('M_cid', $_SESSION['customer_id'])
. tep_draw_hidden_field('M_lang', $_SESSION['language'])
. tep_draw_hidden_field('M_hash', build_hash($order_id));
. tep_draw_hidden_field('M_hash', $this->build_hash($order_id));

if (MODULE_PAYMENT_RBSWORLDPAY_HOSTED_TRANSACTION_METHOD == 'Pre-Authorization') {
$process_button_string .= tep_draw_hidden_field('authMode', 'E');
Expand All @@ -157,7 +157,7 @@ public function before_process() {

$order_id = $this->extract_order_id();

if (!isset($_GET['hash']) || ($_GET['hash'] != build_hash($order_id))) {
if (!isset($_GET['hash']) || ($_GET['hash'] != $this->build_hash($order_id))) {
$this->sendDebugEmail();

tep_redirect(tep_href_link('shopping_cart.php'));
Expand Down
8 changes: 4 additions & 4 deletions includes/modules/shipping/zones.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
When you enter these country lists, enter them into the Zone X Countries
fields, where "X" is the number of the zone. They should be entered as
two character ISO country codes in all capital letters. They should be
separated by commas with no spaces or other punctuation. For example:
separated by semi-colons with no spaces or other punctuation. For example:
1: US
2: CA
3: AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR
4: JP,AU,NZ,SG
5: TW,CN,HK
3: AT;BE;GB;FR;DE;GL;IS;IE;IT;NO;NL;DK;PL;ES;SE;CH;FI;PT;IL;GR
4: JP;AU;NZ;SG
5: TW;CN;HK
Now you need to set up the shipping rate tables for each zone. Again,
some time and effort will go into setting the appropriate rates. You
Expand Down
8 changes: 7 additions & 1 deletion includes/system/versioned/1.0.7.10/cart_order_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function build_attributes($product) {
(int)$value,
(int)$_SESSION['languages_id']));

$attributes[] = tep_db_fetch_array($attributes_query);
$attributes[] = $attributes_query->fetch_assoc();
}

return $attributes;
Expand Down Expand Up @@ -169,6 +169,12 @@ public static function build(&$order) {
$order->info['total'] += $order->info['tax'];
}

$parameters = [
'builder' => $builder,
'order' => &$order,
];
$GLOBALS['OSCOM_Hooks']->call('siteWide', 'cartOrderBuild', $parameters);

return $order;
}

Expand Down
22 changes: 16 additions & 6 deletions includes/system/versioned/1.0.7.10/database_order_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(&$order) {
$this->order =& $order;

$order_query = tep_db_query("SELECT * FROM orders WHERE orders_id = " . (int)$this->order->get_id());
$this->data = tep_db_fetch_array($order_query);
$this->data = $order_query->fetch_assoc();
}

protected function extract_address($prefix) {
Expand All @@ -72,7 +72,7 @@ public function build_info() {
$order_status_query = tep_db_query(sprintf(
"SELECT orders_status_name FROM orders_status WHERE orders_status_id = %d AND language_id = %d",
(int)$this->data['orders_status'], (int)$_SESSION['languages_id']));
$order_status = tep_db_fetch_array($order_status_query);
$order_status = $order_status_query->fetch_assoc();

$this->order->info = [
'currency' => $this->data['currency'],
Expand All @@ -98,7 +98,7 @@ public function build_addresses() {

public function build_totals() {
$totals_query = tep_db_query("SELECT title, text, class FROM orders_total WHERE orders_id = " . (int)$this->order->get_id() . " ORDER BY sort_order");
while ($total = tep_db_fetch_array($totals_query)) {
while ($total = $totals_query->fetch_assoc()) {
$this->order->totals[] = [
'title' => $total['title'],
'text' => $total['text'],
Expand All @@ -117,7 +117,7 @@ public function build_totals() {

public function build_products() {
$order_products_query = tep_db_query("SELECT * FROM orders_products WHERE orders_id = " . (int)$this->order->get_id());
while ($order_product = tep_db_fetch_array($order_products_query)) {
while ($order_product = $order_products_query->fetch_assoc()) {
$current = [];
foreach (static::$column_keys as $order_key => $database_key) {
$current[$order_key] = $order_product[$database_key];
Expand All @@ -127,9 +127,9 @@ public function build_products() {
static::$attributes_sql,
(int)$this->order->get_id(),
(int)$order_product['orders_products_id']));
if (tep_db_num_rows($attributes_query)) {
if (mysqli_num_rows($attributes_query)) {
$current['attributes'] = [];
while ($attribute = tep_db_fetch_array($attributes_query)) {
while ($attribute = $attributes_query->fetch_assoc()) {
$current['attributes'][] = $attribute;
}
}
Expand All @@ -139,13 +139,23 @@ public function build_products() {
}
}

public function get($key) {
return $this->data[$key] ?? null;
}

public static function build(&$order) {
$builder = new database_order_builder($order);

$builder->build_info();
$builder->build_addresses();
$builder->build_totals();
$builder->build_products();

$parameters = [
'builder' => $builder,
'order' => &$order,
];
$GLOBALS['OSCOM_Hooks']->call('siteWide', 'databaseOrderBuild', $parameters);
}

}
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.7.14
1.0.7.15
36 changes: 17 additions & 19 deletions templates/default/includes/pages/checkout_payment_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
Released under the GNU General Public License
*/

$OSCOM_Hooks->register('progress');
$OSCOM_Hooks->register_pipeline('progress');

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('checkout_payment.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('checkout_payment_address.php', '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('checkout_payment.php'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('checkout_payment_address.php'));

require $oscTemplate->map_to_template('template_top.php', 'component');
?>

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

<?php
if ($messageStack->size($message_stack_area) > 0) {
Expand All @@ -28,21 +28,19 @@

<div class="row">
<div class="col-sm-7">
<h5 class="mb-1"><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></h5>
<div><?php echo tep_draw_form('select_address', tep_href_link('checkout_payment_address.php', '', 'SSL'), 'post', '', true); ?>
<h5 class="mb-1"><?= TABLE_HEADING_ADDRESS_BOOK_ENTRIES ?></h5>
<div><?= tep_draw_form('select_address', tep_href_link('checkout_payment_address.php'), 'post', '', true) ?>
<table class="table border-right border-left border-bottom table-hover m-0">
<?php
$addresses_query = $customer->get_all_addresses_query();
while ($address = tep_db_fetch_array($addresses_query)) {
while ($address = $addresses_query->fetch_assoc()) {
?>
<tr class="table-selection">
<td><label for="cpa_<?php echo $address['address_book_id']; ?>"><?php echo $customer_data->get_module('address')->format($address, true, ' ', ', '); ?></label></td>
<td><label for="cpa_<?= $address['address_book_id'] ?>"><?= $customer_data->get_module('address')->format($address, true, ' ', ', ') ?></label></td>
<td align="text-right">
<div class="custom-control custom-radio custom-control-inline">
<?php
echo tep_draw_radio_field('address', $address['address_book_id'], ($address['address_book_id'] == $_SESSION['billto']), 'id="cpa_' . $address['address_book_id'] . '" aria-describedby="cpa_' . $address['address_book_id'] . '" class="custom-control-input"');
?>
<label class="custom-control-label" for="cpa_<?php echo $address['address_book_id']; ?>">&nbsp;</label>
<?= tep_draw_selection_field('address', 'radio', $address['address_book_id'], ($address['address_book_id'] == $_SESSION['billto']), 'id="cpa_' . $address['address_book_id'] . '" aria-describedby="cpa_' . $address['address_book_id'] . '" class="custom-control-input"') ?>
<label class="custom-control-label" for="cpa_<?= $address['address_book_id'] ?>">&nbsp;</label>
</div>
</td>
</tr>
Expand All @@ -51,15 +49,15 @@
?>
</table>
<div class="buttonSet mt-1">
<?php echo tep_draw_hidden_field('action', 'submit') . tep_draw_button(BUTTON_SELECT_ADDRESS, 'fas fa-user-cog', null, 'primary', null, 'btn-success btn-lg btn-block'); ?>
<?= tep_draw_hidden_field('action', 'submit') . tep_draw_button(BUTTON_SELECT_ADDRESS, 'fas fa-user-cog', null, 'primary', null, 'btn-success btn-lg btn-block') ?>
</div>
</form></div>
</div>
<div class="col-sm-5">
<h5 class="mb-1"><?php echo TABLE_HEADING_PAYMENT_ADDRESS; ?></h5>
<h5 class="mb-1"><?= TABLE_HEADING_PAYMENT_ADDRESS ?></h5>
<div class="border">
<ul class="list-group list-group-flush">
<li class="list-group-item"><?php echo PAYMENT_FA_ICON . $customer->make_address_label($_SESSION['billto'], true, ' ', '<br>'); ?>
<li class="list-group-item"><?= PAYMENT_FA_ICON . $customer->make_address_label($_SESSION['billto'], true, ' ', '<br>') ?>
</li>
</ul>
</div>
Expand All @@ -72,12 +70,12 @@

<hr>

<h5 class="mb-1"><?php echo TABLE_HEADING_NEW_PAYMENT_ADDRESS; ?></h5>
<h5 class="mb-1"><?= TABLE_HEADING_NEW_PAYMENT_ADDRESS ?></h5>

<p class="font-weight-lighter"><?php echo TEXT_CREATE_NEW_PAYMENT_ADDRESS; ?></p>
<p class="font-weight-lighter"><?= TEXT_CREATE_NEW_PAYMENT_ADDRESS ?></p>

<?php
echo tep_draw_form('checkout_new_address', tep_href_link('checkout_payment_address.php', '', 'SSL'), 'post', '', true) . PHP_EOL;
echo tep_draw_form('checkout_new_address', tep_href_link('checkout_payment_address.php'), 'post', '', true) . PHP_EOL;
require $oscTemplate->map_to_template('checkout_new_address.php', 'component');
echo $OSCOM_Hooks->call('siteWide', 'injectFormDisplay');
echo tep_draw_hidden_field('action', 'submit');
Expand All @@ -87,7 +85,7 @@
?>

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

<?php
Expand Down

0 comments on commit d31f384

Please sign in to comment.