Hi Steve, Here is a blog post that explains how to add custom payment provider. Some payment providers already ship with Sitefinity Ecommerce (Authorize.Net, PayPal PayFlow, SagePay). Greetings, Stanislav Velikov the Telerik team
Hello Stevev, Thank you for contacting support. I apologize for the delay in getting back you. I was consulting with some of the developers about a workaround for donations. We will be adding a donations module in a future release but I do have a workaround for you to use now. I have included a video and attached a code sample that shows how you would setup donations. We are using an external template based on the default Product Detail View page. This custom template has a donations textbox implemented and you can modify it per your requirements. I also have submitted a feature request on your behalf. I am sorry for any inconvenience this causes you. Please do not hesitate to let us know if you have anymore questions or concerns. All the best,
Hi Grace, I've played around with the sample code you provided and everything works fine until you try editing items in the shopping cart. Updating the cart causes the donation item subtotals to revert to thier original values. For instance, the shopper adds a donation item and enters an amount of $500. Next they add a tee shirt to the cart. Looking at their cart they decide to change the quantity of the tee shirt to 2 and click the update button. The result: the tee shirt item quantity is updated but the donation item reverts to $0 (or whatever the item's real product price is). I have attached a couple of screenshots. Any thoughts on how we might workaround this? Thanks -- Steve
My apologies for inconvenience this issue has caused. I am currently working with a developer to come up with a possible workaround. I will let you know as soon as possible the outcome. All the best,
public
static
bool
AddDonation(
decimal
donationAmount,
string
donationType)
productSKU =
"DON-0000-0001"
;
var ordersManager = OrdersManager.GetManager();
var catManager = CatalogManager.GetManager();
result =
false
Product product = catManager.GetProduct(productSKU);
if
(product ==
null
)
return
try
product.Price = donationAmount;
(donationType.Length > 0)
product.Description =
.Format(
"Donation: 0"
, donationType);
CartOrder shoppingCart = GetShoppingCartForUser(ordersManager);
CartDetail cartDetail =
List<CartDetail> donationItems = shoppingCart.Details.Where(d => d.ProductId == product.Id).ToList();
(donationItems !=
&& donationItems.Count > 0)
cartDetail = donationItems[0];
else
cartDetail = shoppingCart.Details.Where(d => d.ProductId == product.Id).SingleOrDefault();
(cartDetail !=
newPrice = cartDetail.Price + donationAmount;
cartDetail.Price = newPrice;
true
shoppingCart.Currency = Config.Get<EcommerceConfig>().DefaultCurrency;
//ordersManager.AddToCart(shoppingCart, product, qty);
OptionsDetails optionsDetails =
new
OptionsDetails();
optionsDetails.Sku = productSKU;
ordersManager.AddToCart(shoppingCart, product, optionsDetails, 1);
(result)
ordersManager.SaveChanges();
result;
catch
(Exception ex)
throw
InvalidOperationException(Res.Get<OrdersResources>(
"NotAddedToCart"
));
CartOrder GetShoppingCartForUser(OrdersManager ordersManager)
Guid shoppingCartId = GetShoppingCartId();
CartOrder shoppingCart =
// If the shopping cart ID is empty, we need to create a new cookie
(shoppingCartId == Guid.Empty)
shoppingCart = ordersManager.CreateCartOrder();
shoppingCartId = shoppingCart.Id;
HttpCookie shoppingCartCookie = shoppingCartCookie =
HttpCookie(EcommerceConstants.OrdersConstants.ShoppingCartIdCookieName);
//create a new shopping cart cookie
DateTime now = DateTime.Now;
// Set the cookie value.
shoppingCartCookie.Value = shoppingCartId.ToString();
// Set the cookie expiration date.
shoppingCartCookie.Expires = now.AddMonths(1);
// Add the cookie.
HttpContext.Current.Response.Cookies.Add(shoppingCartCookie);
shoppingCart = ordersManager.TryGetCartOrder(shoppingCartId);
(shoppingCart ==
shoppingCartId = Guid.NewGuid();
shoppingCart = ordersManager.CreateCartOrder(shoppingCartId,
);
shoppingCart;
Guid GetShoppingCartId()
HttpCookie shoppingCartCookie = HttpContext.Current.Request.Cookies[EcommerceConstants.OrdersConstants.ShoppingCartIdCookieName];
(shoppingCartCookie ==
||
.IsNullOrWhiteSpace(shoppingCartCookie.Value))
Guid.Empty;
(!shoppingCartCookie.Value.IsGuid())
InvalidOperationException(
"cartOrderId string cannot be parsed as a GUID; please provide a valid cartOrderId value."
Guid(shoppingCartCookie.Value);