Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit cccdb1bd erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: simple order considers orderhash

Übergeordneter d26c5423
No related branches found
No related tags found
2 Merge Requests!9feat: checkout billing address design improved,!8feat: checkout billing address design improved
......@@ -12,17 +12,14 @@ function ($orderHash) {
try {
$Order = $OrderHandler->getOrderByHash($orderHash);
$Customer = $Order->getCustomer();
$customerId = $Customer->getId();
if (
QUI\Permissions\Permission::isAdmin($User)
|| QUI\Permissions\Permission::isSU($User)
) {
if ($User->getId() === $customerId) {
return $Order->toArray();
}
if ($User->getId() === $Order->getCustomer()->getId()) {
return $Order->toArray();
}
return false;
} catch (QUI\Exception $exception) {
}
......
......@@ -9,6 +9,10 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_order-simple-checkout_ajax_frontend_setCurrency',
function ($orderHash, $currency) {
if (!QUI::getUserBySession()->getId()) {
return;
}
$Checkout = new Checkout(['orderHash' => $orderHash]);
$Order = $Checkout->getOrder();
$Currency = QUI\ERP\Currency\Handler::getCurrency($currency);
......
......@@ -49,6 +49,8 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
},
$onImport: function() {
console.log('$onImport');
this.Loader = new QUILoader().inject(this.getElm());
this.$setAnchor();
......@@ -97,32 +99,40 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
// check order status
this.$loadOrder().then((orderData) => {
if (!orderData) {
// orderData === false = no permission for this order
if (orderData === false) {
// normal load
return this.$loadGUI();
}
window.location.hash = '';
this.setAttribute('orderHash', '');
switch (parseInt(orderData.status)) {
case 1: // PAYMENT_STATUS_PAID
case 2: // PAYMENT_STATUS_PART
// show payment step
return this.$loadPayment();
return this.$loadGUI();
}
// normal load
if (parseInt(orderData.status) === 0) {
return this.$loadGUI();
if (typeof orderData !== 'undefined' &&
typeof orderData.data !== 'undefined' &&
typeof orderData.data.orderedWithCosts !== 'undefined' &&
orderData.data.orderedWithCosts
) {
// show payment step
return this.$loadPayment();
}
// some errors
// @todo show errors?
return this.$loadGUI();
}).then(() => {
this.Loader.hide();
moofx([
this.getElm().getElements('form'),
this.getElm().getElements('.quiqqer-simple-checkout-orderDetails')
]).animate({
opacity: 1
});
});
},
$onInject: function() {
console.log('$onInject');
this.$loadProducts().then(() => {
return this.$loadCheckout();
}).catch((err) => {
......@@ -261,6 +271,12 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
(result) => {
const Container = this.getElm().getElement('.quiqqer-simple-checkout-container');
// for the OrderProcess.js
if (this.getElm().getElement('form')) {
this.getElm().getElement('form').set('data-order-hash', result.orderHash);
this.getElm().getElement('form').set('data-products-count', result.productCount);
}
moofx(Container).animate({
opacity: 0
}, {
......@@ -489,7 +505,10 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
return new Promise((resolve) => {
QUIAjax.get('package_quiqqer_order-simple-checkout_ajax_frontend_basket', (basket) => {
this.getElm().getElement('.quiqqer-simple-checkout-basket__inner').set('html', basket);
if (this.getElm().getElement('.quiqqer-simple-checkout-basket__inner')) {
this.getElm().getElement('.quiqqer-simple-checkout-basket__inner').set('html', basket);
}
this.Loader.hide();
resolve();
}, {
......
<div class="quiqqer-simple-checkout-orderDetails">
<div class="quiqqer-simple-checkout-orderDetails" style="opacity: 0">
{$BasketForHeader->create()}
</div>
<form method="post" action="">
<form method="post" action="" style="opacity: 0">
<div class="quiqqer-simple-checkout-container">
<section class="quiqqer-simple-checkout-details">
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren