Skip to content

Commit

Permalink
Merge pull request Merchello#2288 from YodasMyDad/merchello-dev
Browse files Browse the repository at this point in the history
Adding Update Price method
  • Loading branch information
YodasMyDad committed Sep 24, 2019
2 parents 576cbfb + a89c248 commit 4f01d4a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,22 @@ public void AddItem(IItemCacheLineItem lineItem)
AddedItem.RaiseEvent(new Core.Events.NewEventArgs<ILineItem>(lineItem), this);
}

/// <summary>
/// Updates price
/// </summary>
/// <param name="sku"></param>
/// <param name="price"></param>
public void UpdatePrice(string sku, decimal price)
{
if (!_itemCache.Items.Contains(sku)) return;

UpdatingItem.RaiseEvent(new UpdateItemEventArgs<ILineItem>(_itemCache.Items[sku]), this);

_itemCache.Items[sku].Price = price;

UpdatedItem.RaiseEvent(new UpdateItemEventArgs<ILineItem>(_itemCache.Items[sku]), this);
}

/// <summary>
/// Updates a customer item cache item's quantity
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ public interface ICustomerItemCacheBase
/// </param>
void UpdateQuantity(string sku, int quantity);

/// <summary>
/// Update price
/// </summary>
/// <param name="sku"></param>
/// <param name="price"></param>
void UpdatePrice(string sku, decimal price);

/// <summary>
/// Updates the quantity of an item in the item cache
/// </summary>
Expand Down

0 comments on commit 4f01d4a

Please sign in to comment.