Total Posts:
1794
Karma:
14506
Joined:
10/7/2009
Location:
United Kingdom
hi, once you make the change to modules/checkoutconfirm.ascx you have to rebuild nopcommercestore
Total Posts:
91
Karma:
503
Joined:
2/6/2010
Location:
Australia
I did that but i still keep getting that error message. When i revert back to the original code everything works fine. Like you i need my customers to agree to terms and conditions.(dont want to get sued for copyright). By the way does it makes any difference if my file says checkoutconfirm.aspx not .ascx?
Total Posts:
1794
Karma:
14506
Joined:
10/7/2009
Location:
United Kingdom
lol, yes, its the wrong file you need to open the folder modules to find the checkoutconfirm.ascx and checkoutconfirm.ascx.cs let us know how you get on - hayden
Total Posts:
91
Karma:
503
Joined:
2/6/2010
Location:
Australia
still no good. Not sure what i am doing wrong. i used microsoft web installer and maybe the version i downloaded is the no source version. I also wanted to add the ability to attach a photo or jpeg file to the order but looks as though its going to take me a while to work this out. thanks for trying
Total Posts:
1794
Karma:
14506
Joined:
10/7/2009
Location:
United Kingdom
this should still work with no source version here is how i implemented it in 1.5, with mikes instructions - i have posted the entire pages, so you can delete all the existing and paste the complete code conditionspopup.aspx is a separate page i created to show the topic contents of conditions topic ( to test the checkbox, you could just temporarily replace <%=Page.ResolveUrl("~/ConditionsPopup.aspx")%> with another existing page eg <%=Page.ResolveUrl("~/AboutUs.aspx")%> this way we can get your checkbox working first ! 1) checkoutconfirm.ascx <%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Modules.CheckoutConfirmControl" CodeBehind="CheckoutConfirm.ascx.cs" %> <div class="checkout-data"> <div class="confirm-order"> <div class="select-button"> <asp:Button runat="server" ID="btnNextStep" Text="<% $NopResources:Checkout.ConfirmButton %>" OnClick="btnNextStep_Click" CssClass="confirmordernextstepbutton" ValidationGroup="CheckoutConfirm" /> <!-- --> <asp:CheckBox ID="chkbox" Text=" " runat="server" /> tick to accept <a href="<%=Page.ResolveUrl("~/ConditionsPopup.aspx")%>" target="_blank" >terms and conditions </a>. <asp:Label runat="server" ID="lblError" ForeColor="Red"></asp:Label> </div> <div class="clear"> </div> <div class="error-block"> <div class="message-error"> <asp:Literal runat="server" ID="lConfirmOrderError" EnableViewState="false"></asp:Literal> </div> </div> </div> </div> ============================================================================= 1) checkoutconfirm.ascx .cs using System; using System.Collections; using System.Configuration; using System.Data; using System.Text; using System.Threading; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using NopSolutions.NopCommerce.BusinessLogic; using NopSolutions.NopCommerce.BusinessLogic.Audit; using NopSolutions.NopCommerce.BusinessLogic.CustomerManagement; using NopSolutions.NopCommerce.BusinessLogic.Orders; using NopSolutions.NopCommerce.BusinessLogic.Payment; using NopSolutions.NopCommerce.BusinessLogic.SEO; using NopSolutions.NopCommerce.BusinessLogic.Shipping; using NopSolutions.NopCommerce.Common.Utils; namespace NopSolutions.NopCommerce.Web.Modules { public partial class CheckoutConfirmControl : BaseNopUserControl { protected CheckoutStepChangedEventHandler handler; protected ShoppingCart cart = null; protected void btnNextStep_Click(object sender, EventArgs e) { if (Page.IsValid) { if (chkbox.Checked == false) { lblError.Text = GetLocaleResourceString("Checkout.AcceptTerms.Error"); } else try { var paymentInfo = this.PaymentInfo; if (paymentInfo == null) { var args1 = new CheckoutStepEventArgs() { OrderConfirmed = false }; OnCheckoutStepChanged(args1); if (!this.OnePageCheckout) { Response.Redirect("~/CheckoutPaymentInfo.aspx"); } else { return; } } paymentInfo.BillingAddress = NopContext.Current.User.BillingAddress; paymentInfo.ShippingAddress = NopContext.Current.User.ShippingAddress; paymentInfo.CustomerLanguage = NopContext.Current.WorkingLanguage; paymentInfo.CustomerCurrency = NopContext.Current.WorkingCurrency; int orderID = 0; string result = OrderManager.PlaceOrder(paymentInfo, NopContext.Current.User, out orderID); this.PaymentInfo = null; var order = OrderManager.GetOrderByID(orderID); if (!String.IsNullOrEmpty(result)) { lConfirmOrderError.Text = Server.HtmlEncode(result); return; } else { PaymentManager.PostProcessPayment(order); } var args2 = new CheckoutStepEventArgs() { OrderConfirmed = true }; OnCheckoutStepChanged(args2); if (!this.OnePageCheckout) Response.Redirect("~/CheckoutCompleted.aspx"); } catch (Exception exc) { LogManager.InsertLog(LogTypeEnum.OrderError, exc.Message, exc); lConfirmOrderError.Text = Server.HtmlEncode(exc.ToString()); } } } protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = SEOHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } if (Cart.Count == 0) Response.Redirect("~/ShoppingCart.aspx"); } protected override void OnPreRender(EventArgs e) { this.btnNextStep.Attributes.Add("onclick", "this.disabled = true;" + Page.ClientScript.GetPostBackEventReference(this.btnNextStep, "")); base.OnPreRender(e); } protected virtual void OnCheckoutStepChanged(CheckoutStepEventArgs e) { if (handler != null) { handler(this, e); } } public void BindData() { } public event CheckoutStepChangedEventHandler CheckoutStepChanged { add { handler += value; } remove { handler -= value; } } protected PaymentInfo PaymentInfo { get { if (this.Session["OrderPaymentInfo"] != null) return (PaymentInfo)(this.Session["OrderPaymentInfo"]); return null; } set { this.Session["OrderPaymentInfo"] = value; } } public ShoppingCart Cart { get { if (cart == null) { cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); } return cart; } } public bool OnePageCheckout { get { if (ViewState["OnePageCheckout"] != null) return (bool)ViewState["OnePageCheckout"]; return false; } set { ViewState["OnePageCheckout"] = value; } } } } ==================================================================== you need to rebuild before trying let us know how you get on. - hayden .
Total Posts:
91
Karma:
503
Joined:
2/6/2010
Location:
Australia
Bingo problem solved. thanks very much
Total Posts:
91
Karma:
503
Joined:
2/6/2010
Location:
Australia
after getting all excited now the order goes through even though i havent ticked the box. oh well will keep trying
Total Posts:
1794
Karma:
14506
Joined:
10/7/2009
Location:
United Kingdom
did you recompile after altering the codebehind you have to rebuild the solution after changing the c#
Total Posts:
91
Karma:
503
Joined:
2/6/2010
Location:
Australia
yes i did after each time of trying. I notice after after setting a hyper link on the accept terms the confirm button doesnt work. Oh well will keep trying.
Total Posts:
16619
Karma:
155940
Joined:
10/22/2008
Location:
Armenia
We have already implemented this option. It'll be available in the next release