Skip to content

Commit

Permalink
Minor changes with View - update urls on the checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
support committed Jul 31, 2022
1 parent 0d54263 commit 171399b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Views/Checkout/Start.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<script asp-location="Footer" asp-src="/theme/script/public.checkout.js" asp-order="300"></script>

<script asp-location="Footer" asp-order="301">
vmorder.vCartUrl.init('@Url.RouteUrl("ShoppingCartSummary")', '@Url.RouteUrl("ShoppingCartTotal")');
vmorder.vShipping.init('#co-shipping-form', '/checkout/SaveShipping/');
vmorder.vBilling.init('#co-billing-form', '/checkout/SaveBilling/');
vmorder.vShippingMethod.init('#co-shipping-method-form', '/checkout/SaveShippingMethod/');
Expand Down
23 changes: 18 additions & 5 deletions src/Web/Grand.Web/wwwroot/theme/script/public.checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var vmorder = new Vue({
acceptTerms: false,
// checkout steps methods
Checkout: null,
vCartUrl: null,
vShipping: null,
vBilling: null,
vShippingMethod: null,
Expand Down Expand Up @@ -302,6 +303,19 @@ var vmorder = new Vue({
},
};
},
vmCartUrl(){
this.vCartUrl = {
urlCartSummary: false,
urlCartTotal: false,

init: function (urlCartSummary, urlCartTotal) {
this.urlCartSummary = urlCartSummary;
this.urlCartTotal = urlCartTotal;
vmorder.updateCart();
vmorder.updateTotals();
},
}
},
vmShipping() {
this.vShipping = {
form: false,
Expand Down Expand Up @@ -686,7 +700,7 @@ var vmorder = new Vue({
saveUrl: false,
isSuccess: false,

init: function (saveUrl, successUrl) {
init: function (saveUrl, successUrl) {
this.saveUrl = saveUrl;
this.successUrl = successUrl;
},
Expand Down Expand Up @@ -749,7 +763,7 @@ var vmorder = new Vue({
},
updateCart() {
axios({
baseURL: '/cart/summary/',
baseURL: this.vCartUrl.urlCartSummary,
method: 'get',
data: null,
headers: {
Expand All @@ -763,7 +777,7 @@ var vmorder = new Vue({
},
updateTotals() {
axios({
baseURL: '/cart/total/',
baseURL: this.vCartUrl.urlCartTotal,
method: 'get',
data: null,
headers: {
Expand Down Expand Up @@ -834,15 +848,14 @@ var vmorder = new Vue({
}
},
created() {
this.vmCartUrl();
this.vmCheckout();
this.vmShipping();
this.vmBilling();
this.vmShippingMethod();
this.vmPaymentMethod();
this.vmPaymentInfo();
this.vmConfirmOrder();
this.updateCart();
this.updateTotals();
this.cartView();
this.otherScripts();
},
Expand Down

0 comments on commit 171399b

Please sign in to comment.