This file contains hidden or 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
public Cart GetShoppingCart(int orderGroupId) | |
{ | |
var parameters = new OrderSearchParameters | |
{ | |
SqlWhereClause = "OrderGroupId = " + orderGroupId | |
}; | |
var options = new OrderSearchOptions | |
{ | |
Classes = new StringCollection { "ShoppingCart" }, | |
RecordsToRetrieve = 1 |
This file contains hidden or 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
foreach (OrderForm form in order.OrderForms) | |
{ | |
decimal totalTaxes = 0; | |
foreach (Shipment shipment in form.Shipments) | |
{ | |
foreach (LineItem item in shipment.Parent.LineItems) | |
{ | |
[...] |
This file contains hidden or 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
private List<LineItem> GetSplitShipmentLineItems(Shipment shipment) | |
{ | |
List<LineItem> items = Shipment.GetShipmentLineItems(shipment); | |
return items.Select(x => new LineItem | |
{ | |
CatalogEntryId = x.CatalogEntryId, | |
ExtendedPrice = x.ExtendedPrice / x.Quantity * Shipment.GetLineItemQuantity(shipment, x.LineItemId), // Need the extended price for this shipment | |
Quantity = Shipment.GetLineItemQuantity(shipment, x.LineItemId), | |
}).ToList(); | |
} |
This file contains hidden or 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
foreach (Shipment shipment in form.Shipments) | |
{ | |
List<LineItem> items = GetSplitShipmentLineItems(shipment); | |
// Calculate sales and shipping taxes per items | |
foreach (LineItem item in items) | |
[...] |
This file contains hidden or 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
foreach (LineItem item in items) | |
{ | |
OrderAddress address = GetAddressByName(form, shipment.ShippingAddressId); | |
if (address != null) // no taxes if there is no address | |
{ | |
CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto(item.CatalogEntryId, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull)); | |
if (entryDto.CatalogEntry.Count > 0) // no entry, no tax category, no tax | |
{ | |
CatalogEntryDto.VariationRow[] variationRows = entryDto.CatalogEntry[0].GetVariationRows(); | |
if (variationRows.Length > 0) |
This file contains hidden or 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
public class ViewTemplateCoordinator : IViewTemplateModelRegistrator | |
{ | |
public void Register(TemplateModelCollection viewTemplateModelRegistrator) | |
{ | |
viewTemplateModelRegistrator.Add( | |
typeof(ProductVariant), | |
new TemplateModel | |
{ | |
Name = "InlineArticleProducts", | |
AvailableWithoutTag = false, |
This file contains hidden or 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
@model InlineArticleProduct | |
<article> | |
<h1>@Model.Name</h1> | |
<p class="price">@Model.Price</p> | |
</article> |
This file contains hidden or 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
public class InlineArticleProductController : ActionControllerBase | |
{ | |
public ActionResult Index(ProductVariant currentContent) | |
{ | |
var model = new InlineArticleProduct | |
{ | |
Name = "A hat", | |
Price = 250 | |
}; |
This file contains hidden or 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
public class InlineArticleProduct | |
{ | |
public string Name { get; set; } | |
public decimal Price { get; set; } | |
} |
This file contains hidden or 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
[ContentType(GUID = "34D69D83-83DF-4739-9132-8805BBC82196")] | |
[MediaDescriptor(ExtensionString = "pdf")] | |
public class PdfFile : MediaData | |
{ | |
} |