Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Apr 20, 2020
1 parent 40b819a commit 437b68d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4389,7 +4389,7 @@ protected virtual async Task InstallMessageTemplates()
Name = "OrderCancelled.VendorNotification",
Subject = "{{Store.Name}}. Order #{{Order.OrderNumber}} cancelled",
Body = "<p><a href=\"{{Store.URL}}\">{{Store.Name}}</a> <br /><br />Order #{{Order.OrderNumber}} has been cancelled. <br /><br />Order Number: {{Order.OrderNumber}} <br /> Date Ordered: {{Order.CreatedOn}} <br /><br /> ",
IsActive = true,
IsActive = false,
EmailAccountId = eaGeneral.Id,
},
new MessageTemplate
Expand Down
15 changes: 6 additions & 9 deletions Grand.Services/Messages/DotLiquidDrops/LiquidOrderItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@ public partial class LiquidOrderItem : Drop
private Order _order;
private Product _product;
private Language _language;
private Currency _currency;
private Store _store;
private Vendor _vendor;

public LiquidOrderItem(OrderItem orderItem, Product product, Order order, Language language, Currency currency, Store store, Vendor vendor)
{
this._orderItem = orderItem;
this._store = store;
this._language = language;
this._currency = currency;
this._order = order;
this._product = product;
this._vendor = vendor;
_orderItem = orderItem;
_store = store;
_language = language;
_order = order;
_product = product;
_vendor = vendor;
AdditionalTokens = new Dictionary<string, string>();
}

Expand Down Expand Up @@ -62,7 +60,6 @@ public string LicenseUrl
{
get
{
var storeId = _order?.StoreId;
string licenseUrl = string.Format("{0}download/getlicense/{1}", (_store.SslEnabled ? _store.SecureUrl : _store.Url), _orderItem.OrderItemGuid);
return licenseUrl;
}
Expand Down
2 changes: 1 addition & 1 deletion Grand.Services/Messages/MessageTokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public async Task AddOrderTokens(LiquidObject liquidObject, Order order, Custome
foreach (var item in order.OrderItems.Where(x => x.VendorId == vendor?.Id || vendor == null))
{
var product = await productService.GetProductById(item.ProductId);
var vendorItem = await vendorService.GetVendorById(item.VendorId);
Vendor vendorItem = string.IsNullOrEmpty(item.VendorId) ? null : await vendorService.GetVendorById(item.VendorId);
var liqitem = new LiquidOrderItem(item, product, order, language, currency, store, vendorItem);

#region Download
Expand Down
2 changes: 1 addition & 1 deletion Grand.Services/Orders/OrderProcessingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ protected virtual async Task<IList<Vendor>> GetVendorsInOrder(Order order)
{
//find existing
var vendor = vendors.FirstOrDefault(v => v.Id == orderItem.VendorId);
if (vendor == null)
if (vendor == null && !string.IsNullOrEmpty(orderItem.VendorId))
{
//not found. load by Id
vendor = await _vendorService.GetVendorById(orderItem.VendorId);
Expand Down

0 comments on commit 437b68d

Please sign in to comment.