Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
I have added code to the _BillingSummary view of an order in the admin to re-send the order email- this was a customization from the Gold site and it made it a one-step re-send of the email. The view has @Ajax.ActionLink("Resend Order Email", "ResendOrderEmail", "Orders", new { orderNumber = Model.OrderNumber }, new AjaxOptions() { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "view-order-tab-container", LoadingElementId = "loader", OnSuccess="EmailSentSuccess"
}, new { @class = "btn btn-sm btn-warning btn-outline" })
Then ViewOrder.cshtml has the following js function EmailSentSuccess() { toastr.success("Email was resent"); }
The OrderController has [HttpPost] public ActionResult ResendOrderEmail(int orderNumber) { var order = _orderRepo.LoadForOrderNumber(orderNumber); AbleCommerce.Code.OrderHelper.SendOrderEmail(order);
BillingSummaryModel model = new BillingSummaryModel { OrderId = order.Id, OrderDate = order.OrderDate, OrderNumber = order.OrderNumber, BillToEmail = order.BillToEmail, BillToFax = order.BillToFax, BillToPhoneNumber = order.BillToPhone, OrderStatusId = order.OrderStatusId, OrderStatusName = order.OrderStatus.DisplayName, BillingAddress = order.FormatAddress(true), TaxExemptionReference = GetTaxExemptionReference(order) }; return Json(new { Success = true, Url = Url.Action("ViewOrderTabs", new { OrderNumber = orderNumber }) }); }
This displays the view order page and the green success message, but none of the content normally on the ViewOrder page shows. How can I get the content to show? I can do a redirect- but I'm afraid the green success method wouldn't show then. Thanks
|
|
|
|
Rank: Advanced Member
Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System Joined: 10/11/2018(UTC) Posts: 110
Thanks: 19 times Was thanked: 18 time(s) in 18 post(s)
|
Hi Judy, Just remove the following line from the action link and you should be good then. Code:
UpdateTargetId = "view-order-tab-container",
Hope this helps!
|
|
|
|
Rank: Advanced Member
Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System Joined: 10/11/2018(UTC) Posts: 110
Thanks: 19 times Was thanked: 18 time(s) in 18 post(s)
|
Also, since the only purpose for this function is to resend an email, other code is not needed except for returning the success in JSON.
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
Thank you, you make everything seem so easy. I'm still learning all this crazy MVC stuff!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close