logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
judy at Web2Market  
#1 Posted : Monday, May 16, 2022 11:42:39 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 289

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

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

nadeem  
#2 Posted : Tuesday, May 17, 2022 9:05:35 AM(UTC)
nadeem

Rank: Advanced Member

Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System
Joined: 10/11/2018(UTC)
Posts: 109

Thanks: 17 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!
nadeem  
#3 Posted : Tuesday, May 17, 2022 9:31:38 AM(UTC)
nadeem

Rank: Advanced Member

Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System
Joined: 10/11/2018(UTC)
Posts: 109

Thanks: 17 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.
judy at Web2Market  
#4 Posted : Tuesday, May 17, 2022 10:59:51 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 289

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!
Users browsing this topic
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.