Skip to content

Commit

Permalink
https://github.com/opencart/opencart/issues/12661
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Sep 21, 2024
1 parent 2e15839 commit 309f112
Show file tree
Hide file tree
Showing 7 changed files with 653 additions and 597 deletions.
1,204 changes: 617 additions & 587 deletions upload/admin/view/template/sale/order_info.twig

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions upload/catalog/controller/api/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public function index() {

$json = [];

if (isset($this->request->post['product'])) {
$products = (array)$this->request->post['product'];
if (isset($this->request->post['cart'])) {
$products = (array)$this->request->post['cart'];
} else {
$products = [];
}
Expand Down Expand Up @@ -97,7 +97,14 @@ public function refresh(): void {
$this->load->controller('api/payment_address');
$this->load->controller('api/shipping_address');
$this->load->controller('api/shipping_method.save');
$this->load->controller('api/extension');

$this->load->model('setting/extension');

$extensions = $this->model_setting_extension->getExtensionsByType('total');

foreach ($extensions as $extension) {
$this->load->controller('extension/' . $extension['extension'] . '/api/' . $extension['code']);
}

// Stock
if (!$this->cart->hasStock() && (!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning'))) {
Expand Down Expand Up @@ -210,9 +217,18 @@ public function add(): void {
$this->load->controller('api/payment_address');
$this->load->controller('api/shipping_address');
$this->load->controller('api/shipping_method.save');
$this->load->controller('api/extension');

$this->load->model('setting/extension');

$extensions = $this->model_setting_extension->getExtensionsByType('total');

foreach ($extensions as $extension) {
$this->load->controller('extension/' . $extension['extension'] . '/api/' . $extension['code']);
}
}

print_r($this->request->post);

// Add any single products
if (isset($this->request->post['product_id'])) {
$product_id = (int)$this->request->post['product_id'];
Expand Down
9 changes: 8 additions & 1 deletion upload/catalog/controller/api/payment_method.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ public function save(): void {
$this->load->controller('api/payment_address');
$this->load->controller('api/shipping_address');
$this->load->controller('api/shipping_method.save');
$this->load->controller('api/extension');

$this->load->model('setting/extension');

$extensions = $this->model_setting_extension->getExtensionsByType('total');

foreach ($extensions as $extension) {
$this->load->controller('extension/' . $extension['extension'] . '/api/' . $extension['code']);
}
}

// 1. Validate customer data exists
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/api/shipping_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function index(): void {

foreach ($keys as $key => $value) {
if (!isset($this->request->post[$key]) || gettype($this->request->post[$key]) !== gettype($value)) {
$this->request->post[$key] = $value;
// $this->request->post[$key] = $value;
}
}

Expand Down
4 changes: 4 additions & 0 deletions upload/catalog/controller/startup/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public function index(): ?\Opencart\System\Engine\Action {

return null;
}

/**
* @return void
*/
public function permission(): void {
$this->language->load('error/permission');

Expand Down
5 changes: 2 additions & 3 deletions upload/catalog/language/en-gb/api/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
$_['error_shipping_address'] = 'Warning: Shipping address required!';
$_['error_shipping_method'] = 'Warning: Shipping method required!';
$_['error_stock'] = 'Warning: Products marked with *** are not available in the desired quantity or not in stock!';
$_['error_minimum'] = 'Warning: Minimum order amount for %s is %s!';
$_['error_product'] = 'Warning: Products required!';
$_['error_minimum'] = 'Warning: Minimum order amount for %s is %s!';
$_['error_affiliate'] = 'Warning: Affiliate details required!';
$_['error_extension'] = 'Warning: Please check the %s form carefully for errors!';

$_['error_extension'] = 'Warning: Please check the %s form carefully for errors!';
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $('#form-reward').on('submit', function(e) {
$.ajax({
url: 'index.php?route=sale/order.call&user_token={{ user_token }}&call=extension/opencart/api/reward&store_id=' + $('#input-store').val() + '&language=' + $('#input-language').val() + '&currency=' + $('#input-currency').val(),
type: 'post',
data: $('.modal form, #collapse-order form').serialize(),
data: $('#form-customer, #form-cart, #form-shipping-address, #form-shipping-method, #form-payment-address, #form-payment-method, #collapse-order form').serialize(),
dataType: 'json',
beforeSend: function() {
$('#button-reward').button('loading');
Expand Down

0 comments on commit 309f112

Please sign in to comment.