This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EPiServer; | |
using EPiServer.Commerce.Catalog.ContentTypes; | |
using EPiServer.Core; | |
using EPiServer.DataAbstraction; | |
using EPiServer.ServiceLocation; | |
using Mediachase.Commerce.Catalog; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EPiServer.Core; | |
using EPiServer.Enterprise; | |
using EPiServer.ServiceApi.Configuration; | |
using EPiServer.ServiceApi.Extensions; | |
using EPiServer.ServiceApi.Util; | |
using EPiServer.ServiceLocation; | |
using EPiServer.Web.Internal; | |
using System; | |
using System.IO; | |
using System.Net; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EPiServer; | |
using EPiServer.Commerce.Marketing; | |
using EPiServer.Core; | |
using EPiServer.ServiceLocation; | |
using Mediachase.Commerce; | |
using Mediachase.Commerce.Catalog; | |
using Mediachase.Commerce.Marketing; | |
using Mediachase.Commerce.Orders; | |
using System; | |
using System.Collections.Generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cart = OrderRepository.LoadOrCreate<Cart>(PrincipalInfo.CurrentPrincipal.GetContactId(), Cart.DefaultName).FirstOrDefault(); | |
var price = PriceService.GetDefaultPrice(marketId, | |
DateTime.UtcNow, | |
new CatalogKey(new Guid(variation.ApplicationId), variation.Code), | |
SiteContext.Current.Currency); | |
var lineItem = CreateLineItem(variation, quantity, price.UnitPrice.Amount); | |
cart.Forms.First().Shipments.First().LineItems.Add(lineItem); | |
PromotionEngine.Run(cart); | |
OrderRepository.Save(cart); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cart = OrderRepository.Load<Cart>(PrincipalInfo.CurrentPrincipal.GetContactId(), Cart.DefaultName).FirstOrDefault(); | |
if (cart == null) | |
{ | |
cart = OrderRepository.Create<Cart>(GetCommerceCustomerId(), Cart.DefaultName); | |
cart.CustomerName = PrincipalInfo.CurrentPrincipal.Identity.Name; | |
var orderReference = OrderRepository.Save(cart); | |
} | |
var price = PriceService.GetDefaultPrice(marketId, | |
DateTime.UtcNow, |