By toomuchpresha - Tue 23 Jul 2013
|
Hi all, on the checkout page (v2.0) the billing address shows as default and you need to uncheck the checkbox to display alternative delivery addresses.
My client needs the delivery address box to display as default and uncheck to hide it (in fact it doesnt matter whether we use check or uncheck to hide it)
I have changed the pnlShippingAddress to visible = "true" and that doesn't work. I've also tested a change in the code behind checkout.ascx.vb sub on line 210:
Protected Sub chkSameShippingAsBilling_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkSameShippingAsBilling.CheckedChanged If chkSameShippingAsBilling.Checked Then pnlShippingAddress.Visible = True RefreshShippingMethods("billing") Else pnlShippingAddress.Visible = False RefreshShippingMethods("shipping") End If
End Sub
This still doesn't work. The panel doesn't display as default.
Does anyone know why it won't display?
Here's the code for the panels:
<asp:UpdatePanel runat="server" ID="updAddresses" UpdateMode="Conditional"> <ContentTemplate> <div class="checkoutaddress"> <user:CheckoutAddress runat="server" ID="UC_BillingAddress" Title="<%$ Resources: Address, FormLabel_BillingAddress %>" ErrorMessagePrefix="Billing " ValidationGroup="Billing" EnableValidation="true" /> </div> <div class="checkoutaddress"> <!-- Shipping Address Selection/Input Control--> <aspanel ID="pnlShippingAddress" runat="server" Visible="true"> <user:CheckoutAddress ID="UC_ShippingAddress" runat="server" ErrorMessagePrefix="Shipping " ValidationGroup="Shipping" Title="<%$ Resources: Address, FormLabel_ShippingAddress %>" /> </aspanel> </div> <div class="spacer"> </div> <p> <span class="checkbox"> <asp:CheckBox ID="chkSameShippingAsBilling" runat="server" Checked="true" AutoPostBack="true" /> <asp:Label ID="lblchkSameShipping" Text="<%$ Resources: Checkout, ContentText_SameShippingAsBilling %>" runat="server" AssociatedControlID="chkSameShippingAsBilling" EnableViewState="false" /></span></p> <!-- EU VAT Number --> <asplaceHolder ID="phdEUVAT" runat="server" Visible="false"> <div class="section"> <h2> <asp:Literal ID="litEnterEUVAT" runat="server" Text="<%$ Resources: ContentText_EnterEUVat %>" EnableViewState="false" /></h2> <strong> <asp:Literal ID="litMSCode" runat="server" EnableViewState="true" /></strong> <asp:TextBox ID="txtEUVAT" runat="server" EnableViewState="true" AutoPostBack="true"></asp:TextBox> </div> </asplaceHolder> </ContentTemplate> </asp:UpdatePanel>
I've also tried to change the checkbox to checked = "false" and even removed the attribute but still it has no affect on the checkbox default state.
Any help would be much appreciated.
Many thanks
|
By Medz - Tue 23 Jul 2013
|
In addition to pnlShippingAddress, I think you also need to set UC_ShippingAddress' visible property to true. ->
pnlShippingAddress.Visible = True UC_ShippingAddress.Visible = True
chkSameShippingAsBilling's initial state is set somewhere in the Page_Load event. I think it'll be unchecked by default if you comment out this line ->
chkSameShippingAsBilling.Checked = True
|
By toomuchpresha - Tue 23 Jul 2013
|
Thanks Medz, the only chkSameShippingAsBilling.Checked = True I can find in the checkout.ascx.vb is on line 165:
If Not CurrentLoggedUser.DefaultBillingAddressID = CurrentLoggedUser.DefaultShippingAddressID Then chkSameShippingAsBilling.Checked = False pnlShippingAddress.Visible = True Else chkSameShippingAsBilling.Checked = True pnlShippingAddress.Visible = False End If
|
By toomuchpresha - Tue 23 Jul 2013
|
I've managed to get the checkbox to show unchecked on load now but the panel still isn't visible on load. It now works as I want it to when i check and uncheck after load but initial state is still hidden. Any ideas?
|
By toomuchpresha - Tue 23 Jul 2013
|
Ok, resolved. I need to change the values in the if else statement:
If Not CurrentLoggedUser.DefaultBillingAddressID = CurrentLoggedUser.DefaultShippingAddressID Then chkSameShippingAsBilling.Checked = False pnlShippingAddress.Visible = False Else 'chkSameShippingAsBilling.Checked = True pnlShippingAddress.Visible = True End If
All working.
Thanks for the help
|
By toomuchpresha - Tue 23 Jul 2013
|
Just one last thing please Medz, the label values that display on the delivery address dropdown, name, company, address. It needs to show just name.
I have commented out the following in CustomerAddress UC but it still shows the default values:
If hidDisplayType.Value = "Billing" Then lblName.Text = GetGlobalResourceObject("Address", "FormLabel_CardHolderName") lblCompany.Text = GetGlobalResourceObject("Address", "FormLabel_CardHolderCompany") lblStreetAddress.Text = GetGlobalResourceObject("Address", "FormLabel_CardHolderStreetAddress") ElseIf hidDisplayType.Value = "Shipping" Then lblName.Text = GetGlobalResourceObject("Address", "FormLabel_RecipientName") 'lblCompany.Text = GetGlobalResourceObject("Address", "FormLabel_ShippingCompany") 'lblStreetAddress.Text = GetGlobalResourceObject("Address", "FormLabel_ShippingAddress") End If
|
By Medz - Tue 23 Jul 2013
|
I haven't tried this myself but in theory this should work. Open up the file "UserControls/Front/CheckoutAddressPopup.ascx.vb" and look for the line that says ->
ddlAddresses.DataTextField = "Label"
Try to change "Label" to "FullName" and see if it does it.
|
By toomuchpresha - Wed 24 Jul 2013
|
Thanks Medz, That worked fine
|