Skip to content

Commit

Permalink
https://github.com/opencart/opencart/pull/13875
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Apr 23, 2024
1 parent 85a6aa8 commit 0fa0754
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 51 deletions.
2 changes: 1 addition & 1 deletion upload/admin/controller/cms/article.php
Expand Up @@ -125,7 +125,7 @@ protected function getList(): string {
'article_id' => $result['article_id'],
'name' => $result['name'],
'author' => $result['author'],
'rating' => $result['rating'],
'rating' => (int)$result['rating'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'edit' => $this->url->link('cms/article.form', 'user_token=' . $this->session->data['user_token'] . '&article_id=' . $result['article_id'] . $url)
Expand Down
12 changes: 6 additions & 6 deletions upload/admin/controller/cms/comment.php
Expand Up @@ -232,10 +232,10 @@ public function approve(): void {

$json = [];

$selected = [];

if (isset($this->request->post['selected'])) {
$selected = $this->request->post['selected'];
} else {
$selected = [];
}

if (isset($this->request->get['article_comment_id'])) {
Expand Down Expand Up @@ -290,10 +290,10 @@ public function spam(): void {

$json = [];

$selected = [];

if (isset($this->request->post['selected'])) {
$selected = $this->request->post['selected'];
} else {
$selected = [];
}

if (isset($this->request->get['article_comment_id'])) {
Expand Down Expand Up @@ -345,10 +345,10 @@ public function delete(): void {

$json = [];

$selected = [];

if (isset($this->request->post['selected'])) {
$selected = $this->request->post['selected'];
} else {
$selected = [];
}

if (isset($this->request->get['article_comment_id'])) {
Expand Down
14 changes: 13 additions & 1 deletion upload/admin/controller/sale/order.php
Expand Up @@ -1263,6 +1263,18 @@ public function call(): void {
$session_id = '';
}

if (isset($this->request->post['store_id'])) {
$store_id = $this->request->post['store_id'];
} else {
$store_id = 0;
}

if (isset($this->request->post['language'])) {
$language = $this->request->post['language'];
} else {
$language = $this->config->get('config_language');
}

if (!$this->user->hasPermission('modify', 'sale/order')) {
$json['error']['warning'] = $this->language->get('error_permission');
}
Expand Down Expand Up @@ -1309,7 +1321,7 @@ public function invoice(): void {
$data['direction'] = $this->language->get('direction');
$data['lang'] = $this->language->get('code');

// Hard coding css so they can be replaced via the events system.
// Hard coding css paths so that they can be replaced via the event's system.
$data['bootstrap_css'] = 'view/stylesheet/bootstrap.css';
$data['icons'] = 'view/stylesheet/fonts/fontawesome/css/all.min.css';
$data['stylesheet'] = 'view/stylesheet/stylesheet.css';
Expand Down
42 changes: 21 additions & 21 deletions upload/admin/view/template/sale/order_info.twig
Expand Up @@ -1367,7 +1367,7 @@ $('#form-customer').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=customer',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=customer&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-customer').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1633,7 +1633,7 @@ $('#form-product-add').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart.add',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart.add&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-product-add').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1685,7 +1685,7 @@ $('#order-products').on('submit', 'form', function(e) {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart.remove',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart.remove&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $(element).serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1726,7 +1726,7 @@ $('#form-voucher-add').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher.add',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher.add&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-voucher-add').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1784,7 +1784,7 @@ $('#order-vouchers').on('submit', 'form', function(e) {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher.remove',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher.remove&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $(element).serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1822,7 +1822,7 @@ $('#input-store').on('change', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=store',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=store&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-store').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1855,7 +1855,7 @@ $('#input-language').on('change', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=language',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=language&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-language').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1888,7 +1888,7 @@ $('#input-currency').on('change', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=currency',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=currency&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-currency').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1922,7 +1922,7 @@ $('#form-coupon').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=coupon',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=coupon&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-coupon').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1957,7 +1957,7 @@ $('#form-voucher').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=voucher&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-voucher').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -1992,7 +1992,7 @@ $('#form-reward').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=reward',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=reward&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-reward').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2100,7 +2100,7 @@ $('#form-affiliate').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=affiliate',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=affiliate&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-affiliate').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2236,7 +2236,7 @@ $('#form-payment-address').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_address',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_address&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-payment-address').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2407,7 +2407,7 @@ $('#form-shipping-address').on('submit', function(e) {
e.preventDefault();
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_address',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_address&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-shipping-address').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2526,7 +2526,7 @@ $('#button-shipping-methods').on('click', function() {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_method',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_method&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
dataType: 'json',
beforeSend: function() {
$(element).button('loading');
Expand Down Expand Up @@ -2585,7 +2585,7 @@ $('#form-shipping-method').on('submit', function(e) {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_method.save',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=shipping_method.save&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-shipping-method').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2625,7 +2625,7 @@ $('#button-payment-methods').on('click', function() {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_method',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_method&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
dataType: 'json',
beforeSend: function() {
$(element).button('loading');
Expand Down Expand Up @@ -2684,7 +2684,7 @@ $('#form-payment-method').on('submit', function(e) {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_method.save',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=payment_method.save&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-payment-method').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2723,7 +2723,7 @@ $('#form-comment').on('submit', function(e) {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=order.comment',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=order.comment&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
type: 'post',
data: $('#form-comment').serialize(),
dataType: 'json',
Expand Down Expand Up @@ -2757,7 +2757,7 @@ $('#form-comment').on('submit', function(e) {
// Refresh all products, vouchers and totals
$('#button-refresh').on('click', function() {
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=cart&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
dataType: 'json',
beforeSend: function() {
$('#button-refresh').button('loading');
Expand Down Expand Up @@ -2882,7 +2882,7 @@ $('#button-confirm').on('click', function() {
var element = this;
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=order.confirm',
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=order.confirm&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val(),
dataType: 'json',
beforeSend: function() {
$(element).button('loading');
Expand Down
21 changes: 11 additions & 10 deletions upload/catalog/controller/account/wishlist.php
Expand Up @@ -85,6 +85,7 @@ public function getList(): string {
$this->load->model('account/wishlist');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$this->load->model('localisation/stock_status');

$results = $this->model_account_wishlist->getWishlist($this->customer->getId());

Expand All @@ -99,19 +100,19 @@ public function getList(): string {
}

if ($product_info['quantity'] <= 0) {
$this->load->model('localisation/stock_status');
$stock_status_id = $product_info['stock_status_id'];
} elseif ($this->config->get('config_stock_display')) {
$stock_status_id = 0;
} else {
$stock_status_id = (int)$this->config->get('stock_status_id');
}

$stock_status_info = $this->model_localisation_stock_status->getStockStatus($product_info['stock_status_id']);
$stock_status_info = $this->model_localisation_stock_status->getStockStatus($stock_status_id);

if ($stock_status_info) {
$stock = $stock_status_info['name'];
} else {
$stock = '';
}
} elseif ($this->config->get('config_stock_display')) {
$stock = $product_info['quantity'];
if ($stock_status_info) {
$stock = $stock_status_info['name'];
} else {
$stock = $this->language->get('text_instock');
$stock = $product_info['quantity'];
}

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
Expand Down
4 changes: 2 additions & 2 deletions upload/catalog/controller/api/order.php
Expand Up @@ -970,10 +970,10 @@ public function delete(): void {

$json = [];

$selected = [];

if (isset($this->request->post['selected'])) {
$selected = $this->request->post['selected'];
} else {
$selected = [];
}

if (isset($this->request->get['order_id'])) {
Expand Down
1 change: 0 additions & 1 deletion upload/catalog/controller/checkout/cart.php
Expand Up @@ -53,7 +53,6 @@ public function index(): void {
$data['success'] = '';
}


if ($this->config->get('config_cart_weight')) {
$data['weight'] = $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->language->get('decimal_point'), $this->language->get('thousand_point'));
} else {
Expand Down
18 changes: 9 additions & 9 deletions upload/catalog/model/checkout/order.php
Expand Up @@ -597,10 +597,10 @@ public function addHistory(int $order_id, int $order_status_id, string $comment
if ($this->config->get('fraud_' . $extension['code'] . '_status')) {
$this->load->model('extension/' . $extension['extension'] . '/fraud/' . $extension['code']);

$model_extension_fraud = ($this->{'model_extension_' . $extension['extension'] . '_fraud_' . $extension['code']}) ?? null;
$key = 'model_extension_' . $extension['extension'] . '_fraud_' . $extension['code'];

if ($model_extension_fraud && isset($model_extension_fraud->check)) {
$fraud_status_id = $model_extension_fraud->check($order_info);
if (isset($this->{$key}->check)) {
$fraud_status_id = $this->{$key}->check($order_info);

if ($fraud_status_id) {
$order_status_id = $fraud_status_id;
Expand All @@ -622,11 +622,11 @@ public function addHistory(int $order_id, int $order_status_id, string $comment
foreach ($order_totals as $order_total) {
$this->load->model('extension/' . $order_total['extension'] . '/total/' . $order_total['code']);

$model_extension_total = $this->{'model_extension_' . $order_total['extension'] . '_total_' . $order_total['code']} ?? null;
$key = 'model_extension_' . $order_total['extension'] . '_total_' . $order_total['code'];

if ($model_extension_total && isset($model_extension_total->confirm)) {
if (isset($this->{$key}->confirm)) {
// Confirm coupon, vouchers and reward points
$fraud_status_id = $model_extension_total->confirm($order_info, $order_total);
$fraud_status_id = $this->{$key}->confirm($order_info, $order_total);

// If the balance on the coupon, vouchers and reward points is not enough to cover the transaction or has already been used then the fraud order status is returned.
if ($fraud_status_id) {
Expand Down Expand Up @@ -724,10 +724,10 @@ public function addHistory(int $order_id, int $order_status_id, string $comment
foreach ($order_totals as $order_total) {
$this->load->model('extension/' . $order_total['extension'] . '/total/' . $order_total['code']);

$model_extension_total = $this->{'model_extension_' . $order_total['extension'] . '_total_' . $order_total['code']} ?? null;
$key = 'model_extension_' . $order_total['extension'] . '_total_' . $order_total['code'];

if ($model_extension_total && isset($model_extension_total->unconfirm)) {
$model_extension_total->unconfirm($order_info);
if (isset($this->{$key}->unconfirm)) {
$this->{$key}->unconfirm($order_info);
}
}
}
Expand Down

0 comments on commit 0fa0754

Please sign in to comment.