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 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
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
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
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 (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
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
[EditorDescriptorRegistration(TargetType = typeof(XhtmlString), UIHint = "MyUIHint")] | |
public class MyEditorDescriptor : XhtmlStringEditorDescriptor | |
{ | |
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes) | |
{ | |
base.ModifyMetadata(metadata, attributes); | |
KeyValuePair<string, object> tinyMceSettings = metadata.EditorConfiguration.FirstOrDefault(x => x.Key == "settings"); | |
var dictionary = tinyMceSettings.Value as Dictionary<string,object>; | |
if (dictionary != null) |
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
[Display] | |
[UIHint("MyUIHint")] | |
public virtual XhtmlString SexyTextArea { 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 = "6CA27C21-FF6C-425F-A87D-1C7E4BE26AA8", AvailableInEditMode = true)] | |
public class Review : ContentData, IContent | |
{ | |
public virtual int Rating { get; set; } | |
public virtual string ProductNumber { get; set; } | |
[BackingType(typeof(PropertyLongString))] | |
public virtual string Text { get; set; } | |
public virtual string UserDisplayName { get; set; } | |
//IContent implementation |