Hi guys,I assume this is not necessarily a problem of Kentico, but maybe someone can kick me in the right direction. My cart should look like this:The transformation code looks like below.
In principle this works, I can increasse / decrease the number of units, I can add more items and I can remove items, but if the item to remove is not the last one in the list the item is removed from the database but not from the view.Any hints?@div class=@cart-item@@
@div class=@title-left@@@%# GetZiProductName(SKU.SKUID) %@@/div@
@div class=@product-thumb@% if ((SKU.SKUName.StartsWith(@MF@)) || (SKU.SKUName.StartsWith(@HD@))) { %@ halfsize @% } %@@@
@%# IfEmpty(SKU.SKUImagePath, OptionIcon(Eval@int@(@SKU.SKUID@)), @@a href='@ + GetSKUUrl() + @'@@ + ResponsiveImage(SKU.SKUImagePath, SKU.SKUName, @480@) + @@/a@@) %@
@asp:UpdatePanel ID=@updPanel0@ runat=@server@ UpdateMode=@Always@@
@ContentTemplate@
@div class='buttons'@
@asp:Button ID=@Button0@ runat=@server@ oncommand=@Button1_Click@ Text=@@ CssClass=@remove@ CommandName='@%# Eval(@SKU.SKUID@) %@' CommandArgument='1' /@
@/div@
@/ContentTemplate@
@/asp:UpdatePanel@
@/div@
@asp:UpdatePanel ID=@updPanel@ runat=@server@ UpdateMode=@Always@@
@ContentTemplate@
@div class=@info@@
@div class=@title@@@%# GetZiProductName(SKU.SKUID) %@@/div@
@div class=@cnt@@
@asp:Button ID=@Button1@ runat=@server@ oncommand=@Button1_Click@ Text=@@ CssClass=@dec@ CommandName='@%# Eval(@SKU.SKUID@) %@' CommandArgument='@%# GetCartUnits(Eval@int@(@SKU.SKUID@)) %@' /@
@div class=@number@@@div class=@n@@@%# GetCartUnits(Eval@int@(@SKU.SKUID@)) %@@/div@@/div@
@asp:Button ID=@Button2@ runat=@server@ oncommand=@Button2_Click@ Text=@@ CssClass=@inc@ CommandName='@%# Eval(@SKU.SKUID@) %@' CommandArgument='@%# GetCartUnits(Eval@int@(@SKU.SKUID@)) %@' /@
@/div@
@div class=@price@@
@div class=@price-part@@
@% if(EvalDouble(@UnitTotalPriceIncludingOptions@) @ 0) { %@
@div class=@op op-x@@x@/div@@div class=@price-single@@@%# FormatPrice(EvalDouble(@UnitTotalPriceIncludingOptions@))%@@/div@@%=cartitemunitprice%@
@% } else { %@
@div class=@price-none@@Price on request@/div@
@% } %@
@/div@
@/div@
@/div@
@/ContentTemplate@
@/asp:UpdatePanel@
@/div@
@script runat=@server@@
protected string cartitemunitprice {
get {
if (GetCartUnits(Eval@int@(@SKU.SKUID@)) @ 1) {
return @@div class='price-part'@@div class='op op-eq'@=@/div@@div class='price-total'@@ + FormatPrice(EvalDouble(@UnitTotalPriceIncludingOptions@)*GetCartUnits(Eval@int@(@SKU.SKUID@))) + @@/div@@/div@@;
} else {
return String.Empty;
}
}
set {
ViewState[@cartitemunitprice@] = value;
}
}
protected void Button1_Click(object sender, CommandEventArgs e)
{
ZiShoppingCartUpdate.RemoveItem(sender, e, e.CommandName.ToString(), e.CommandArgument.ToString());
}
protected void Button2_Click(object sender, CommandEventArgs e)
{
ZiShoppingCartUpdate.AddItem(sender, e, e.CommandName.ToString(), e.CommandArgument.ToString());
}
@/script@
↧