Show delivery address as default

Posted By toomuchpresha Tue 23 Jul 2013
Add to Favorites0
Author Message
toomuchpresha
 Posted Tue 23 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
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-->
<aspTongueanel ID="pnlShippingAddress" runat="server" Visible="true">
<user:CheckoutAddress ID="UC_ShippingAddress" runat="server" ErrorMessagePrefix="Shipping "
ValidationGroup="Shipping" Title="<%$ Resources: Address, FormLabel_ShippingAddress %>" />
</aspTongueanel>
</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 -->
<aspTonguelaceHolder 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>&nbsp;
<asp:TextBox ID="txtEUVAT" runat="server" EnableViewState="true" AutoPostBack="true"></asp:TextBox>
</div>
</aspTonguelaceHolder>
</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


H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites
Tue 23 Jul 2013 by toomuchpresha
Medz
 Posted Tue 23 Jul 2013
Kartris Expert

Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
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
toomuchpresha
 Posted Tue 23 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
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


H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites
toomuchpresha
 Posted Tue 23 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
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?

H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites
toomuchpresha
 Posted Tue 23 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
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


H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites
toomuchpresha
 Posted Tue 23 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
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


H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites
Medz Marked As Answer
 Posted Tue 23 Jul 2013
Kartris Expert

Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)Kartris Expert - (67,676 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
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.
toomuchpresha
 Posted Wed 24 Jul 2013
Supreme Being

Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)Supreme Being - (27,775 reputation)

Group: Forum Members
Last Active: Thu 12 May 2016
Posts: 50, Visits: 86
Thanks Medz,
That worked fine


H4 Interactive is a North Wales based Web Design and Development Agency specialising in e-commerce systems and content managed websites

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top