Hi,
If you add product to shopping cart you are redirected to shopping cart content control. So, in Page_Load method of this control
~\CMSModules\Ecommerce\Controls\ShoppingCart\ShoppingCartContent.ascx.cs
You can use following example code to redirect back to original page:
// Try to find the Previeous page in session
string prevPage = ValidationHelper.GetString(SessionHelper.GetValue("ShoppingCartUrlReferrer"), "");
if (!String.IsNullOrEmpty(prevPage))
{
UrlHelper.Redirect(prevPage);
}
else
{
UrlHelper.Redirect(this.ShoppingCartControl.PreviousPageUrl);
}
However, then you will be redirected all the time back to the page which you have added the product from, so you will not be able to access shopping cart directly. So, you would also need to modify
~/CMSModules/Ecommerce/Controls/ProductOptions/ShoppingCartItemSelector.ascx.cs
control which is responsible for redirecting to shipping cart content control. In this control you can for example add additional query string parameter to posted URL and in shopping cart content control you will redirect back only if such query string is in current URL. In this way if someone access shopping cart, he/she will not be redirected back (since of your condition) and if someone tried to add product to the shopping cart he/she will be redirected back to the same page.
Otherwise, you need to modify
~/CMSModules/Ecommerce/Controls/ProductOptions/ShoppingCartItemSelector.ascx.cs
in such a way that it will add the products to shopping cart in code according to following
KB article.
Best regards,
Juraj Ondrus