Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Credit Card Surcharge View modes: 
User avatar
Member
Member
James Darlow - 5/17/2011 9:21:07 PM
   
Credit Card Surcharge
Hey Guys,

So basically what I need is for there to be a %increase on the total price when a user chooses to pay by Credit Card.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 5/26/2011 7:29:09 AM
   
RE:Credit Card Surcharge
Hi,

The most suitable way to go if you need to implement surcharge requirement is to create custom evaluate shopping cart method using custom ecommerce provider and customize CustomShoppingCartInfoProvider.cs file, its EvaluateShoppingCartContent(object shoppingCart) method.

You will need to create a temporary dummy product which will not be enabled and its price will be totalPrice * 1,025 (if surcharge is 2.5%). The totalPrice is a property of shopping cart object. Then you will need to add this product to the shopping cart and EvaluateShoppingCart again. On the beginning you need to check if the dummy product is not already included in the cart (if user clicks on Next or Prev button while creating of his shopping cart). The method could look like:


                  
/// <summary>
/// Evaluates shopping cart content - calculates all taxes, discounts and subtotals.
/// </summary>
/// <param name="shoppingCart">Shopping cart object with all neccessary data for calculation.</param>
public void EvaluateShoppingCartContent(object shoppingCart)
{
// TODO: Remove dummy product if it is in a shopping cart

ShoppingCartInfoProvider.EvaluateShoppingCartContent((CMS.Ecommerce.ShoppingCartInfo)shoppingCart);

// TODO: Count price of dummy product
// TODO: Set price of dummy product
// TODO: Add dummy product to the shopping cart again

// Evaluate again
ShoppingCartInfoProvider.EvaluateShoppingCartContent((CMS.Ecommerce.ShoppingCartInfo)shoppingCart);
}


Best regards,
Ivana Tomanickova