diff --git a/README.md b/README.md
index f98de3818..f9dda114f 100644
--- a/README.md
+++ b/README.md
@@ -1,78 +1,99 @@
-# CE Phoenix
+
';
$inputs = null;
for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
$value_name = tep_db_query("select products_options_values_name from products_options_values where products_options_values_id = '" . (int)$values_values['products_options_values_id'] . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
@@ -420,26 +443,35 @@
}
?>
-
-
-
- ' . $options_values['products_options_name'] . '';
- }
- ?>
-
-
-
-
+
+ '; ?>
+
+
+
+
';
} else {
?>
@@ -454,37 +486,43 @@
$next_id = $max_values_id_values['next_id'];
}
if ($action != 'update_option_value') {
- echo '
+
call('reviews', 'setflagAction');
+ $OSCOM_Hooks->call('reviews', 'setFlagAction');
tep_redirect(tep_href_link('reviews.php', 'page=' . (int)$_GET['page'] . '&rID=' . $_GET['rID']));
break;
@@ -44,7 +44,7 @@
tep_db_query("delete from reviews where reviews_id = '" . (int)$reviews_id . "'");
tep_db_query("delete from reviews_description where reviews_id = '" . (int)$reviews_id . "'");
- $OSCOM_Hooks->call('reviews', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('reviews', 'deleteConfirmAction');
tep_redirect(tep_href_link('reviews.php', 'page=' . (int)$_GET['page']));
break;
@@ -58,7 +58,7 @@
$insert_id = tep_db_insert_id();
tep_db_query("insert into reviews_description (reviews_id, languages_id, reviews_text) values ('" . (int)$insert_id . "', '" . (int)$languages_id . "', '" . $review . "')");
- $OSCOM_Hooks->call('reviews', 'addnewAction');
+ $OSCOM_Hooks->call('reviews', 'addNewAction');
tep_redirect(tep_href_link('reviews.php', tep_get_all_get_params(['action'])));
break;
diff --git a/admin/specials.php b/admin/specials.php
index df2ef0ba3..a91f22260 100644
--- a/admin/specials.php
+++ b/admin/specials.php
@@ -24,7 +24,7 @@
case 'setflag':
tep_db_query("UPDATE specials SET status = '" . $_GET['flag'] . "', expires_date = NULL, date_status_change = NULL WHERE specials_id = " . (int)$_GET['id']);
- $OSCOM_Hooks->call('specials', 'setflagAction');
+ $OSCOM_Hooks->call('specials', 'setFlagAction');
tep_redirect(tep_href_link('specials.php', (isset($_GET['page']) ? 'page=' . (int)$_GET['page'] . '&' : '') . 'sID=' . $_GET['id']));
break;
@@ -77,7 +77,7 @@
tep_db_query("delete from specials where specials_id = '" . (int)$specials_id . "'");
- $OSCOM_Hooks->call('specials', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('specials', 'deleteConfirmAction');
tep_redirect(tep_href_link('specials.php', 'page=' . (int)$_GET['page']));
break;
diff --git a/admin/tax_classes.php b/admin/tax_classes.php
index 9c908e906..77a184487 100644
--- a/admin/tax_classes.php
+++ b/admin/tax_classes.php
@@ -44,7 +44,7 @@
tep_db_query("delete from tax_class where tax_class_id = '" . (int)$tax_class_id . "'");
- $OSCOM_Hooks->call('tax_classes', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('tax_classes', 'deleteConfirmAction');
tep_redirect(tep_href_link('tax_classes.php', 'page=' . (int)$_GET['page']));
break;
diff --git a/admin/tax_rates.php b/admin/tax_rates.php
index 3ee8e1a97..781246224 100644
--- a/admin/tax_rates.php
+++ b/admin/tax_rates.php
@@ -50,7 +50,7 @@
tep_db_query("delete from tax_rates where tax_rates_id = '" . (int)$tax_rates_id . "'");
- $OSCOM_Hooks->call('tax_rates', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('tax_rates', 'deleteConfirmAction');
tep_redirect(tep_href_link('tax_rates.php', 'page=' . (int)$_GET['page']));
break;
diff --git a/admin/testimonials.php b/admin/testimonials.php
index 274d9fc8c..f1d79bc03 100644
--- a/admin/testimonials.php
+++ b/admin/testimonials.php
@@ -25,7 +25,7 @@
}
}
- $OSCOM_Hooks->call('testimonials', 'setflagAction');
+ $OSCOM_Hooks->call('testimonials', 'setFlagAction');
tep_redirect(tep_href_link('testimonials.php', 'page=' . (int)$_GET['page'] . '&tID=' . $_GET['tID']));
break;
@@ -49,7 +49,7 @@
tep_db_query("delete from testimonials where testimonials_id = '" . (int)$testimonials_id . "'");
tep_db_query("delete from testimonials_description where testimonials_id = '" . (int)$testimonials_id . "'");
- $OSCOM_Hooks->call('testimonials', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('testimonials', 'deleteConfirmAction');
tep_redirect(tep_href_link('testimonials.php', 'page=' . (int)$_GET['page']));
break;
@@ -63,7 +63,7 @@
$insert_id = tep_db_insert_id();
tep_db_query("insert into testimonials_description (testimonials_id, languages_id, testimonials_text) values ('" . (int)$insert_id . "', '" . (int)$languages_id . "', '" . tep_db_input($testimonial) . "')");
- $OSCOM_Hooks->call('testimonials', 'addnewAction');
+ $OSCOM_Hooks->call('testimonials', 'addNewAction');
tep_redirect(tep_href_link('testimonials.php', tep_get_all_get_params(array('action'))));
break;
diff --git a/admin/zones.php b/admin/zones.php
index bfb03a25a..2dcf67dea 100644
--- a/admin/zones.php
+++ b/admin/zones.php
@@ -46,7 +46,7 @@
tep_db_query("delete from zones where zone_id = '" . (int)$zone_id . "'");
- $OSCOM_Hooks->call('zones', 'deleteconfirmAction');
+ $OSCOM_Hooks->call('zones', 'deleteConfirmAction');
tep_redirect(tep_href_link('zones.php', 'page=' . (int)$_GET['page']));
break;
diff --git a/includes/actions/update_product.php b/includes/actions/update_product.php
index a17b211ae..712a2efcf 100644
--- a/includes/actions/update_product.php
+++ b/includes/actions/update_product.php
@@ -13,14 +13,14 @@
class osC_Actions_update_product {
public static function execute() {
- global $PHP_SELF, $messageStack, $goto, $parameters;
+ global $messageStack, $goto, $parameters;
foreach (($_POST['products_id'] ?? []) as $i => $product_id) {
if (in_array($product_id, ($_POST['cart_delete'] ?? []))) {
$_SESSION['cart']->remove($product_id);
$messageStack->add_session('product_action', sprintf(PRODUCT_REMOVED, tep_get_products_name($product_id)), 'warning');
} else {
- $attributes = $_POST['id'][$product_id] ?? '';
+ $attributes = $_POST['id'][$product_id] ?? null;
$_SESSION['cart']->add_cart($product_id, $_POST['cart_quantity'][$i], $attributes, false);
}
}
diff --git a/includes/modules/header_tags/ht_mailchimp_360/MCAPI.class.php b/includes/apps/mailchimp_360/MCAPI.class.php
similarity index 100%
rename from includes/modules/header_tags/ht_mailchimp_360/MCAPI.class.php
rename to includes/apps/mailchimp_360/MCAPI.class.php
diff --git a/includes/modules/header_tags/ht_mailchimp_360/mc360.php b/includes/apps/mailchimp_360/mc360.php
similarity index 100%
rename from includes/modules/header_tags/ht_mailchimp_360/mc360.php
rename to includes/apps/mailchimp_360/mc360.php
diff --git a/includes/apps/paypal/modules/DP/api/DoDirectPayment.php b/includes/apps/paypal/modules/DP/api/DoDirectPayment.php
index 5f409f9e4..1fe0be423 100644
--- a/includes/apps/paypal/modules/DP/api/DoDirectPayment.php
+++ b/includes/apps/paypal/modules/DP/api/DoDirectPayment.php
@@ -5,7 +5,7 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2014 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
*/
@@ -17,32 +17,34 @@ function OSCOM_PayPal_DP_Api_DoDirectPayment($OSCOM_PayPal, $server, $extra_para
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
- $params = array('USER' => $OSCOM_PayPal->getCredentials('DP', 'username'),
- 'PWD' => $OSCOM_PayPal->getCredentials('DP', 'password'),
- 'SIGNATURE' => $OSCOM_PayPal->getCredentials('DP', 'signature'),
- 'VERSION' => $OSCOM_PayPal->getApiVersion(),
- 'METHOD' => 'DoDirectPayment',
- 'PAYMENTACTION' => (OSCOM_APP_PAYPAL_DP_TRANSACTION_METHOD == '1') ? 'Sale' : 'Authorization',
- 'IPADDRESS' => $OSCOM_PayPal->getIpAddress(),
- 'BUTTONSOURCE' => $OSCOM_PayPal->getIdentifier());
-
- if ( is_array($extra_params) && !empty($extra_params) ) {
+ $params = [
+ 'USER' => $OSCOM_PayPal->getCredentials('DP', 'username'),
+ 'PWD' => $OSCOM_PayPal->getCredentials('DP', 'password'),
+ 'SIGNATURE' => $OSCOM_PayPal->getCredentials('DP', 'signature'),
+ 'VERSION' => $OSCOM_PayPal->getApiVersion(),
+ 'METHOD' => 'DoDirectPayment',
+ 'PAYMENTACTION' => (OSCOM_APP_PAYPAL_DP_TRANSACTION_METHOD == '1') ? 'Sale' : 'Authorization',
+ 'IPADDRESS' => tep_get_ip_address(),
+ 'BUTTONSOURCE' => $OSCOM_PayPal->getIdentifier(),
+ ];
+
+ if ( !empty($extra_params) && is_array($extra_params) ) {
$params = array_merge($params, $extra_params);
}
$post_string = '';
-
foreach ( $params as $key => $value ) {
$post_string .= $key . '=' . urlencode(utf8_encode(trim($value))) . '&';
}
- $post_string = substr($post_string, 0, -1);
+ $post_string = substr($post_string, 0, -strlen('&'));
$response = $OSCOM_PayPal->makeApiCall($api_url, $post_string);
parse_str($response, $response_array);
- return array('res' => $response_array,
- 'success' => in_array($response_array['ACK'], array('Success', 'SuccessWithWarning')),
- 'req' => $params);
+ return [
+ 'res' => $response_array,
+ 'success' => in_array($response_array['ACK'], ['Success', 'SuccessWithWarning']),
+ 'req' => $params,
+ ];
}
-?>
diff --git a/includes/apps/paypal/modules/DP/api/PayflowPayment.php b/includes/apps/paypal/modules/DP/api/PayflowPayment.php
index fb1a0445f..ab7ae727b 100644
--- a/includes/apps/paypal/modules/DP/api/PayflowPayment.php
+++ b/includes/apps/paypal/modules/DP/api/PayflowPayment.php
@@ -5,7 +5,7 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2014 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
*/
@@ -17,21 +17,22 @@ function OSCOM_PayPal_DP_Api_PayflowPayment($OSCOM_PayPal, $server, $extra_param
$api_url = 'https://pilot-payflowpro.paypal.com';
}
- $params = array('USER' => $OSCOM_PayPal->hasCredentials('DP', 'payflow_user') ? $OSCOM_PayPal->getCredentials('DP', 'payflow_user') : $OSCOM_PayPal->getCredentials('DP', 'payflow_vendor'),
- 'VENDOR' => $OSCOM_PayPal->getCredentials('DP', 'payflow_vendor'),
- 'PARTNER' => $OSCOM_PayPal->getCredentials('DP', 'payflow_partner'),
- 'PWD' => $OSCOM_PayPal->getCredentials('DP', 'payflow_password'),
- 'TENDER' => 'C',
- 'TRXTYPE' => (OSCOM_APP_PAYPAL_DP_TRANSACTION_METHOD == '1') ? 'S' : 'A',
- 'CUSTIP' => $OSCOM_PayPal->getIpAddress(),
- 'BUTTONSOURCE' => $OSCOM_PayPal->getIdentifier());
-
- if ( is_array($extra_params) && !empty($extra_params) ) {
+ $params = [
+ 'USER' => $OSCOM_PayPal->getCredentials('DP', ($OSCOM_PayPal->hasCredentials('DP', 'payflow_user') ? 'payflow_user' : 'payflow_vendor')),
+ 'VENDOR' => $OSCOM_PayPal->getCredentials('DP', 'payflow_vendor'),
+ 'PARTNER' => $OSCOM_PayPal->getCredentials('DP', 'payflow_partner'),
+ 'PWD' => $OSCOM_PayPal->getCredentials('DP', 'payflow_password'),
+ 'TENDER' => 'C',
+ 'TRXTYPE' => (OSCOM_APP_PAYPAL_DP_TRANSACTION_METHOD == '1') ? 'S' : 'A',
+ 'CUSTIP' => tep_get_ip_address(),
+ 'BUTTONSOURCE' => $OSCOM_PayPal->getIdentifier(),
+ ];
+
+ if ( !empty($extra_params) && is_array($extra_params) ) {
$params = array_merge($params, $extra_params);
}
- $headers = array();
-
+ $headers = [];
if ( isset($params['_headers']) ) {
$headers = $params['_headers'];
@@ -44,13 +45,14 @@ function OSCOM_PayPal_DP_Api_PayflowPayment($OSCOM_PayPal, $server, $extra_param
$post_string .= $key . '[' . strlen(trim($value)) . ']=' . trim($value) . '&';
}
- $post_string = substr($post_string, 0, -1);
+ $post_string = substr($post_string, 0, -strlen('&'));
$response = $OSCOM_PayPal->makeApiCall($api_url, $post_string, $headers);
parse_str($response, $response_array);
- return array('res' => $response_array,
- 'success' => ($response_array['RESULT'] == '0'),
- 'req' => $params);
+ return [
+ 'res' => $response_array,
+ 'success' => ($response_array['RESULT'] == '0'),
+ 'req' => $params,
+ ];
}
-?>
diff --git a/includes/classes/actions.php b/includes/classes/actions.php
index 97d7d4654..d961313ab 100644
--- a/includes/classes/actions.php
+++ b/includes/classes/actions.php
@@ -5,20 +5,19 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2018 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
*/
class osC_Actions {
- public static function parse($module) {
- $module = basename($module);
- if ( !empty($module) && file_exists('includes/actions/' . $module . '.php') ) {
- include('includes/actions/' . $module . '.php');
+ public static function parse($action) {
+ $action = basename($action);
- call_user_func(array('osC_Actions_' . $module, 'execute'));
+ if ( $action && class_exists($class = 'osC_Actions_' . $action) ) {
+ call_user_func([$class, 'execute']);
}
}
+
}
-
\ No newline at end of file
diff --git a/includes/classes/alertbox.php b/includes/classes/alert_block.php
similarity index 100%
rename from includes/classes/alertbox.php
rename to includes/classes/alert_block.php
diff --git a/includes/classes/passwordhash.php b/includes/classes/password_hash.php
similarity index 100%
rename from includes/classes/passwordhash.php
rename to includes/classes/password_hash.php
diff --git a/includes/functions/autoloader.php b/includes/functions/autoloader.php
index 5a29137d5..50bf0964f 100644
--- a/includes/functions/autoloader.php
+++ b/includes/functions/autoloader.php
@@ -70,6 +70,14 @@ function tep_find_all_templates_under($directory, &$files) {
}
}
+ function tep_find_all_actions_under($directory, &$files) {
+ foreach (scandir($directory, SCANDIR_SORT_ASCENDING) as $file) {
+ if (is_file($path = "$directory/$file")) {
+ $files[tep_normalize_class_name('osC_Actions_' . pathinfo($file, PATHINFO_FILENAME))] = $path;
+ }
+ }
+ }
+
function tep_build_catalog_autoload_index() {
$class_files = [];
@@ -78,6 +86,7 @@ function tep_build_catalog_autoload_index() {
tep_find_all_files_under(DIR_FS_CATALOG . 'includes/modules', $class_files);
tep_find_all_files_under(DIR_FS_CATALOG . 'includes/classes', $class_files);
+ tep_find_all_actions_under(DIR_FS_CATALOG . 'includes/actions', $class_files);
tep_find_all_files_under(DIR_FS_CATALOG . 'includes/system/versioned', $class_files);
$overrides_directory = DIR_FS_CATALOG . 'includes/system/override';
@@ -87,10 +96,7 @@ function tep_build_catalog_autoload_index() {
// some classes do not follow either naming standard relating the class name and file name
$exception_mappings = [
- 'alert_block' => 'alertbox',
'os_c__actions' => 'actions',
- 'm_c_a_p_i' => 'MCAPI.class',
- 'password_hash' => 'passwordhash',
];
foreach ($exception_mappings as $class_name => $path) {
@@ -114,9 +120,8 @@ function tep_autoload_catalog($original_class) {
$class = tep_normalize_class_name($original_class);
if (isset($class_files[$class])) {
- global $language;
- if (isset($language) && DIR_FS_CATALOG . 'includes/modules' === substr($class_files[$class], 0, $modules_directory_length)) {
- $language_file = DIR_FS_CATALOG . "includes/languages/$language/modules" . substr($class_files[$class], $modules_directory_length);
+ if (isset($_SESSION['language']) && DIR_FS_CATALOG . 'includes/modules' === substr($class_files[$class], 0, $modules_directory_length)) {
+ $language_file = DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/modules' . substr($class_files[$class], $modules_directory_length);
if (file_exists($language_file)) {
include $language_file;
}
diff --git a/includes/functions/general.php b/includes/functions/general.php
index 9d01f4e2d..27e1af429 100644
--- a/includes/functions/general.php
+++ b/includes/functions/general.php
@@ -989,3 +989,12 @@ function tep_require_login($parameters = null) {
tep_redirect(tep_href_link('login.php', '', 'SSL'));
}
}
+
+ function tep_ltrim_once($s, $prefix) {
+ $length = strlen($prefix);
+ if (substr($s, 0, $length) === $prefix) {
+ return substr($s, $length);
+ }
+
+ return $s;
+ }
diff --git a/includes/functions/html_output.php b/includes/functions/html_output.php
index e03e4d761..1c218999d 100644
--- a/includes/functions/html_output.php
+++ b/includes/functions/html_output.php
@@ -331,7 +331,7 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$button .= ' class="btn ';
- $button .= $style ?? 'btn-outline-secondary';
+ $button .= $style ?? 'btn-light mt-2';
$button .= '">';
diff --git a/includes/functions/password_funcs.php b/includes/functions/password_funcs.php
index 8497bf3fe..24fcb3f8c 100644
--- a/includes/functions/password_funcs.php
+++ b/includes/functions/password_funcs.php
@@ -19,10 +19,6 @@ function tep_validate_password($plain, $encrypted) {
return tep_validate_old_password($plain, $encrypted);
}
- if (!class_exists('PasswordHash')) {
- include('includes/classes/passwordhash.php');
- }
-
$hasher = new PasswordHash(10, true);
return $hasher->CheckPassword($plain, $encrypted);
@@ -39,7 +35,9 @@ function tep_validate_old_password($plain, $encrypted) {
// split apart the hash / salt
$stack = explode(':', $encrypted);
- if (sizeof($stack) != 2) return false;
+ if (count($stack) != 2) {
+ return false;
+ }
if (md5($stack[1] . $plain) == $stack[0]) {
return true;
@@ -53,10 +51,6 @@ function tep_validate_old_password($plain, $encrypted) {
// This function encrypts a phpass password from a plaintext
// password.
function tep_encrypt_password($plain) {
- if (!class_exists('PasswordHash')) {
- include('includes/classes/passwordhash.php');
- }
-
$hasher = new PasswordHash(10, true);
return $hasher->HashPassword($plain);
@@ -89,4 +83,3 @@ function tep_password_type($encrypted) {
return 'phpass';
}
-?>
\ No newline at end of file
diff --git a/includes/hooks/admin/products_attributes/add_attribute.php b/includes/hooks/admin/products_attributes/add_attribute.php
new file mode 100644
index 000000000..6a3037a21
--- /dev/null
+++ b/includes/hooks/admin/products_attributes/add_attribute.php
@@ -0,0 +1,27 @@
+$('select[name="products_id"], select[name="options_id"], select[name="values_id"], input[name="price_prefix"], input[name="value_price"]').prop('required', true); $('select[name="options_id"], select[name="values_id"], input[name="price_prefix"], input[name="value_price"]').prop('disabled', true); $('select[name="products_id"]').change(function() { $('select[name="options_id"]').prop('disabled', false); }); $('select[name="options_id"]').change(function(){ $('select[name="values_id"]').prop('disabled', false); $('select[name="values_id"] option').show(); var id = $(this).val(); $('select[name="values_id"] option[data-id]:not([data-id*="' + id + '"])').hide(); }); $('select[name="values_id"]').change(function() { $('input[name="value_price"], input[name="price_prefix"]').prop('disabled', false); });
+addat;
+
+ return $helper;
+ }
+ }
+
+}
diff --git a/includes/hooks/admin/siteWide/styleSheetDropdown.php b/includes/hooks/admin/siteWide/styleSheetDropdown.php
new file mode 100644
index 000000000..c32f4dd33
--- /dev/null
+++ b/includes/hooks/admin/siteWide/styleSheetDropdown.php
@@ -0,0 +1,21 @@
+@media (min-width: 768px) { #navbarAdmin > ul.navbar-nav > li.dropdown:hover > div.dropdown-menu { display: block; } }' . PHP_EOL;
+
+ return $admin_css;
+ }
+
+}
diff --git a/includes/hooks/admin/siteWide/styleSheets.php b/includes/hooks/admin/siteWide/styleSheets.php
index 900482867..3a3c7e517 100644
--- a/includes/hooks/admin/siteWide/styleSheets.php
+++ b/includes/hooks/admin/siteWide/styleSheets.php
@@ -14,7 +14,7 @@ class hook_admin_siteWide_styleSheets {
function listen_injectSiteStart() {
$admin_css = '' . PHP_EOL;
- $admin_css .= '' . PHP_EOL;
+ $admin_css .= '' . PHP_EOL;
$admin_css .= ' ' . PHP_EOL;
return $admin_css;
diff --git a/includes/modules/content/footer/cm_footer_account.php b/includes/modules/content/footer/cm_footer_account.php
index c0b0c50c1..9eabd2e76 100644
--- a/includes/modules/content/footer/cm_footer_account.php
+++ b/includes/modules/content/footer/cm_footer_account.php
@@ -30,7 +30,7 @@ protected function get_parameters() {
'MODULE_CONTENT_FOOTER_ACCOUNT_STATUS' => [
'title' => 'Enable Account Footer Module',
'value' => 'True',
- 'desc' => 'Do you want to enable the Account content module?',
+ 'desc' => 'Do you want to enable this module?',
'set_func' => "tep_cfg_select_option(['True', 'False'], ",
],
'MODULE_CONTENT_FOOTER_ACCOUNT_CONTENT_WIDTH' => [
@@ -41,7 +41,7 @@ protected function get_parameters() {
],
'MODULE_CONTENT_FOOTER_ACCOUNT_SORT_ORDER' => [
'title' => 'Sort Order',
- 'value' => '0',
+ 'value' => '20',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
diff --git a/includes/modules/content/footer/cm_footer_contact_us.php b/includes/modules/content/footer/cm_footer_contact_us.php
index 5863f0f7f..0356d1b94 100644
--- a/includes/modules/content/footer/cm_footer_contact_us.php
+++ b/includes/modules/content/footer/cm_footer_contact_us.php
@@ -30,7 +30,7 @@ protected function get_parameters() {
'MODULE_CONTENT_FOOTER_CONTACT_US_STATUS' => [
'title' => 'Enable Contact Us Footer Module',
'value' => 'True',
- 'desc' => 'Do you want to enable the Contact Us content module?',
+ 'desc' => 'Do you want to enable this module?',
'set_func' => "tep_cfg_select_option(['True', 'False'], ",
],
'MODULE_CONTENT_FOOTER_CONTACT_US_CONTENT_WIDTH' => [
@@ -41,7 +41,7 @@ protected function get_parameters() {
],
'MODULE_CONTENT_FOOTER_CONTACT_US_SORT_ORDER' => [
'title' => 'Sort Order',
- 'value' => '0',
+ 'value' => '30',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
diff --git a/includes/modules/content/footer/cm_footer_information_links.php b/includes/modules/content/footer/cm_footer_information_links.php
index feade61e3..4ddb1c0bb 100644
--- a/includes/modules/content/footer/cm_footer_information_links.php
+++ b/includes/modules/content/footer/cm_footer_information_links.php
@@ -30,7 +30,7 @@ protected function get_parameters() {
'MODULE_CONTENT_FOOTER_INFORMATION_STATUS' => [
'title' => 'Enable Information Links Footer Module',
'value' => 'True',
- 'desc' => 'Do you want to enable the Information Links content module?',
+ 'desc' => 'Do you want to enable the Information Links Footer module?',
'set_func' => "tep_cfg_select_option(['True', 'False'], ",
],
'MODULE_CONTENT_FOOTER_INFORMATION_CONTENT_WIDTH' => [
@@ -41,7 +41,7 @@ protected function get_parameters() {
],
'MODULE_CONTENT_FOOTER_INFORMATION_SORT_ORDER' => [
'title' => 'Sort Order',
- 'value' => '0',
+ 'value' => '10',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
diff --git a/includes/modules/content/footer/cm_footer_text.php b/includes/modules/content/footer/cm_footer_text.php
index a98a656ae..516c31cf2 100644
--- a/includes/modules/content/footer/cm_footer_text.php
+++ b/includes/modules/content/footer/cm_footer_text.php
@@ -41,7 +41,7 @@ protected function get_parameters() {
],
'MODULE_CONTENT_FOOTER_TEXT_SORT_ORDER' => [
'title' => 'Sort Order',
- 'value' => '0',
+ 'value' => '40',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
diff --git a/includes/modules/header_tags/ht_mailchimp_360.php b/includes/modules/header_tags/ht_mailchimp_360.php
index 2dba7bf40..b5d51fe96 100644
--- a/includes/modules/header_tags/ht_mailchimp_360.php
+++ b/includes/modules/header_tags/ht_mailchimp_360.php
@@ -31,8 +31,8 @@ function __construct() {
function execute() {
global $PHP_SELF;
- include('includes/modules/header_tags/ht_mailchimp_360/MCAPI.class.php');
- include('includes/modules/header_tags/ht_mailchimp_360/mc360.php');
+ include('includes/apps/mailchimp_360/MCAPI.class.php');
+ include('includes/apps/mailchimp_360/mc360.php');
$mc360 = new mc360();
$mc360->set_cookies();
diff --git a/includes/modules/header_tags/ht_product_meta.php b/includes/modules/header_tags/ht_product_meta.php
index 4e735902c..6d8384c4c 100644
--- a/includes/modules/header_tags/ht_product_meta.php
+++ b/includes/modules/header_tags/ht_product_meta.php
@@ -17,19 +17,15 @@ class ht_product_meta extends abstract_module {
protected $group = 'header_tags';
function execute() {
- global $PHP_SELF, $oscTemplate, $product_check;
-
- if (isset($_GET['products_id'])) {
- if ($product_check['total'] > 0) {
- $meta_info_query = tep_db_query("select pd.products_seo_description, pd.products_seo_keywords from products p, products_description pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
- $meta_info = tep_db_fetch_array($meta_info_query);
-
- if (tep_not_null($meta_info['products_seo_description'])) {
- $oscTemplate->addBlock(' ' . PHP_EOL, $this->group);
- }
- if ((tep_not_null($meta_info['products_seo_keywords'])) && (MODULE_HEADER_TAGS_PRODUCT_META_KEYWORDS_STATUS != 'Search') ) {
- $oscTemplate->addBlock(' ' . PHP_EOL, $this->group);
- }
+ global $oscTemplate, $product_info;
+
+ if (isset($_GET['products_id'], $product_info)) {
+ if (tep_not_null($product_info['products_seo_description'])) {
+ $oscTemplate->addBlock(' ' . PHP_EOL, $this->group);
+ }
+
+ if ((tep_not_null($product_info['products_seo_keywords'])) && (MODULE_HEADER_TAGS_PRODUCT_META_KEYWORDS_STATUS !== 'Search') ) {
+ $oscTemplate->addBlock(' ' . PHP_EOL, $this->group);
}
}
}
diff --git a/includes/modules/header_tags/ht_product_opengraph.php b/includes/modules/header_tags/ht_product_opengraph.php
index 04546260e..0e0caa070 100644
--- a/includes/modules/header_tags/ht_product_opengraph.php
+++ b/includes/modules/header_tags/ht_product_opengraph.php
@@ -17,50 +17,41 @@ class ht_product_opengraph extends abstract_module {
public $group = 'header_tags';
function execute() {
- global $PHP_SELF, $oscTemplate, $product_check, $currencies;
-
- if ($product_check['total'] > 0) {
- $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_quantity, p.products_tax_class_id, p.products_date_available from products p, products_description pd where p.products_id = " . (int)$_GET['products_id'] . " and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = " . (int)$_SESSION['languages_id']);
-
- if ( tep_db_num_rows($product_info_query) === 1 ) {
- $product_info = tep_db_fetch_array($product_info_query);
-
- $data = [
- 'og:type' => 'product',
- 'og:title' => $product_info['products_name'],
- 'og:site_name' => STORE_NAME,
- ];
-
- $product_description = substr(trim(preg_replace('/\s\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...';
- $data['og:description'] = $product_description;
-
- $products_image = $product_info['products_image'];
- $pi_query = tep_db_query("select image from products_images where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order limit 1");
- if ( tep_db_num_rows($pi_query) === 1 ) {
- $pi = tep_db_fetch_array($pi_query);
- $products_image = $pi['image'];
- }
- $data['og:image'] = tep_href_link("images/$products_image", '', 'NONSSL', false, false);
-
- if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
- $products_price = $currencies->display_raw($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
- } else {
- $products_price = $currencies->display_raw($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
- }
- $data['product:price:amount'] = $products_price;
- $data['product:price:currency'] = $_SESSION['currency'];
-
- $data['og:url'] = tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false);
+ global $product_info, $currencies;
+
+ if (isset($product_info['products_name'])) {
+ $data = [
+ 'og:type' => 'product',
+ 'og:title' => $product_info['products_name'],
+ 'og:site_name' => STORE_NAME,
+ ];
+
+ $product_description = substr(trim(preg_replace('/\s\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...';
+ $data['og:description'] = $product_description;
+
+ $pi_query = tep_db_query("SELECT image FROM products_images WHERE products_id = " . (int)$product_info['products_id'] . " ORDER BY sort_order LIMIT 1");
+ $pi = tep_db_fetch_array($pi_query);
+ $products_image = $pi['image'] ?? $product_info['products_image'];
+ $data['og:image'] = tep_href_link("images/$products_image", '', 'NONSSL', false, false);
+
+ if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
+ $products_price = $currencies->display_raw($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
+ } else {
+ $products_price = $currencies->display_raw($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
+ }
+ $data['product:price:amount'] = $products_price;
+ $data['product:price:currency'] = $_SESSION['currency'];
- $data['product:availability'] = ( $product_info['products_quantity'] > 0 ) ? MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_OUT_OF_STOCK;
+ $data['og:url'] = tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false);
- $result = '';
- foreach ( $data as $key => $value ) {
- $result .= ' ' . PHP_EOL;
- }
+ $data['product:availability'] = ( $product_info['products_quantity'] > 0 ) ? MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_OUT_OF_STOCK;
- $oscTemplate->addBlock($result, $this->group);
+ $result = '';
+ foreach ( $data as $property => $content ) {
+ $result .= ' ' . PHP_EOL;
}
+
+ $GLOBALS['oscTemplate']->addBlock($result, $this->group);
}
}
diff --git a/includes/modules/header_tags/ht_product_schema.php b/includes/modules/header_tags/ht_product_schema.php
index fbace6257..f868d0600 100644
--- a/includes/modules/header_tags/ht_product_schema.php
+++ b/includes/modules/header_tags/ht_product_schema.php
@@ -17,131 +17,119 @@ class ht_product_schema extends abstract_executable_module {
public function __construct() {
parent::__construct(__FILE__);
- if (static::get_constant('MODULE_HEADER_TAGS_PRODUCT_SCHEMA_PLACEMENT') != 'Header') {
+ if (static::get_constant('MODULE_HEADER_TAGS_PRODUCT_SCHEMA_PLACEMENT') !== 'Header') {
$this->group = 'footer_scripts';
}
}
function execute() {
- global $PHP_SELF, $oscTemplate, $product_check, $currencies;
+ global $product_info, $currencies;
- if ($product_check['total'] > 0) {
- $product_info_query = tep_db_query(<<<'EOSQL'
-SELECT p.*, pd.*
- FROM products p INNER JOIN products_description pd ON p.products_id = pd.products_id
- WHERE p.products_status = 1 AND p.products_id =
-EOSQL
- . (int)$_GET['products_id'] . " AND pd.language_id = " . (int)$_SESSION['languages_id']);
-
- if ( tep_db_num_rows($product_info_query) ) {
- $product_info = tep_db_fetch_array($product_info_query);
+ if (isset($product_info['products_name'])) {
+ $products_image = $product_info['products_image'];
+ $pi_query = tep_db_query("SELECT image FROM products_images WHERE products_id = " . (int)$product_info['products_id'] . " ORDER BY sort_order LIMIT 1");
+ if ( $pi = tep_db_fetch_array($pi_query) ) {
+ $products_image = $pi['image'];
+ }
- $products_image = $product_info['products_image'];
- $pi_query = tep_db_query("SELECT image FROM products_images WHERE products_id = " . (int)$product_info['products_id'] . " ORDER BY sort_order LIMIT 1");
- if ( tep_db_num_rows($pi_query) ) {
- $pi = tep_db_fetch_array($pi_query);
- $products_image = $pi['image'];
- }
+ $schema_product = [
+ '@context' => 'https://schema.org',
+ '@type' => 'Product',
+ 'name' => tep_db_output($product_info['products_name']),
+ 'image' => tep_href_link('images/' . $products_image, '', 'NONSSL', false, false),
+ 'url' => tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false, false),
+ 'description' => substr(trim(preg_replace('/\s\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...',
+ ];
+
+ if (tep_not_null($product_info['products_model'])) {
+ $schema_product['mpn'] = tep_db_output($product_info['products_model']);
+ }
- $schema_product = [
- "@context" => "https://schema.org",
- "@type" => "Product",
- "name" => tep_db_output($product_info['products_name']),
- "image" => tep_href_link('images/' . $products_image, '', 'NONSSL', false, false),
- "url" => tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false, false),
- "description" => substr(trim(preg_replace('/\s\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...',
- ];
+ if (tep_not_null($product_info['products_gtin']) && defined('MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH')) {
+ $schema_product['gtin' . MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH] = tep_db_output(substr($product_info['products_gtin'], 0-MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH));
+ }
- if (tep_not_null($product_info['products_model'])) {
- $schema_product['mpn'] = tep_db_output($product_info['products_model']);
- }
+ $schema_product['offers'] = [
+ '@type' => 'Offer',
+ 'priceCurrency' => $_SESSION['currency'],
+ ];
- if (tep_not_null($product_info['products_gtin']) && defined('MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH')) {
- $schema_product['gtin' . MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH] = tep_db_output(substr($product_info['products_gtin'], 0-MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH));
- }
+ if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
+ $products_price = $currencies->display_raw($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
+ } else {
+ $products_price = $currencies->display_raw($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
+ }
- $schema_product['offers'] = [
- "@type" => "Offer",
- "priceCurrency" => $_SESSION['currency'],
- ];
+ $schema_product['offers']['price'] = $products_price;
- if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
- $products_price = $currencies->display_raw($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
- } else {
- $products_price = $currencies->display_raw($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
- }
+ $specials_expiry_query = tep_db_query("SELECT expires_date FROM specials WHERE status = 1 AND products_id = " . (int)$product_info['products_id']);
+ if ($specials_expiry = tep_db_fetch_array($specials_expiry_query)) {
+ $schema_product['offers']['priceValidUntil'] = $specials_expiry['expires_date'];
+ }
- $schema_product['offers']['price'] = $products_price;
+ $availability = ( $product_info['products_quantity'] > 0 ) ? MODULE_HEADER_TAGS_PRODUCT_SCHEMA_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_SCHEMA_TEXT_OUT_OF_STOCK;
+ $schema_product['offers']['availability'] = $availability;
- $specials_expiry_query = tep_db_query("SELECT expires_date FROM specials WHERE status = 1 AND products_id = " . (int)$product_info['products_id']);
- if ($specials_expiry = tep_db_fetch_array($specials_expiry_query)) {
- $schema_product['offers']['priceValidUntil'] = $specials_expiry['expires_date'];
- }
+ $schema_product['offers']['seller'] = [
+ '@type' => 'Organization',
+ 'name' => STORE_NAME,
+ ];
- $availability = ( $product_info['products_quantity'] > 0 ) ? MODULE_HEADER_TAGS_PRODUCT_SCHEMA_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_SCHEMA_TEXT_OUT_OF_STOCK;
- $schema_product['offers']['availability'] = $availability;
+ if ($product_info['manufacturers_id'] > 0) {
+ // manufacturer class
+ $ht_brand = new manufacturer((int)$product_info['manufacturers_id']);
- $schema_product['offers']['seller'] = [
- "@type" => "Organization",
- "name" => STORE_NAME,
+ $schema_product['manufacturer'] = [
+ '@type' => 'Organization',
+ 'name' => tep_db_output($ht_brand->getData('manufacturers_name')),
];
+ }
- if ($product_info['manufacturers_id'] > 0) {
- // manufacturer class
- $ht_brand = new manufacturer((int)$product_info['manufacturers_id']);
-
- $schema_product['manufacturer'] = [
- "@type" => "Organization",
- "name" => tep_db_output($ht_brand->getData('manufacturers_name')),
- ];
- }
-
- $average_query = tep_db_query(<<<'EOSQL'
+ $average_query = tep_db_query(<<<'EOSQL'
SELECT AVG(r.reviews_rating) AS average, COUNT(r.reviews_rating) AS count
FROM reviews r
where r.reviews_status = 1 AND r.products_id =
EOSQL
- . (int)$product_info['products_id']);
- $average = tep_db_fetch_array($average_query);
- if ($average['count'] > 0) {
- $star_rating = round($average['average'], 0, PHP_ROUND_HALF_UP);
- $schema_product['aggregateRating'] = [
- "@type" => "AggregateRating",
- "ratingValue" => number_format($star_rating, 2),
- "reviewCount" => (int)$average['count'],
- ];
-
- $reviews_query = tep_db_query(<<<'EOSQL'
+ . (int)$product_info['products_id']);
+ $average = tep_db_fetch_array($average_query);
+ if ($average['count'] > 0) {
+ $star_rating = round($average['average'], 0, PHP_ROUND_HALF_UP);
+ $schema_product['aggregateRating'] = [
+ '@type' => 'AggregateRating',
+ 'ratingValue' => number_format($star_rating, 2),
+ 'reviewCount' => (int)$average['count'],
+ ];
+
+ $reviews_query = tep_db_query(<<<'EOSQL'
SELECT rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read
FROM reviews r INNER JOIN reviews_description rd ON r.reviews_id = rd.reviews_id
WHERE r.reviews_status = 1 AND r.products_id =
EOSQL
- . (int)$_GET['products_id'] . " AND rd.languages_id = " . (int)$_SESSION['languages_id'] . " ORDER BY r.reviews_rating DESC");
-
- if (tep_db_num_rows($reviews_query) > 0) {
- $schema_product['review'] = [];
- while($reviews = tep_db_fetch_array($reviews_query)) {
- $schema_product['review'][] = [
- "@type" => "Review",
- "author" => tep_db_output($reviews['customers_name']),
- "datePublished" => tep_db_output($reviews['date_added']),
- "description" => tep_db_output($reviews['reviews_text']),
- "name" => tep_db_output($product_info['products_name']),
- "reviewRating" => [
- "@type" => "Rating",
- "bestRating" => "5",
- "ratingValue" => (int)$reviews['reviews_rating'],
- "worstRating" => "1",
- ],
- ];
- }
+ . (int)$_GET['products_id'] . " AND rd.languages_id = " . (int)$_SESSION['languages_id'] . " ORDER BY r.reviews_rating DESC");
+
+ if (tep_db_num_rows($reviews_query) > 0) {
+ $schema_product['review'] = [];
+ while ($reviews = tep_db_fetch_array($reviews_query)) {
+ $schema_product['review'][] = [
+ '@type' => 'Review',
+ 'author' => tep_db_output($reviews['customers_name']),
+ 'datePublished' => tep_db_output($reviews['date_added']),
+ 'description' => tep_db_output($reviews['reviews_text']),
+ 'name' => tep_db_output($product_info['products_name']),
+ 'reviewRating' => [
+ '@type' => 'Rating',
+ 'bestRating' => '5',
+ 'ratingValue' => (int)$reviews['reviews_rating'],
+ 'worstRating' => '1',
+ ],
+ ];
}
}
+ }
- $data = json_encode($schema_product);
+ $data = json_encode($schema_product);
- $oscTemplate->addBlock('', $this->group);
- }
+ $GLOBALS['oscTemplate']->addBlock('', $this->group);
}
}
diff --git a/includes/modules/header_tags/ht_product_title.php b/includes/modules/header_tags/ht_product_title.php
index 5b79087a0..ee0ba00ee 100644
--- a/includes/modules/header_tags/ht_product_title.php
+++ b/includes/modules/header_tags/ht_product_title.php
@@ -17,23 +17,13 @@ class ht_product_title extends abstract_module {
protected $group = 'header_tags';
function execute() {
- global $PHP_SELF, $oscTemplate, $product_check;
+ global $oscTemplate, $product_info;
- if (basename($PHP_SELF) == 'product_info.php') {
- if (isset($_GET['products_id']) && ($product_check['total'] > 0)) {
- $product_info_query = tep_db_query(sprintf(<<<'EOSQL'
-SELECT pd.products_name, pd.products_seo_title
- FROM products p INNER JOIN products_description pd ON pd.products_id = p.products_id
- WHERE p.products_status = 1 AND p.products_id = %d AND pd.language_id = %d
-EOSQL
- , (int)$_GET['products_id'], (int)$_SESSION['languages_id']));
- $product_info = tep_db_fetch_array($product_info_query);
-
- if ( tep_not_null($product_info['products_seo_title']) && (MODULE_HEADER_TAGS_PRODUCT_TITLE_SEO_TITLE_OVERRIDE == 'True') ) {
- $oscTemplate->setTitle($product_info['products_seo_title'] . MODULE_HEADER_TAGS_PRODUCT_SEO_SEPARATOR . $oscTemplate->getTitle());
- } else {
- $oscTemplate->setTitle($product_info['products_name'] . MODULE_HEADER_TAGS_PRODUCT_SEO_SEPARATOR . $oscTemplate->getTitle());
- }
+ if (isset($_GET['products_id'], $product_info['products_name']) && (basename($GLOBALS['PHP_SELF']) == 'product_info.php')) {
+ if ( tep_not_null($product_info['products_seo_title']) && (MODULE_HEADER_TAGS_PRODUCT_TITLE_SEO_TITLE_OVERRIDE === 'True') ) {
+ $oscTemplate->setTitle($product_info['products_seo_title'] . MODULE_HEADER_TAGS_PRODUCT_SEO_SEPARATOR . $oscTemplate->getTitle());
+ } else {
+ $oscTemplate->setTitle($product_info['products_name'] . MODULE_HEADER_TAGS_PRODUCT_SEO_SEPARATOR . $oscTemplate->getTitle());
}
}
}
diff --git a/includes/modules/payment/paypal_standard.php b/includes/modules/payment/paypal_standard.php
index bec619184..df2c73311 100644
--- a/includes/modules/payment/paypal_standard.php
+++ b/includes/modules/payment/paypal_standard.php
@@ -529,8 +529,9 @@ function pre_before_check() {
function before_process() {
global $order;
- $new_order_status = DEFAULT_ORDERS_STATUS_ID;
+ $order->set_id($this->extract_order_id());
+ $new_order_status = DEFAULT_ORDERS_STATUS_ID;
if ( OSCOM_APP_PAYPAL_PS_ORDER_STATUS_ID > 0) {
$new_order_status = OSCOM_APP_PAYPAL_PS_ORDER_STATUS_ID;
}
@@ -551,14 +552,14 @@ function before_process() {
// load the after_process function from the payment modules
$this->after_process();
-
- require 'includes/modules/checkout/reset.php';
-
- tep_redirect(tep_href_link('checkout_success.php', '', 'SSL'));
}
function after_process() {
unset($_SESSION['cart_PayPal_Standard_ID']);
+
+ require 'includes/modules/checkout/reset.php';
+
+ tep_redirect(tep_href_link('checkout_success.php', '', 'SSL'));
}
function get_error() {
diff --git a/includes/modules/shipping/flat.php b/includes/modules/shipping/flat.php
index a62172599..da6c9aebe 100644
--- a/includes/modules/shipping/flat.php
+++ b/includes/modules/shipping/flat.php
@@ -5,93 +5,67 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
*/
- class flat {
- var $code, $title, $description, $icon, $enabled;
+ class flat extends abstract_shipping_module {
-// class constructor
- function __construct() {
- global $order;
-
- $this->code = 'flat';
- $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
- $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
-
- if ( defined('MODULE_SHIPPING_FLAT_STATUS') ) {
- $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
- $this->icon = '';
- $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
- $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
- }
-
- if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
- $check_flag = false;
-
- $delivery_country_id = $order->delivery['country']['id'] ?? STORE_COUNTRY ?? 0;
- $delivery_zone_id = $order->delivery['zone_id'] ?? STORE_ZONE ?? 0;
-
- $check_query = tep_db_query("select zone_id from zones_to_geo_zones where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $delivery_country_id . "' order by zone_id");
- while ($check = tep_db_fetch_array($check_query)) {
- if ($check['zone_id'] < 1) {
- $check_flag = true;
- break;
- } elseif ($check['zone_id'] == $delivery_zone_id) {
- $check_flag = true;
- break;
- }
- }
-
- if ($check_flag == false) {
- $this->enabled = false;
- }
- }
- }
+ const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_';
// class methods
- function quote($method = '') {
+ public function quote($method = '') {
global $order;
- $this->quotes = array('id' => $this->code,
- 'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
- 'methods' => array(array('id' => $this->code,
- 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
- 'cost' => MODULE_SHIPPING_FLAT_COST)));
-
- if ($this->tax_class > 0) {
- $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
- }
+ $this->quotes = [
+ 'id' => $this->code,
+ 'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
+ 'methods' => [[
+ 'id' => $this->code,
+ 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
+ 'cost' => $this->base_constant('COST') + $this->calculate_handling(),
+ ]],
+ ];
- if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));
+ $this->quote_common();
return $this->quotes;
}
- function check() {
- if (!isset($this->_check)) {
- $check_query = tep_db_query("select configuration_value from configuration where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
- $this->_check = tep_db_num_rows($check_query);
- }
- return $this->_check;
+ protected function get_parameters() {
+ return [
+ $this->config_key_base . 'STATUS' => [
+ 'title' => 'Enable Flat Shipping',
+ 'value' => 'True',
+ 'desc' => 'Do you want to offer flat rate shipping?',
+ 'set_func' => "tep_cfg_select_option(['True', 'False'], ",
+ ],
+ $this->config_key_base . 'COST' => [
+ 'title' => 'Shipping Cost',
+ 'value' => '5.00',
+ 'desc' => 'The shipping cost for all orders using this shipping method.',
+ ],
+ $this->config_key_base . 'TAX_CLASS' => [
+ 'title' => 'Tax Class',
+ 'value' => '0',
+ 'desc' => 'Use the following tax class on the shipping fee.',
+ 'use_func' => 'tep_get_tax_class_title',
+ 'set_func' => 'tep_cfg_pull_down_tax_classes(',
+ ],
+ $this->config_key_base . 'ZONE' => [
+ 'title' => 'Shipping Zone',
+ 'value' => '0',
+ 'desc' => 'If a zone is selected, only enable this shipping method for that zone.',
+ 'use_func' => 'tep_get_zone_class_title',
+ 'set_func' => 'tep_cfg_pull_down_zone_classes(',
+ ],
+ $this->config_key_base . 'SORT_ORDER' => [
+ 'title' => 'Sort Order',
+ 'value' => '0',
+ 'desc' => 'Sort order of display.',
+ ],
+ ];
}
- function install() {
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
- }
-
- function remove() {
- tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
- }
-
- function keys() {
- return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
- }
}
-?>
diff --git a/includes/modules/shipping/item.php b/includes/modules/shipping/item.php
index 15307012d..7e58f4ec4 100644
--- a/includes/modules/shipping/item.php
+++ b/includes/modules/shipping/item.php
@@ -5,122 +5,102 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2008 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
*/
- class item {
- var $code, $title, $description, $icon, $enabled;
+ class item extends abstract_shipping_module {
-// class constructor
- function __construct() {
- global $order;
-
- $this->code = 'item';
- $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;
- $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;
-
- if ( defined('MODULE_SHIPPING_ITEM_STATUS') ) {
- $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;
- $this->icon = '';
- $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;
- $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
- }
-
- $delivery_country_id = $order->delivery['country']['id'] ?? STORE_COUNTRY ?? 0;
- $delivery_zone_id = $order->delivery['zone_id'] ?? STORE_ZONE ?? 0;
-
- if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) {
- $check_flag = false;
- $check_query = tep_db_query("select zone_id from zones_to_geo_zones where geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $delivery_country_id . "' order by zone_id");
- while ($check = tep_db_fetch_array($check_query)) {
- if ($check['zone_id'] < 1) {
- $check_flag = true;
- break;
- } elseif ($check['zone_id'] == $delivery_zone_id) {
- $check_flag = true;
- break;
- }
- }
-
- if ($check_flag == false) {
- $this->enabled = false;
- }
- }
- }
+ const CONFIG_KEY_BASE = 'MODULE_SHIPPING_ITEM_';
// class methods
- function quote($method = '') {
- global $order;
-
- $number_of_items = $this->getNumberOfItems();
-
- $this->quotes = array('id' => $this->code,
- 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
- 'methods' => array(array('id' => $this->code,
- 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
- 'cost' => (MODULE_SHIPPING_ITEM_COST * $number_of_items) + MODULE_SHIPPING_ITEM_HANDLING)));
-
- if ($this->tax_class > 0) {
- $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
- }
-
- if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));
+ public function quote($method = '') {
+ $this->quotes = [
+ 'id' => $this->code,
+ 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
+ 'methods' => [[
+ 'id' => $this->code,
+ 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
+ 'cost' => ($this->base_constant('COST') * $this->count_items()) + $this->calculate_handling(),
+ ]],
+ ];
+
+ $this->quote_common();
return $this->quotes;
}
- function check() {
- if (!isset($this->_check)) {
- $check_query = tep_db_query("select configuration_value from configuration where configuration_key = 'MODULE_SHIPPING_ITEM_STATUS'");
- $this->_check = tep_db_num_rows($check_query);
- }
- return $this->_check;
- }
-
- function install() {
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_ITEM_STATUS', 'True', 'Do you want to offer per item rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_ITEM_COST', '2.50', 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.', '6', '0', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_ITEM_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ITEM_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_ITEM_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ITEM_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
- }
-
- function remove() {
- tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
- }
-
- function keys() {
- return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
+ protected function get_parameters() {
+ return [
+ $this->config_key_base . 'STATUS' => [
+ 'title' => 'Enable Item Shipping',
+ 'value' => 'True',
+ 'desc' => 'Do you want to offer per item rate shipping?',
+ 'set_func' => "tep_cfg_select_option(['True', 'False'], ",
+ ],
+ $this->config_key_base . 'COST' => [
+ 'title' => 'Shipping Cost',
+ 'value' => '2.50',
+ 'desc' => 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.',
+ ],
+ $this->config_key_base . 'HANDLING' => [
+ 'title' => 'Handling Fee',
+ 'value' => '0',
+ 'desc' => 'Handling fee for this shipping method.',
+ ],
+ $this->config_key_base . 'TAX_CLASS' => [
+ 'title' => 'Tax Class',
+ 'value' => '0',
+ 'desc' => 'Use the following tax class on the shipping fee.',
+ 'use_func' => 'tep_get_tax_class_title',
+ 'set_func' => 'tep_cfg_pull_down_tax_classes(',
+ ],
+ $this->config_key_base . 'ZONE' => [
+ 'title' => 'Shipping Zone',
+ 'value' => '0',
+ 'desc' => 'If a zone is selected, only enable this shipping method for that zone.',
+ 'use_func' => 'tep_get_zone_class_title',
+ 'set_func' => 'tep_cfg_pull_down_zone_classes(',
+ ],
+ $this->config_key_base . 'SORT_ORDER' => [
+ 'title' => 'Sort Order',
+ 'value' => '0',
+ 'desc' => 'Sort order of display.',
+ ],
+ ];
}
- function getNumberOfItems() {
- global $order, $total_count;
-
- $number_of_items = $total_count;
-
- if ($order->content_type == 'mixed') {
- $number_of_items = 0;
-
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
- $number_of_items += $order->products[$i]['qty'];
-
- if (isset($order->products[$i]['attributes'])) {
- foreach($order->products[$i]['attributes'] as $option => $value) {
- $virtual_check_query = tep_db_query("select count(*) as total from products_attributes pa, products_attributes_download pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id");
- $virtual_check = tep_db_fetch_array($virtual_check_query);
+ protected function count_items() {
+ global $order;
- if ($virtual_check['total'] > 0) {
- $number_of_items -= $order->products[$i]['qty'];
- }
+ $item_count = ('physical' === $order->content_type) ? $GLOBALS['total_count'] : 0;
+
+ if ('mixed' === $order->content_type) {
+ foreach ($order->products as $product) {
+ foreach (($product['attributes'] ?? []) as $option => $value) {
+ $virtual_check_query = tep_db_query(sprintf(<<<'EOSQL'
+SELECT COUNT(*) AS total
+ FROM products_attributes pa INNER JOIN products_attributes_download pad
+ ON pa.products_attributes_id = pad.products_attributes_id
+ WHERE pa.products_id = %d AND pa.options_values_id = %d
+EOSQL
+ , (int)$product['id'], (int)$value['value_id']));
+ $virtual_check = tep_db_fetch_array($virtual_check_query);
+
+ if ($virtual_check['total'] > 0) {
+ // if any attribute is downloadable, the product is virtual
+ // and doesn't count; so skip to the next product
+ // without adding the product quantity
+ continue 2;
}
}
+
+ $item_count += $product['qty'];
}
}
- return $number_of_items;
+ return $item_count;
}
+
}
-?>
diff --git a/includes/modules/shipping/table.php b/includes/modules/shipping/table.php
index 41069f723..8cb9593e9 100644
--- a/includes/modules/shipping/table.php
+++ b/includes/modules/shipping/table.php
@@ -10,54 +10,25 @@
Released under the GNU General Public License
*/
- class table extends abstract_module {
+ class table extends abstract_shipping_module {
const CONFIG_KEY_BASE = 'MODULE_SHIPPING_TABLE_';
- public $icon;
-
-// class constructor
- function __construct() {
- global $order;
-
- parent::__construct();
-
- if ( $this->enabled ) {
- $this->icon = '';
- $this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;
-
- if ( ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
- $delivery_country_id = $order->delivery['country']['id'] ?? STORE_COUNTRY ?? 0;
- $delivery_zone_id = $order->delivery['zone_id'] ?? STORE_ZONE ?? 0;
-
- $check_query = tep_db_query(sprintf(<<<'EOSQL'
-SELECT zone_id
- FROM zones_to_geo_zones
- WHERE geo_zone_id = %d AND zone_country_id = %d
- ORDER BY zone_id
-EOSQL
- , (int)MODULE_SHIPPING_TABLE_ZONE, (int)$delivery_country_id));
- while ($check = tep_db_fetch_array($check_query)) {
- if ( ($check['zone_id'] < 1) || ($check['zone_id'] == $delivery_zone_id) ) {
- $this->enabled = false;
- break;
- }
- }
- }
- }
- }
-
// class methods
- function quote($method = '') {
- global $order, $shipping_weight, $shipping_num_boxes;
-
- if (MODULE_SHIPPING_TABLE_MODE == 'price') {
- $order_total = $this->getShippableTotal();
- } else {
- $order_total = $shipping_weight;
+ public function quote($method = '') {
+ switch ($this->base_constant('MODE') ) {
+ case 'price':
+ $order_total = $this->get_shippable_total();
+ break;
+ case 'weight':
+ $order_total = $GLOBALS['shipping_weight'];
+ break;
+ case 'quantity':
+ $order_total = $this->count_items();
+ break;
}
- $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
+ $table_cost = preg_split("/[:,]/" , $this->base_constant('COST'));
for ($i = 0, $n = count($table_cost); $i < $n; $i += 2) {
if ($order_total <= $table_cost[$i]) {
$shipping = $table_cost[$i+1];
@@ -65,8 +36,8 @@ function quote($method = '') {
}
}
- if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
- $shipping = $shipping * $shipping_num_boxes;
+ if ('weight' === $this->base_constant('MODE')) {
+ $shipping *= $GLOBALS['shipping_num_boxes'];
}
$this->quotes = [
@@ -75,58 +46,54 @@ function quote($method = '') {
'methods' => [[
'id' => $this->code,
'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
- 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING,
+ 'cost' => $shipping + $this->calculate_handling(),
]],
];
- if ($this->tax_class > 0) {
- $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
- }
-
- if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));
+ $this->quote_common();
return $this->quotes;
}
protected function get_parameters() {
return [
- 'MODULE_SHIPPING_TABLE_STATUS' => [
+ $this->config_key_base . 'STATUS' => [
'title' => 'Enable Table Method',
'value' => 'True',
'desc' => 'Do you want to offer table rate shipping?',
'set_func' => "tep_cfg_select_option(['True', 'False'], ",
],
- 'MODULE_SHIPPING_TABLE_COST' => [
+ $this->config_key_base . 'COST' => [
'title' => 'Shipping Table',
'value' => '25:8.50,50:5.50,10000:0.00',
'desc' => 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc',
],
- 'MODULE_SHIPPING_TABLE_MODE' => [
+ $this->config_key_base . 'MODE' => [
'title' => 'Table Method',
'value' => 'weight',
'desc' => 'The shipping cost is based on the order total or the total weight of the items ordered.',
- 'set_func' => "tep_cfg_select_option(['weight', 'price'], ",
+ 'set_func' => "tep_cfg_select_option(['weight', 'price', 'quantity'], ",
],
- 'MODULE_SHIPPING_TABLE_HANDLING' => [
+ $this->config_key_base . 'HANDLING' => [
'title' => 'Handling Fee',
'value' => '0',
'desc' => 'Handling fee for this shipping method.',
],
- 'MODULE_SHIPPING_TABLE_TAX_CLASS' => [
+ $this->config_key_base . 'TAX_CLASS' => [
'title' => 'Tax Class',
'value' => '0',
'desc' => 'Use the following tax class on the shipping fee.',
'use_func' => 'tep_get_tax_class_title',
'set_func' => 'tep_cfg_pull_down_tax_classes(',
],
- 'MODULE_SHIPPING_TABLE_ZONE' => [
+ $this->config_key_base . 'ZONE' => [
'title' => 'Shipping Zone',
'value' => '0',
'desc' => 'If a zone is selected, only enable this shipping method for that zone.',
'use_func' => 'tep_get_zone_class_title',
'set_func' => 'tep_cfg_pull_down_zone_classes(',
],
- 'MODULE_SHIPPING_TABLE_SORT_ORDER' => [
+ $this->config_key_base . 'SORT_ORDER' => [
'title' => 'Sort Order',
'value' => '0',
'desc' => 'Sort order of display.',
@@ -134,17 +101,13 @@ protected function get_parameters() {
];
}
- function getShippableTotal() {
+ protected function get_shippable_total() {
global $order, $currencies;
- $order_total = $_SESSION['cart']->show_total();
+ $order_total = (('physical' === $order->content_type) ? $_SESSION['cart']->show_total() : 0);
if ('mixed' === $order->content_type) {
- $order_total = 0;
-
foreach ($order->products as $product) {
- $order_total += $currencies->calculate_price($product['final_price'], $product['tax'], $product['qty']);
-
foreach (($product['attributes'] ?? []) as $option => $value) {
$virtual_check_query = tep_db_query(sprintf(<<<'EOSQL'
SELECT COUNT(*) AS total
@@ -157,13 +120,50 @@ function getShippableTotal() {
$virtual_check = tep_db_fetch_array($virtual_check_query);
if ($virtual_check['total'] > 0) {
- $order_total -= $currencies->calculate_price($product['final_price'], $product['tax'], $product['qty']);
+ // if any attribute is downloadable, the product is virtual
+ // and doesn't count; so skip to the next product
+ // without adding the product quantity
+ continue 2;
}
}
+
+ $order_total += $currencies->calculate_price($product['final_price'], $product['tax'], $product['qty']);
}
}
return $order_total;
}
+ function count_items() {
+ global $order;
+
+ $item_count = ('physical' === $order->content_type) ? $GLOBALS['total_count'] : 0;
+
+ if ('mixed' === $order->content_type) {
+ foreach ($order->products as $product) {
+ foreach (($product['attributes'] ?? []) as $option => $value) {
+ $virtual_check_query = tep_db_query(sprintf(<<<'EOSQL'
+SELECT COUNT(*) AS total
+ FROM products_attributes pa INNER JOIN products_attributes_download pad
+ ON pa.products_attributes_id = pad.products_attributes_id
+ WHERE pa.products_id = %d AND pa.options_values_id = %d
+EOSQL
+ , (int)$product['id'], (int)$value['value_id']));
+ $virtual_check = tep_db_fetch_array($virtual_check_query);
+
+ if ($virtual_check['total'] > 0) {
+ // if any attribute is downloadable, the product is virtual
+ // and doesn't count; so skip to the next product
+ // without adding the product quantity
+ continue 2;
+ }
+ }
+
+ $item_count += $product['qty'];
+ }
+ }
+
+ return $item_count;
+ }
+
}
diff --git a/includes/modules/shipping/zones.php b/includes/modules/shipping/zones.php
index dc4787588..635cc4118 100644
--- a/includes/modules/shipping/zones.php
+++ b/includes/modules/shipping/zones.php
@@ -6,23 +6,23 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2020 osCommerce
Released under the GNU General Public License
USAGE
By default, the module comes with support for 1 zone. This can be
- easily changed by editing the line below in the zones constructor
- that defines $this->num_zones.
+ easily changed by editing the line below in the zones constructor
+ that defines static::ZONE_COUNT.
Next, you will want to activate the module by going to the Admin screen,
clicking on Modules, then clicking on Shipping. A list of all shipping
- modules should appear. Click on the green dot next to the one labeled
+ modules should appear. Click on the green dot next to the one labeled
zones.php. A list of settings will appear to the right. Click on the
- Edit button.
+ Edit button.
- PLEASE NOTE THAT YOU WILL LOSE YOUR CURRENT SHIPPING RATES AND OTHER
- SETTINGS IF YOU TURN OFF THIS SHIPPING METHOD. Make sure you keep a
+ PLEASE NOTE THAT YOU WILL LOSE YOUR CURRENT SHIPPING RATES AND OTHER
+ SETTINGS IF YOU TURN OFF THIS SHIPPING METHOD. Make sure you keep a
backup of your shipping settings somewhere at all times.
If you want an additional handling charge applied to orders that use this
@@ -31,7 +31,7 @@
Next, you will need to define which countries are in each zone. Determining
this might take some time and effort. You should group a set of countries
that has similar shipping charges for the same weight. For instance, when
- shipping from the US, the countries of Japan, Australia, New Zealand, and
+ shipping from the US, the countries of Japan, Australia, New Zealand, and
Singapore have similar shipping rates. As an example, one of my customers
is using this set of zones:
1: USA
@@ -56,11 +56,11 @@
some time and effort will go into setting the appropriate rates. You
will define a set of weight ranges and the shipping price for each
range. For instance, you might want an order than weighs more than 0
- and less than or equal to 3 to cost 5.50 to ship to a certain zone.
+ and less than or equal to 3 to cost 5.50 to ship to a certain zone.
This would be defined by this: 3:5.5
You should combine a bunch of these rates together in a comma delimited
- list and enter them into the "Zone X Shipping Table" fields where "X"
+ list and enter them into the "Zone X Shipping Table" fields where "X"
is the zone number. For example, this might be used for Zone 1:
1:3.5,2:3.95,3:5.2,4:6.45,5:7.7,6:10.4,7:11.85, 8:13.3,9:14.75,10:16.2,11:17.65,
12:19.1,13:20.55,14:22,15:23.45
@@ -73,139 +73,133 @@
At this time, it does not deal with weights that are above the highest amount
defined. This will probably be the next area to be improved with the
module. For now, you could have one last very high range with a very
- high shipping rate to discourage orders of that magnitude. For
+ high shipping rate to discourage orders of that magnitude. For
instance: 999:1000
- If you want to be able to ship to any country in the world, you will
+ If you want to be able to ship to any country in the world, you will
need to enter every country code into the Country fields. For most
- shops, you will not want to enter every country. This is often
+ shops, you will not want to enter every country. This is often
because of too much fraud from certain places. If a country is not
listed, then the module will add a $0.00 shipping charge and will
- indicate that shipping is not available to that destination.
+ indicate that shipping is not available to that destination.
PLEASE NOTE THAT THE ORDER CAN STILL BE COMPLETED AND PROCESSED!
- It appears that the osC shipping system automatically rounds the
+ It appears that the osC shipping system automatically rounds the
shipping weight up to the nearest whole unit. This makes it more
- difficult to design precise shipping tables. If you want to, you
+ difficult to design precise shipping tables. If you want to, you
can hack the shipping.php file to get rid of the rounding.
*/
- class zones {
- var $code, $title, $description, $enabled, $num_zones;
-
-// class constructor
- function __construct() {
- $this->code = 'zones';
- $this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;
- $this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;
-
- if ( defined('MODULE_SHIPPING_ZONES_STATUS') ) {
- $this->sort_order = MODULE_SHIPPING_ZONES_SORT_ORDER;
- $this->icon = '';
- $this->tax_class = MODULE_SHIPPING_ZONES_TAX_CLASS;
- $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
- }
+ class zones extends abstract_shipping_module {
- // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
- $this->num_zones = 1;
- }
+ const CONFIG_KEY_BASE = 'MODULE_SHIPPING_ZONES_';
+
+ // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
+ const ZONE_COUNT = 1;
// class methods
- function quote($method = '') {
+ public function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes;
- $dest_country = $order->delivery['country']['iso_code_2'];
- $dest_zone = 0;
+ $dest_zone = false;
$error = false;
- for ($i=1; $i<=$this->num_zones; $i++) {
- $countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
- $country_zones = preg_split("/[,]/", $countries_table);
- if (in_array($dest_country, $country_zones)) {
+ for ($i = 1; $i <= static::ZONE_COUNT; $i++) {
+ if (in_array($order->delivery['country']['iso_code_2'], explode(';', $this->base_constant('COUNTRIES_' . $i)))) {
$dest_zone = $i;
break;
}
}
- if ($dest_zone == 0) {
+ if (false === $dest_zone) {
$error = true;
} else {
- $shipping = -1;
- $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
+ $shipping = false;
+ $zones_cost = $this->base_constant('COST_' . $dest_zone);
- $zones_table = preg_split("/[:,]/" , $zones_cost);
- $size = sizeof($zones_table);
- for ($i=0; $i<$size; $i+=2) {
+ $zones_table = preg_split('/[:,]/' , $zones_cost);
+ for ($i = 0, $size = count($zones_table); $i < $size; $i += 2) {
if ($shipping_weight <= $zones_table[$i]) {
$shipping = $zones_table[$i+1];
- $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;
+ $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY
+ . ' ' . $order->delivery['country']['iso_code_2']
+ . ' : ' . $shipping_weight
+ . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;
break;
}
}
- if ($shipping == -1) {
+ if (false === $shipping) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_ZONES_UNDEFINED_RATE;
} else {
- $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
+ $shipping_cost = ($shipping * $shipping_num_boxes) + $this->base_constant('HANDLING_' . $dest_zone);
}
}
- $this->quotes = array('id' => $this->code,
- 'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
- 'methods' => array(array('id' => $this->code,
- 'title' => $shipping_method,
- 'cost' => $shipping_cost)));
-
- if ($this->tax_class > 0) {
- $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
- }
+ $this->quotes = [
+ 'id' => $this->code,
+ 'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
+ 'methods' => [[
+ 'id' => $this->code,
+ 'title' => $shipping_method,
+ 'cost' => $shipping_cost,
+ ]],
+ ];
- if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));
+ $this->quote_common();
- if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
+ if ($error) {
+ $this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
+ }
return $this->quotes;
}
- function check() {
- if (!isset($this->_check)) {
- $check_query = tep_db_query("select configuration_value from configuration where configuration_key = 'MODULE_SHIPPING_ZONES_STATUS'");
- $this->_check = tep_db_num_rows($check_query);
- }
- return $this->_check;
- }
-
- function install() {
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Zones Method', 'MODULE_SHIPPING_ZONES_STATUS', 'True', 'Do you want to offer zone rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ZONES_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ZONES_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
- for ($i = 1; $i <= $this->num_zones; $i++) {
- $default_countries = '';
- if ($i == 1) {
- $default_countries = 'US,CA';
- }
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_ZONES_COST_" . $i ."', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())");
- tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_ZONES_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");
+ protected function get_parameters() {
+ $parameters = [
+ $this->config_key_base . 'STATUS' => [
+ 'title' => 'Enable Zones Method',
+ 'value' => 'True',
+ 'desc' => 'Do you want to offer zone rate shipping?',
+ 'set_func' => "tep_cfg_select_option(['True', 'False'], ",
+ ],
+ $this->config_key_base . 'TAX_CLASS' => [
+ 'title' => 'Tax Class',
+ 'value' => '0',
+ 'desc' => 'Use the following tax class on the shipping fee.',
+ 'use_func' => 'tep_get_tax_class_title',
+ 'set_func' => 'tep_cfg_pull_down_tax_classes(',
+ ],
+ $this->config_key_base . 'SORT_ORDER' => [
+ 'title' => 'Sort Order',
+ 'value' => '0',
+ 'desc' => 'Sort order of display.',
+ ],
+ ];
+
+ for ($i = 1; $i <= static::ZONE_COUNT; $i++) {
+ $keys = array_merge($keys, [
+ $this->config_key_base . 'COUNTRIES_' . $i => [
+ 'title' => 'Zone ' . $i . ' Countries',
+ 'value' => (($i == 1) ? 'US;CA' : ''),
+ 'desc' => 'Semi-colon separated list of two character ISO country codes that are part of Zone ' . $i . '.',
+ ],
+ $this->config_key_base . 'COST_' . $i => [
+ 'title' => 'Zone ' . $i . ' Shipping Table',
+ 'value' => '3:8.50,7:10.50,99:20.00',
+ 'desc' => 'Shipping rates to Zone ' . $i . ' destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone ' . $i . ' destinations.',
+ ],
+ $this->config_key_base . 'HANDLING_' . $i => [
+ 'title' => 'Zone ' . $i . ' Handling Fee',
+ 'value' => '0',
+ 'desc' => 'Handling Fee for this shipping zone',
+ ],
+ ]);
+
+ return $parameters;
}
}
- function remove() {
- tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
- }
-
- function keys() {
- $keys = array('MODULE_SHIPPING_ZONES_STATUS', 'MODULE_SHIPPING_ZONES_TAX_CLASS', 'MODULE_SHIPPING_ZONES_SORT_ORDER');
-
- for ($i=1; $i<=$this->num_zones; $i++) {
- $keys[] = 'MODULE_SHIPPING_ZONES_COUNTRIES_' . $i;
- $keys[] = 'MODULE_SHIPPING_ZONES_COST_' . $i;
- $keys[] = 'MODULE_SHIPPING_ZONES_HANDLING_' . $i;
- }
-
- return $keys;
- }
}
-?>
diff --git a/includes/system/segments/sortable_product_columns.php b/includes/system/segments/sortable_product_columns.php
index fbc5956ef..fa5ea1518 100644
--- a/includes/system/segments/sortable_product_columns.php
+++ b/includes/system/segments/sortable_product_columns.php
@@ -34,42 +34,43 @@
}
if ( (!isset($_GET['sort'])) || (!preg_match('/^[1-9][ad]$/', $_GET['sort'])) || (substr($_GET['sort'], 0, -1) > count($column_list)) ) {
- $i = array_search('PRODUCT_LIST_NAME', $column_list, true);
+ $i = array_search(($default_column ?? 'PRODUCT_LIST_NAME'), $column_list, true);
if (false !== $i) {
- $_GET['sort'] = $i+1 . 'a';
- $listing_sql .= " ORDER BY pd.products_name";
+ $sort_col = $i+1;
+ $_GET['sort'] = $sort_col . ($sort_order ?? 'a');
}
} else {
$sort_col = substr($_GET['sort'], 0 , -1);
- $sort_order = substr($_GET['sort'], -1);
+ }
- switch ($column_list[$sort_col-1]) {
- case 'PRODUCT_LIST_MODEL':
- $listing_sql .= " ORDER BY p.products_model " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_NAME':
- $listing_sql .= " ORDER BY pd.products_name " . ($sort_order == 'd' ? 'DESC' : '');
- break;
- case 'PRODUCT_LIST_MANUFACTURER':
- $listing_sql .= " ORDER BY m.manufacturers_name " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_QUANTITY':
- $listing_sql .= " ORDER BY p.products_quantity " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_IMAGE':
- $listing_sql .= " ORDER BY pd.products_name";
- break;
- case 'PRODUCT_LIST_WEIGHT':
- $listing_sql .= " ORDER BY p.products_weight " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_PRICE':
- $listing_sql .= " ORDER BY final_price " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_ID':
- $listing_sql .= " ORDER BY p.products_id " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- case 'PRODUCT_LIST_ORDERED':
- $listing_sql .= " ORDER BY p.products_ordered " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
- break;
- }
+ $sort_order = substr($_GET['sort'], -1);
+
+ switch ($column_list[$sort_col-1]) {
+ case 'PRODUCT_LIST_MODEL':
+ $listing_sql .= " ORDER BY p.products_model " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_NAME':
+ $listing_sql .= " ORDER BY pd.products_name " . ($sort_order == 'd' ? 'DESC' : '');
+ break;
+ case 'PRODUCT_LIST_MANUFACTURER':
+ $listing_sql .= " ORDER BY m.manufacturers_name " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_QUANTITY':
+ $listing_sql .= " ORDER BY p.products_quantity " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_IMAGE':
+ $listing_sql .= " ORDER BY pd.products_name";
+ break;
+ case 'PRODUCT_LIST_WEIGHT':
+ $listing_sql .= " ORDER BY p.products_weight " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_PRICE':
+ $listing_sql .= " ORDER BY final_price " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_ID':
+ $listing_sql .= " ORDER BY p.products_id " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
+ case 'PRODUCT_LIST_ORDERED':
+ $listing_sql .= " ORDER BY p.products_ordered " . ($sort_order == 'd' ? 'DESC' : '') . ", pd.products_name";
+ break;
}
diff --git a/includes/system/versioned/1.0.5.3/order.php b/includes/system/versioned/1.0.5.3/order.php
index 16bc90ead..bc11978bf 100644
--- a/includes/system/versioned/1.0.5.3/order.php
+++ b/includes/system/versioned/1.0.5.3/order.php
@@ -123,6 +123,7 @@ public function query($order_id) {
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price'],
+ 'orders_products_id' => $orders_products['orders_products_id'],
];
$attributes_query = tep_db_query("SELECT products_options, products_options_values, options_values_price, price_prefix FROM orders_products_attributes WHERE orders_id = " . (int)$this->id . " AND orders_products_id = " . (int)$orders_products['orders_products_id']);
diff --git a/includes/system/versioned/1.0.7.3/abstract_module.php b/includes/system/versioned/1.0.7.3/abstract_module.php
new file mode 100644
index 000000000..22ba2d6e1
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/abstract_module.php
@@ -0,0 +1,129 @@
+get_constant($this->config_key_base . "$suffix");
+ }
+
+ public function __construct() {
+ if (is_null($this->config_key_base)) {
+ $this->config_key_base = static::CONFIG_KEY_BASE;
+ }
+
+ $this->code = get_class($this);
+ $this->title = self::get_constant(static::CONFIG_KEY_BASE . 'TEXT_TITLE')
+ ?? self::get_constant(static::CONFIG_KEY_BASE . 'TITLE');
+ $this->description = self::get_constant(static::CONFIG_KEY_BASE . 'TEXT_DESCRIPTION')
+ ?? self::get_constant(static::CONFIG_KEY_BASE . 'DESCRIPTION');
+
+ $this->status_key = $this->config_key_base . 'STATUS';
+ if (defined($this->status_key)) {
+ $this->enabled = ('True' === constant($this->status_key));
+ }
+
+ $this->sort_order = $this->base_constant('SORT_ORDER') ?? 0;
+ }
+
+ public function isEnabled() {
+ return $this->enabled;
+ }
+
+ public function check() {
+ if (!isset($this->_check)) {
+ $check_query = tep_db_query("SELECT configuration_value FROM configuration WHERE configuration_key = '" . $this->status_key . "'");
+ $this->_check = tep_db_num_rows($check_query);
+ }
+
+ return $this->_check;
+ }
+
+ protected function _install($parameters) {
+ $sort_order = 1;
+ foreach ($parameters as $key => $data) {
+ $sql_data = [
+ 'configuration_title' => $data['title'],
+ 'configuration_key' => $key,
+ 'configuration_value' => ($data['value'] ?? ''),
+ 'configuration_description' => $data['desc'],
+ 'configuration_group_id' => 6,
+ 'sort_order' => (int)$sort_order,
+ 'date_added' => 'NOW()',
+ ];
+
+ if (isset($data['set_func'])) {
+ $sql_data['set_function'] = $data['set_func'];
+ }
+
+ if (isset($data['use_func'])) {
+ $sql_data['use_function'] = $data['use_func'];
+ }
+
+ tep_db_perform('configuration', $sql_data);
+ $sort_order++;
+ }
+ }
+
+ public function install($parameter_key = null) {
+ $parameters = $this->get_parameters();
+ if (isset($parameter_key)) {
+ if (isset($parameters[$parameter_key])) {
+ $parameters = [$parameter_key => $parameters[$parameter_key]];
+ } else {
+ $parameters = [];
+ }
+ }
+
+ self::_install($parameters);
+ }
+
+ public function remove() {
+ tep_db_query("DELETE FROM configuration WHERE configuration_key IN ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ public function keys() {
+ $parameters = $this->get_parameters();
+
+ if ($this->check()) {
+ $missing_parameters = array_filter($parameters, function ($k) { return !defined($k); }, ARRAY_FILTER_USE_KEY);
+
+ if ($missing_parameters) {
+ self::_install($missing_parameters);
+ }
+ }
+
+ return array_keys($parameters);
+ }
+
+ abstract protected function get_parameters();
+
+ public static function list_exploded($value) {
+ return nl2br(implode("\n", explode(';', $value)));
+ }
+
+ }
diff --git a/includes/system/versioned/1.0.7.3/abstract_payment_module.php b/includes/system/versioned/1.0.7.3/abstract_payment_module.php
new file mode 100644
index 000000000..6e571dd77
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/abstract_payment_module.php
@@ -0,0 +1,95 @@
+public_title = self::get_constant(static::CONFIG_KEY_BASE . 'TEXT_PUBLIC_TITLE')
+ ?? self::get_constant(static::CONFIG_KEY_BASE . 'PUBLIC_TITLE');
+
+ $this->order_status = (int)($this->base_constant('ORDER_STATUS_ID') ?? 0);
+ $this->order_status = ($this->order_status > 0) ? $this->order_status : 0;
+ }
+
+ public function javascript_validation() {
+ return false;
+ }
+
+ public function selection() {
+ return [
+ 'id' => $this->code,
+ 'module' => $this->public_title ?? $this->title,
+ ];
+ }
+
+ public function pre_confirmation_check() {
+ return false;
+ }
+
+ public function confirmation() {
+ return false;
+ }
+
+ public function process_button() {
+ return false;
+ }
+
+ public function before_process() {
+ return false;
+ }
+
+ public function after_process() {
+ return false;
+ }
+
+ public function get_error() {
+ return false;
+ }
+
+ public static function ensure_order_status($constant_name, $order_status_name) {
+ if (defined($constant_name)) {
+ return constant($constant_name);
+ }
+
+ $check_sql = "SELECT orders_status_id FROM orders_status WHERE orders_status_name = '" . tep_db_input($order_status_name) . "' LIMIT 1";
+ $check_query = tep_db_query($check_sql);
+
+ if (tep_db_num_rows($check_query) < 1) {
+ $column_names = '';
+ $column_values = '';
+ $flags_query = tep_db_query("DESCRIBE orders_status public_flag");
+ if (tep_db_num_rows($flags_query) === 1) {
+ $column_names = ', public_flag, downloads_flag';
+ $column_values = ', 0 AS public_flag, 0 AS downloads_flag';
+ }
+
+ $next_id = tep_db_fetch_array(tep_db_query("SELECT MAX(orders_status_id) + 1 AS next_id FROM orders_status"))['next_id'] ?? 1;
+
+ tep_db_query(sprintf(<<<'EOSQL'
+INSERT INTO orders_status (orders_status_id, language_id, orders_status_name%s)
+ SELECT %d AS orders_status_id,
+ l.languages_id AS language_id,
+ '%s' AS orders_status_name%s
+ FROM languages l
+ ORDER BY l.sort_order
+EOSQL
+ , $column_names, (int)$next_id, tep_db_input($order_status_name), $column_values));
+
+ $check_query = tep_db_query($check_sql);
+ }
+
+ $check = tep_db_fetch_array($check_query);
+ return $check['orders_status_id'];
+ }
+
+ }
diff --git a/includes/system/versioned/1.0.7.3/abstract_shipping_module.php b/includes/system/versioned/1.0.7.3/abstract_shipping_module.php
new file mode 100644
index 000000000..100c9290a
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/abstract_shipping_module.php
@@ -0,0 +1,38 @@
+tax_class = $this->base_constant('TAX_CLASS') ?? 0;
+ if ($this->tax_class > 0) {
+ $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
+ }
+
+ if (tep_not_null($this->icon) && ('True' === ($this->base_constant('DISPLAY_ICON') ?? 'True'))) {
+ $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));
+ }
+ }
+
+ public function calculate_handling() {
+ return ($this->base_constant('HANDLING') ?? 0);
+ }
+
+ }
+
diff --git a/includes/system/versioned/1.0.7.3/abstract_zoneable_module.php b/includes/system/versioned/1.0.7.3/abstract_zoneable_module.php
new file mode 100644
index 000000000..d190a1ae7
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/abstract_zoneable_module.php
@@ -0,0 +1,39 @@
+enabled && isset($GLOBALS['order']->delivery['country']['id'])) {
+ $this->update_status();
+ }
+ }
+
+ public function update_status() {
+ global $order;
+
+ $zone_id = $this->base_constant('ZONE') ?? 0;
+ if ( $this->enabled && isset($order->delivery['zone_id']) && ((int)$zone_id > 0) ) {
+ $check_query = tep_db_query("SELECT zone_id FROM zones_to_geo_zones WHERE geo_zone_id = " . (int)$zone_id . " AND zone_country_id = " . (int)$order->delivery['country']['id'] . " ORDER BY zone_id");
+ while ($check = tep_db_fetch_array($check_query)) {
+ if (($check['zone_id'] < 1) || ($check['zone_id'] == $order->delivery['zone_id'])) {
+ return;
+ }
+ }
+
+ $this->enabled = false;
+ }
+ }
+
+ }
+
diff --git a/includes/system/versioned/1.0.7.3/order_total.php b/includes/system/versioned/1.0.7.3/order_total.php
new file mode 100644
index 000000000..21b62e680
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/order_total.php
@@ -0,0 +1,74 @@
+modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);
+
+ foreach ($this->modules as $value) {
+ $class = pathinfo($value, PATHINFO_FILENAME);
+ $GLOBALS[$class] = new $class();
+ }
+ }
+ }
+
+ function process() {
+ $order_total_array = [];
+ if (is_array($this->modules)) {
+ foreach ($this->modules as $value) {
+ $class = pathinfo($value, PATHINFO_FILENAME);
+ if ($GLOBALS[$class]->enabled) {
+ $GLOBALS[$class]->output = [];
+ $GLOBALS[$class]->process();
+
+ foreach ($GLOBALS[$class]->output as $output) {
+ if (tep_not_null($output['title']) && tep_not_null($output['text'])) {
+ $order_total_array[] = [
+ 'code' => $GLOBALS[$class]->code,
+ 'title' => $output['title'],
+ 'text' => $output['text'],
+ 'value' => $output['value'],
+ 'sort_order' => $GLOBALS[$class]->sort_order,
+ ];
+ }
+ }
+ }
+ }
+ }
+
+ return $order_total_array;
+ }
+
+ function output() {
+ $output_string = '';
+ if (is_array($this->modules)) {
+ foreach ($this->modules as $value) {
+ $class = pathinfo($value, PATHINFO_FILENAME);
+ if ($GLOBALS[$class]->enabled) {
+ foreach ($GLOBALS[$class]->output as $output) {
+ $output_string .= ' ';
+ $output_string .= '' . $output['title'] . ' ';
+ $output_string .= '' . $output['text'] . ' ';
+ $output_string .= ' ';
+ }
+ }
+ }
+ }
+
+ return $output_string;
+ }
+ }
diff --git a/includes/system/versioned/1.0.7.3/payment.php b/includes/system/versioned/1.0.7.3/payment.php
new file mode 100644
index 000000000..0a23332bb
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/payment.php
@@ -0,0 +1,194 @@
+modules = explode(';', MODULE_PAYMENT_INSTALLED);
+
+ $include_modules = [];
+
+ if ( (tep_not_null($module)) && (in_array($module . '.php', $this->modules)) ) {
+ $this->selected_module = $module;
+
+ $include_modules[] = ['class' => $module, 'file' => "$module.php"];
+ } else {
+ foreach ($this->modules as $value) {
+ $include_modules[] = [
+ 'class' => pathinfo($value, PATHINFO_FILENAME),
+ 'file' => $value,
+ ];
+ }
+ }
+
+ foreach ($include_modules as $include_module) {
+ $GLOBALS[$include_module['class']] = new $include_module['class']();
+ }
+
+// if there is only one payment method, select it as default because in
+// checkout_confirmation.php the $payment variable is being assigned the
+// $_POST['payment'] value which will be empty (no radio button selection possible)
+ if ( (tep_count_payment_modules() == 1) && (!isset($_SESSION['payment']) || !is_object($GLOBALS[$_SESSION['payment']] ?? null)) ) {
+ $_SESSION['payment'] = $include_modules[0]['class'];
+ }
+
+ if ( (tep_not_null($module)) && (in_array($module, $this->modules)) && (isset($GLOBALS[$module]->form_action_url)) ) {
+ $this->form_action_url = $GLOBALS[$module]->form_action_url;
+ }
+ }
+ }
+
+// class methods
+/* The following method is needed in the checkout_confirmation.php page
+ due to a chicken and egg problem with the payment class and order class.
+ The payment modules needs the order destination data for the dynamic status
+ feature, and the order class needs the payment module title.
+ The following method is a work-around to implementing the method in all
+ payment modules available which would break the modules in the contributions
+ section. This should be looked into again post 2.2.
+*/
+ function update_status() {
+ if (is_array($this->modules)
+ && is_object($GLOBALS[$this->selected_module])
+ && method_exists($GLOBALS[$this->selected_module], 'update_status'))
+ {
+ $GLOBALS[$this->selected_module]->update_status();
+ }
+ }
+
+ function javascript_validation() {
+ $js = '';
+ if (is_array($this->modules)) {
+ $js = '' . "\n";
+ }
+
+ return $js;
+ }
+
+ function checkout_initialization_method() {
+ $initialize_array = [];
+
+ if (is_array($this->modules)) {
+ foreach($this->modules as $value) {
+ $class = pathinfo($value, PATHINFO_FILENAME);
+
+ if ($GLOBALS[$class]->enabled && method_exists($GLOBALS[$class], 'checkout_initialization_method')) {
+ $initialize_array[] = $GLOBALS[$class]->checkout_initialization_method();
+ }
+ }
+ }
+
+ return $initialize_array;
+ }
+
+ function selection() {
+ $selection_array = [];
+
+ if (is_array($this->modules)) {
+ foreach ($this->modules as $value) {
+ $class = pathinfo($value, PATHINFO_FILENAME);
+
+ if ($GLOBALS[$class]->enabled) {
+ $selection = $GLOBALS[$class]->selection();
+
+ if (is_array($selection)) {
+ $selection_array[] = $selection;
+ }
+ }
+ }
+ }
+
+ return $selection_array;
+ }
+
+ protected function is_selected_enabled() {
+ return (is_array($this->modules)
+ && is_object($GLOBALS[$this->selected_module])
+ && ($GLOBALS[$this->selected_module]->enabled) );
+ }
+
+ function pre_confirmation_check() {
+ if ($this->is_selected_enabled()) {
+ $GLOBALS[$this->selected_module]->pre_confirmation_check();
+ }
+ }
+
+ function confirmation() {
+ if ($this->is_selected_enabled()) {
+ return $GLOBALS[$this->selected_module]->confirmation();
+ }
+ }
+
+ function process_button() {
+ if ($this->is_selected_enabled()) {
+ return $GLOBALS[$this->selected_module]->process_button();
+ }
+ }
+
+ function before_process() {
+ if ($this->is_selected_enabled()) {
+ return $GLOBALS[$this->selected_module]->before_process();
+ }
+ }
+
+ function after_process() {
+ if ($this->is_selected_enabled()) {
+ return $GLOBALS[$this->selected_module]->after_process();
+ }
+ }
+
+ function get_error() {
+ if ($this->is_selected_enabled()) {
+ return $GLOBALS[$this->selected_module]->get_error();
+ }
+ }
+
+ }
diff --git a/includes/system/versioned/1.0.7.3/shopping_cart.php b/includes/system/versioned/1.0.7.3/shopping_cart.php
new file mode 100644
index 000000000..f82e2566a
--- /dev/null
+++ b/includes/system/versioned/1.0.7.3/shopping_cart.php
@@ -0,0 +1,401 @@
+ 'products_name',
+ 'model' => 'products_model',
+ 'image' => 'products_image',
+ 'weight' => 'products_weight',
+ 'tax_class_id' => 'products_tax_class_id',
+ ];
+
+ public $contents, $total, $weight, $cartID, $content_type;
+
+ function __construct() {
+ $this->reset();
+ }
+
+ function restore_contents() {
+ if (!isset($_SESSION['customer_id'])) {
+ return false;
+ }
+
+// insert current cart contents in database
+ if (is_array($this->contents)) {
+ foreach (array_keys($this->contents) as $products_id) {
+ $qty = $this->contents[$products_id]['qty'];
+ $product_query = tep_db_query("SELECT products_id FROM customers_basket WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id = '" . tep_db_input($products_id) . "'");
+ if (tep_db_num_rows($product_query)) {
+ tep_db_query("UPDATE customers_basket SET customers_basket_quantity = '" . tep_db_input($qty) . "' WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id = '" . tep_db_input($products_id) . "'");
+ } else {
+ tep_db_query("INSERT INTO customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) VALUES (" . (int)$_SESSION['customer_id'] . ", '" . tep_db_input($products_id) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')");
+ if (isset($this->contents[$products_id]['attributes'])) {
+ foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
+ tep_db_query("INSERT INTO customers_basket_attributes (customers_id, products_id, products_options_id, products_options_value_id) VALUES (" . (int)$_SESSION['customer_id'] . ", '" . tep_db_input($products_id) . "', " . (int)$option . ", " . (int)$value . ")");
+ }
+ }
+ }
+ }
+ }
+
+// reset per-session cart contents, but not the database contents
+ $this->reset(false);
+
+ $products_query = tep_db_query("SELECT products_id, customers_basket_quantity FROM customers_basket WHERE customers_id = " . (int)$_SESSION['customer_id']);
+ while ($products = tep_db_fetch_array($products_query)) {
+ $this->contents[$products['products_id']] = ['qty' => $products['customers_basket_quantity']];
+// attributes
+ $attributes_query = tep_db_query("SELECT products_options_id, products_options_value_id FROM customers_basket_attributes WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id = '" . tep_db_input($products['products_id']) . "'");
+ while ($attributes = tep_db_fetch_array($attributes_query)) {
+ $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
+ }
+ }
+
+ $this->cleanup();
+
+// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
+ $this->cartID = $this->generate_cart_id();
+ }
+
+ function reset($reset_database = false) {
+ $this->contents = [];
+ $this->total = 0;
+ $this->weight = 0;
+ $this->content_type = false;
+
+ if (isset($_SESSION['customer_id']) && $reset_database) {
+ tep_db_query("DELETE FROM customers_basket WHERE customers_id = " . (int)$_SESSION['customer_id']);
+ tep_db_query("DELETE FROM customers_basket_attributes WHERE customers_id = " . (int)$_SESSION['customer_id']);
+ }
+
+ unset($this->cartID);
+ unset($_SESSION['cartID']);
+ }
+
+ function add_cart($products_id, $qty = 1, $attributes = null, $notify = true) {
+ $products_id_string = tep_get_uprid($products_id, $attributes);
+ $products_id = tep_get_prid($products_id_string);
+
+ if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$qty > MAX_QTY_IN_CART)) {
+ $qty = MAX_QTY_IN_CART;
+ }
+
+ if (!empty($attributes) && is_array($attributes)) {
+ foreach ($attributes as $option => $value) {
+ if (!is_numeric($option) || !is_numeric($value)) {
+ return;
+ }
+
+ $check_query = tep_db_query("SELECT products_attributes_id FROM products_attributes WHERE products_id = " . (int)$products_id . " AND options_id = " . (int)$option . " AND options_values_id = " . (int)$value . " LIMIT 1");
+ if (tep_db_num_rows($check_query) < 1) {
+ return;
+ }
+ }
+ } elseif (tep_has_product_attributes($products_id)) {
+ return;
+ }
+
+ if (is_numeric($products_id) && is_numeric($qty)) {
+ $check_product_query = tep_db_query("SELECT products_status FROM products WHERE products_id = " . (int)$products_id);
+ $check_product = tep_db_fetch_array($check_product_query);
+
+ if (($check_product !== false) && ($check_product['products_status'] == '1')) {
+ if ($notify) {
+ $_SESSION['new_products_id_in_cart'] = $products_id;
+ }
+
+ if ($this->in_cart($products_id_string)) {
+ $this->update_quantity($products_id_string, $qty, $attributes);
+ } else {
+ $this->contents[$products_id_string] = ['qty' => (int)$qty];
+
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query("INSERT INTO customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) VALUES (" . (int)$_SESSION['customer_id'] . ", '" . tep_db_input($products_id_string) . "', " . (int)$qty . ", '" . date('Ymd') . "')");
+ }
+
+ if (is_array($attributes)) {
+ foreach ($attributes as $option => $value) {
+ $this->contents[$products_id_string]['attributes'][$option] = $value;
+
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query("INSERT INTO customers_basket_attributes (customers_id, products_id, products_options_id, products_options_value_id) VALUES (" . (int)$_SESSION['customer_id'] . ", '" . tep_db_input($products_id_string) . "', " . (int)$option . ", " . (int)$value . ")");
+ }
+ }
+ }
+ }
+
+ $this->cleanup();
+
+// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
+ $this->cartID = $this->generate_cart_id();
+ }
+ }
+ }
+
+ function update_quantity($products_id, $quantity, $attributes = null) {
+ $products_id_string = tep_get_uprid($products_id, $attributes);
+ $products_id = tep_get_prid($products_id_string);
+
+ if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$quantity > MAX_QTY_IN_CART)) {
+ $quantity = MAX_QTY_IN_CART;
+ }
+
+ foreach (($attributes ?? []) as $option => $value) {
+ if (!is_numeric($option) || !is_numeric($value)) {
+ return;
+ }
+ }
+
+ if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {
+ $this->contents[$products_id_string] = ['qty' => (int)$quantity];
+
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query(sprintf(<<<'EOSQL'
+UPDATE customers_basket
+ SET customers_basket_quantity = %d
+ WHERE customers_id = "%d AND products_id = '%s'
+EOSQL
+ , (int)$quantity, (int)$_SESSION['customer_id'], tep_db_input($products_id_string)));
+ }
+
+ foreach (($attributes ?? []) as $option => $value) {
+ $this->contents[$products_id_string]['attributes'][$option] = $value;
+
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query(sprintf(<<<'EOSQL'
+UPDATE customers_basket_attributes
+ SET products_options_value_id = %d
+ WHERE customers_id = %d AND products_id = '%s' AND products_options_id = %d
+EOSQL
+ , (int)$value, (int)$_SESSION['customer_id'], tep_db_input($products_id_string), (int)$option));
+ }
+ }
+
+// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
+ $this->cartID = $this->generate_cart_id();
+ }
+ }
+
+ function cleanup() {
+ foreach (array_keys($this->contents) as $product_id) {
+ if ($this->contents[$product_id]['qty'] < 1) {
+ unset($this->contents[$product_id]);
+
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query("DELETE FROM customers_basket WHERE products_id = '" . tep_db_input($product_id) . "' AND customers_id = " . (int)$_SESSION['customer_id']);
+ tep_db_query("DELETE FROM customers_basket_attributes WHERE products_id = '" . tep_db_input($product_id) . "' AND customers_id = " . (int)$_SESSION['customer_id']);
+ }
+ }
+ }
+ }
+
+// get total number of items in cart
+ function count_contents() {
+ $total_items = 0;
+ foreach (array_keys($this->contents) as $products_id) {
+ $total_items += $this->get_quantity($products_id);
+ }
+
+ return $total_items;
+ }
+
+ function get_quantity($products_id) {
+ return $this->contents[$products_id]['qty'] ?? 0;
+ }
+
+ function in_cart($products_id) {
+ return isset($this->contents[$products_id]);
+ }
+
+ function remove($products_id) {
+ unset($this->contents[$products_id]);
+// remove from database
+ if (isset($_SESSION['customer_id'])) {
+ tep_db_query("DELETE FROM customers_basket WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id = '" . tep_db_input($products_id) . "'");
+ tep_db_query("DELETE FROM customers_basket_attributes WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id = '" . tep_db_input($products_id) . "'");
+ }
+
+ $this->calculate();
+
+// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
+ $this->cartID = $this->generate_cart_id();
+ }
+
+ function remove_all() {
+ $this->reset();
+ }
+
+ function get_product_id_list() {
+ return implode(', ', array_keys($this->contents));
+ }
+
+ function calculate() {
+ global $currencies;
+
+ $this->total = 0;
+ $this->weight = 0;
+
+ foreach (array_keys($this->contents) as $products_id) {
+ $qty = $this->contents[$products_id]['qty'];
+
+// products price
+ $product_query = tep_db_query("SELECT products_id, products_price, products_tax_class_id, products_weight FROM products WHERE products_id = " . (int)$products_id);
+ if ($product = tep_db_fetch_array($product_query)) {
+ $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
+
+ $specials_query = tep_db_query("SELECT specials_new_products_price FROM specials WHERE status = 1 AND products_id = " . (int)$products_id);
+ $specials = tep_db_fetch_array($specials_query);
+ $products_price = $specials['specials_new_products_price'] ?? $product['products_price'];
+
+ $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
+ $this->weight += ($qty * $product['products_weight']);
+ }
+
+// attributes price
+ if (!empty($this->contents[$products_id]['attributes'])) {
+ $this->total += $currencies->calculate_price($this->attributes_price($products_id), $products_tax, $qty);
+ }
+ }
+ }
+
+ function attributes_price($products_id) {
+ $attributes_price = 0;
+
+ foreach (($this->contents[$products_id]['attributes'] ?? []) as $option => $value) {
+ $attribute_price_query = tep_db_query("SELECT options_values_price, price_prefix FROM products_attributes WHERE products_id = " . (int)$products_id . " AND options_id = " . (int)$option . " AND options_values_id = " . (int)$value);
+ $attribute_price = tep_db_fetch_array($attribute_price_query);
+ if ($attribute_price['price_prefix'] == '+') {
+ $attributes_price += $attribute_price['options_values_price'];
+ } else {
+ $attributes_price -= $attribute_price['options_values_price'];
+ }
+ }
+
+ return $attributes_price;
+ }
+
+ private function map_columns($data) {
+ static $column_keys = null;
+ if (is_null($column_keys)) {
+ $column_keys = static::COLUMN_KEYS;
+ $parameters = ['column_keys' => &$column_keys];
+ $GLOBALS['OSCOM_Hooks']->call('siteWide', 'cartProductColumns', $parameters);
+ }
+
+ $product = [];
+ foreach ($column_keys as $key => $column_name) {
+ $product[$key] = $data[$column_name];
+ }
+
+ return $product;
+ }
+
+ function get_products() {
+ $products = [];
+ foreach (array_keys($this->contents) as $products_id) {
+ $products_query = tep_db_query("SELECT p.*, pd.* FROM products p INNER JOIN products_description pd ON pd.products_id = p.products_id WHERE p.products_id = " . (int)$products_id . " AND pd.language_id = " . (int)$_SESSION['languages_id']);
+ if ($product = tep_db_fetch_array($products_query)) {
+ $prid = $product['products_id'];
+ $product_price = $product['products_price'];
+
+ $specials_query = tep_db_query("SELECT specials_new_products_price FROM specials WHERE status = 1 AND products_id = " . (int)$prid);
+ if ($specials = tep_db_fetch_array($specials_query)) {
+ $product_price = $specials['specials_new_products_price'];
+ }
+
+ $product = $this->map_columns($product);
+
+ $product['id'] = $products_id;
+ $product['price'] = $product_price;
+ $product['quantity'] = $this->contents[$products_id]['qty'];
+ $product['final_price'] = ($product_price + $this->attributes_price($products_id));
+ $product['attributes'] = ($this->contents[$products_id]['attributes'] ?? null);
+
+ $products[] = $product;
+ }
+ }
+
+ return $products;
+ }
+
+ function show_total() {
+ $this->calculate();
+
+ return $this->total;
+ }
+
+ function show_weight() {
+ $this->calculate();
+
+ return $this->weight;
+ }
+
+ function generate_cart_id($length = 5) {
+ return tep_create_random_value($length, 'digits');
+ }
+
+ function get_content_type() {
+ if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
+ $this->content_type = false;
+
+ foreach (array_keys($this->contents) as $products_id) {
+ if (isset($this->contents[$products_id]['attributes'])) {
+ foreach (($this->contents[$products_id]['attributes'] ?? []) as $option => $value) {
+ $virtual_check_query = tep_db_query(sprintf(<<<'EOSQL'
+SELECT COUNT(*) AS total
+ FROM products_attributes pa INNER JOIN products_attributes_download pad ON pa.products_attributes_id = pad.products_attributes_id
+ WHERE pa.products_id = %d AND pa.options_values_id = %d
+EOSQL
+ , (int)$products_id, (int)$value));
+ $virtual_check = tep_db_fetch_array($virtual_check_query);
+
+ if ($virtual_check['total'] > 0) {
+ switch ($this->content_type) {
+ case 'physical':
+ $this->content_type = 'mixed';
+
+ return $this->content_type;
+ default:
+ $this->content_type = 'virtual';
+ }
+ } else {
+ switch ($this->content_type) {
+ case 'virtual':
+ $this->content_type = 'mixed';
+
+ return $this->content_type;
+ default:
+ $this->content_type = 'physical';
+ }
+ }
+ }
+ } else {
+ switch ($this->content_type) {
+ case 'virtual':
+ $this->content_type = 'mixed';
+
+ return $this->content_type;
+ default:
+ $this->content_type = 'physical';
+ }
+ }
+ }
+ } else {
+ $this->content_type = 'physical';
+ }
+
+ return $this->content_type;
+ }
+
+ }
diff --git a/includes/version.php b/includes/version.php
index 5450a5fba..9e301f939 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1 +1 @@
-1.0.7.2
+1.0.7.3
diff --git a/install/includes/functions/general.php b/install/includes/functions/general.php
index efb08e3dd..9c0677b3f 100644
--- a/install/includes/functions/general.php
+++ b/install/includes/functions/general.php
@@ -38,7 +38,7 @@ function osc_realpath($directory) {
// password.
function osc_encrypt_password($plain) {
if (!class_exists('PasswordHash')) {
- include('../includes/classes/passwordhash.php');
+ require '../includes/classes/password_hash.php';
}
$hasher = new PasswordHash(10, true);
@@ -94,4 +94,3 @@ function osc_output_string($string, $translate = false, $protected = false) {
}
}
}
-?>
diff --git a/install/phoenix.sql b/install/phoenix.sql
index 2e63c2fe9..f9b5c8718 100644
--- a/install/phoenix.sql
+++ b/install/phoenix.sql
@@ -710,7 +710,7 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_ORDER_TOTAL_INSTALLED', 'ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php', 'List of order_total module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php)', '6', '0', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_SHIPPING_INSTALLED', 'flat.php', 'List of shipping module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ups.php;flat.php;item.php)', '6', '0', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_ACTION_RECORDER_INSTALLED', 'ar_admin_login.php;ar_contact_us.php;ar_reset_password.php', 'List of action recorder module filenames separated by a semi-colon. This is automatically updated. No need to edit.', '6', '0', now());
-INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_CONTENT_NAVBAR_INSTALLED', 'nb_hamburger_button.php;nb_brand.php;nb_shopping_cart.php', 'List of navbar module filenames separated by a semi-colon. This is automatically updated. No need to edit.', '6', '0', now());
+INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_CONTENT_NAVBAR_INSTALLED', 'nb_hamburger_button.php;nb_brand.php;nb_currencies.php;nb_account.php;nb_shopping_cart.php;nb_special_offers.php', 'List of navbar module filenames separated by a semi-colon. This is automatically updated. No need to edit.', '6', '0', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delevery payments?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort order of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
@@ -1390,7 +1390,7 @@ insert into configuration (configuration_title, configuration_key, configuration
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Template Block Groups', 'TEMPLATE_BLOCK_GROUPS', 'boxes;header_tags', 'This is automatically updated. No need to edit.', '6', '0', now());
# Content Modules
-INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', 'MODULE_CONTENT_INSTALLED', 'account/cm_account_gdpr;account/cm_account_title;account/cm_account_set_password;checkout_success/cm_cs_title;checkout_success/cm_cs_redirect_old_order;checkout_success/cm_cs_thank_you;checkout_success/cm_cs_product_notifications;checkout_success/cm_cs_downloads;checkout_success/cm_cs_continue_button;create_account_success/cm_cas_title;create_account_success/cm_cas_message;create_account_success/cm_cas_continue_button;header/cm_header_logo;footer/cm_footer_information_links;footer_suffix/cm_footer_extra_copyright;footer_suffix/cm_footer_extra_icons;gdpr/cm_gdpr_intro;gdpr/cm_gdpr_personal_details;header/cm_header_search;header/cm_header_messagestack;header/cm_header_breadcrumb;index/cm_i_title;index/cm_i_customer_greeting;index/cm_i_text_main;index/cm_i_card_products;index/cm_i_upcoming_products;index_nested/cm_in_title;index_nested/cm_in_category_description;index_nested/cm_in_category_listing;index_nested/cm_in_card_products;index_products/cm_ip_title;index_products/cm_ip_category_manufacturer_description;index_products/cm_ip_product_listing;login/cm_login_title;login/cm_login_form;login/cm_create_account_link;login/cm_forgot_password;navigation/cm_navbar;product_info/cm_pi_name;product_info/cm_pi_price;product_info/cm_pi_review_stars;product_info/cm_pi_modular;product_info/cm_pi_description;product_info/cm_pi_date_available;product_info/cm_pi_reviews;product_info_not_found/cm_pinf_message;shopping_cart/cm_sc_title;shopping_cart/cm_sc_no_products;shopping_cart/cm_sc_product_listing;shopping_cart/cm_sc_order_subtotal;shopping_cart/cm_sc_stock_notice;shopping_cart/cm_sc_checkout;testimonials/cm_t_title;testimonials/cm_t_list', 'This is automatically updated. No need to edit.', '6', '0', now());
+INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', 'MODULE_CONTENT_INSTALLED', 'account/cm_account_gdpr;account/cm_account_title;account/cm_account_set_password;checkout_success/cm_cs_title;checkout_success/cm_cs_redirect_old_order;checkout_success/cm_cs_thank_you;checkout_success/cm_cs_product_notifications;checkout_success/cm_cs_downloads;checkout_success/cm_cs_continue_button;create_account_success/cm_cas_title;create_account_success/cm_cas_message;create_account_success/cm_cas_continue_button;header/cm_header_logo;footer/cm_footer_information_links;footer/cm_footer_account;footer/cm_footer_contact_us;footer/cm_footer_text;footer_suffix/cm_footer_extra_copyright;footer_suffix/cm_footer_extra_icons;gdpr/cm_gdpr_intro;gdpr/cm_gdpr_personal_details;header/cm_header_search;header/cm_header_messagestack;header/cm_header_breadcrumb;index/cm_i_title;index/cm_i_customer_greeting;index/cm_i_text_main;index/cm_i_card_products;index/cm_i_upcoming_products;index_nested/cm_in_title;index_nested/cm_in_category_description;index_nested/cm_in_category_listing;index_nested/cm_in_card_products;index_products/cm_ip_title;index_products/cm_ip_category_manufacturer_description;index_products/cm_ip_product_listing;login/cm_login_title;login/cm_login_form;login/cm_create_account_link;login/cm_forgot_password;navigation/cm_navbar;product_info/cm_pi_name;product_info/cm_pi_price;product_info/cm_pi_review_stars;product_info/cm_pi_modular;product_info/cm_pi_description;product_info/cm_pi_date_available;product_info/cm_pi_reviews;product_info_not_found/cm_pinf_message;shopping_cart/cm_sc_title;shopping_cart/cm_sc_no_products;shopping_cart/cm_sc_product_listing;shopping_cart/cm_sc_order_subtotal;shopping_cart/cm_sc_stock_notice;shopping_cart/cm_sc_checkout;testimonials/cm_t_title;testimonials/cm_t_list', 'This is automatically updated. No need to edit.', '6', '0', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Set Account Password', 'MODULE_CONTENT_ACCOUNT_SET_PASSWORD_STATUS', 'True', 'Do you want to enable the Set Account Password module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Local Passwords', 'MODULE_CONTENT_ACCOUNT_SET_PASSWORD_ALLOW_PASSWORD', 'True', 'Allow local account passwords to be set.', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_ACCOUNT_SET_PASSWORD_SORT_ORDER', '100', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
@@ -1415,7 +1415,7 @@ insert into configuration (configuration_title, configuration_key, configuration
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FORGOT_PASSWORD_CONTENT_WIDTH', '6', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '1', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FORGOT_PASSWORD_SORT_ORDER', '3000', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
-# Load three Navbar Modules, let the shopowner install the rest per his/her needs
+# Load Navbar Modules, let the shopowner install the rest per his/her needs
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Hamburger Button Module', 'MODULE_NAVBAR_HAMBURGER_BUTTON_STATUS', 'True', 'Do you want to add the module to your Navbar?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_NAVBAR_HAMBURGER_BUTTON_CONTENT_PLACEMENT', 'Home', 'This module must be placed in the Home area of the Navbar.', '6', '1', 'tep_cfg_select_option([\'Home\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_NAVBAR_HAMBURGER_BUTTON_SORT_ORDER', '500', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
@@ -1425,6 +1425,15 @@ insert into configuration (configuration_title, configuration_key, configuration
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shopping Cart Module', 'MODULE_NAVBAR_SHOPPING_CART_STATUS', 'True', 'Do you want to add the module to your Navbar?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_NAVBAR_SHOPPING_CART_CONTENT_PLACEMENT', 'Right', 'Should the module be loaded in the Left or Right or the Home area of the Navbar?', '6', '1', 'tep_cfg_select_option([\'Left\', \'Right\', \'Home\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_NAVBAR_SHOPPING_CART_SORT_ORDER', '550', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Currencies Module', 'MODULE_NAVBAR_CURRENCIES_STATUS', 'True', 'Do you want to add the module to your Navbar?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_NAVBAR_CURRENCIES_CONTENT_PLACEMENT', 'Right', 'Should the module be loaded in the Left or Right or the Home area of the Navbar?', '6', '2', 'tep_cfg_select_option([\'Left\', \'Right\', \'Home\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_NAVBAR_CURRENCIES_SORT_ORDER', '530', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Account Module', 'MODULE_NAVBAR_ACCOUNT_STATUS', 'True', 'Do you want to add the module to your Navbar?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_NAVBAR_ACCOUNT_CONTENT_PLACEMENT', 'Left', 'Should the module be loaded in the Left or Right or the Home area of the Navbar?', '6', '2', 'tep_cfg_select_option([\'Left\', \'Right\', \'Home\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_NAVBAR_ACCOUNT_SORT_ORDER', '540', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Special Offers Module', 'MODULE_NAVBAR_SPECIAL_OFFERS_STATUS', 'True', 'Do you want to add the module to your Navbar?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement Group', 'MODULE_NAVBAR_SPECIAL_OFFERS_CONTENT_PLACEMENT', 'Left', 'Where should the module be loaded? Lowest is loaded first, per Group.', '6', '2', 'tep_cfg_select_option(array(\'Left\', \'Right\', \'Home\'), ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_NAVBAR_SPECIAL_OFFERS_SORT_ORDER', '530', 'Sort order of display. Lowest is displayed first.', '6', '3', now());
# Navbar
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Navbar Module', 'MODULE_CONTENT_NAVBAR_STATUS', 'True', 'Should the Navbar be shown? ', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
@@ -1455,17 +1464,24 @@ insert into configuration (configuration_title, configuration_key, configuration
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_HEADER_BREADCRUMB_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_HEADER_BREADCRUMB_SORT_ORDER', '40', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
-# Footer Links
-insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Information Links Footer Module', 'MODULE_CONTENT_FOOTER_INFORMATION_STATUS', 'True', 'Do you want to enable the Information Links content module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+# Footer
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Information Links Footer Module', 'MODULE_CONTENT_FOOTER_INFORMATION_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_INFORMATION_CONTENT_WIDTH', '3', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '1', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
-insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_INFORMATION_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
-
-# Footer Copyright
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_INFORMATION_SORT_ORDER', '10', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Account Footer Module', 'MODULE_CONTENT_FOOTER_ACCOUNT_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_ACCOUNT_CONTENT_WIDTH', '3', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '2', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_ACCOUNT_SORT_ORDER', '20', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Contact Us Footer Module', 'MODULE_CONTENT_FOOTER_CONTACT_US_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_CONTACT_US_CONTENT_WIDTH', '3', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '2', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_CONTACT_US_SORT_ORDER', '30', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Generic Text Footer Module', 'MODULE_CONTENT_FOOTER_TEXT_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_TEXT_CONTENT_WIDTH', '3', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '2', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
+insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_TEXT_SORT_ORDER', '40', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
+
+# Footer Suffix
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Copyright Details Footer Module', 'MODULE_CONTENT_FOOTER_EXTRA_COPYRIGHT_STATUS', 'True', 'Do you want to enable the Copyright content module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_EXTRA_COPYRIGHT_CONTENT_WIDTH', '6', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '1', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_FOOTER_EXTRA_COPYRIGHT_SORT_ORDER', '10', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
-
-# Footer Icons
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Payment Icons Footer Module', 'MODULE_CONTENT_FOOTER_EXTRA_ICONS_STATUS', 'True', 'Do you want to enable the Payment Icons content module?', '6', '1', 'tep_cfg_select_option([\'True\', \'False\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_FOOTER_EXTRA_ICONS_CONTENT_WIDTH', '6', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '1', 'tep_cfg_select_option([\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'], ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Icons', 'MODULE_CONTENT_FOOTER_EXTRA_ICONS_DISPLAY', 'apple-pay,bitcoin,cc-paypal', 'Icons to display.', '6', '0', now());
diff --git a/products_new.php b/products_new.php
index 0ebe6704e..aeab073b0 100644
--- a/products_new.php
+++ b/products_new.php
@@ -29,6 +29,9 @@
EOSQL
. (int)$languages_id;
+ $default_column = 'PRODUCT_LIST_ID';
+ $sort_order = 'd';
+
require $oscTemplate->map_to_template(__FILE__, 'page');
require 'includes/application_bottom.php';
diff --git a/templates/default/includes/ext/modules/content/account/braintree/cards.php b/templates/default/includes/ext/modules/content/account/braintree/cards.php
index d8df9527c..e07d3c072 100644
--- a/templates/default/includes/ext/modules/content/account/braintree/cards.php
+++ b/templates/default/includes/ext/modules/content/account/braintree/cards.php
@@ -24,7 +24,6 @@
}
?>
-
map_to_template('template_bottom.php', 'component');
diff --git a/templates/default/includes/ext/modules/content/account/sage_pay/cards.php b/templates/default/includes/ext/modules/content/account/sage_pay/cards.php
index 595940510..8940f9fb4 100644
--- a/templates/default/includes/ext/modules/content/account/sage_pay/cards.php
+++ b/templates/default/includes/ext/modules/content/account/sage_pay/cards.php
@@ -24,7 +24,6 @@
}
?>
-
map_to_template('template_bottom.php', 'component');
diff --git a/templates/default/includes/ext/modules/content/account/set_password.php b/templates/default/includes/ext/modules/content/account/set_password.php
index 5923d34a8..3f1998304 100644
--- a/templates/default/includes/ext/modules/content/account/set_password.php
+++ b/templates/default/includes/ext/modules/content/account/set_password.php
@@ -26,7 +26,6 @@
echo tep_draw_form('account_password', tep_href_link('ext/modules/content/account/set_password.php', '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process');
?>
-
-
-
-