Note :
DSC has failed to provide a solution for navigation on continue shopping button. Usually the button should lead customer to other products or other categories for more shopping. Instead of that continue shopping just goes to the product detal page ehich has been already added to cart.
Solution:
We need to keep track of last URL before the item adding to cart.
1 - I created a static variable in AddToCartButton resource. This is may target page and then
2- Make refernce to this target from source page when It is called
1- On Store/ProdutSummary/AddtoCartButton.ascx.cs
Add the codes
public partial class Store_ProductSummary_AddToCartButton : ProductSummaryUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
UrlString = Request.Url.AbsoluteUri.ToString();
}
static string UrlString = "";
public String MostRecentUrl
{
get { return UrlString; }
}
}
2- On Store/ItemAddedToCart.ascx
Add this Line:
<%@ Reference Control="/Store/ProductSummary/AddToCartButton.ascx" %>
3- On Store/ItemAddedToCart.ascx.cs
Replace Commented code this New code:
ProductInCart1.LastAddedCartItem = cartItem;
Store_ProductSummary_AddToCartButton a = new Store_ProductSummary_AddToCartButton();
btnContinueShopping.OnClientClick = string.Format("window.location.href='{0}';return false;", a.MostRecentUrl);
//btnContinueShopping.OnClientClick = string.Format("window.location.href='{0}';return false;", null == Request.UrlReferrer ? cartItem.Product.AbsoluteUrl : Request.UrlReferrer.AbsoluteUri);
|