Retrieving Billing Address ID

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 yıl önce
Hi,

We recently upgraded to 3.8 and we're trying to retrieve the billing address ID but this doesn't seem to work anymore in our template:

<input type="hidden" id="BillingAddrId" value="@WorkContext.CurrentCustomer.BillingAddress.Id.ToString()" />

Is there another option to grab the billing address ID?

Thanks for your help.

Toby
7 yıl önce
tsapusek wrote:
Hi,

We recently upgraded to 3.8 and we're trying to retrieve the billing address ID but this doesn't seem to work anymore in our template:

<input type="hidden" id="BillingAddrId" value="@WorkContext.CurrentCustomer.BillingAddress.Id.ToString()" />



Hi Toby,

Can you please let us know, on which page you've added this code?
7 yıl önce
Sure.  The page that we had this code on was "Views\ShoppingCart\OrderTotals.cshtml.

Thanks.
7 yıl önce
tsapusek wrote:
The page that we had this code on was "Views\ShoppingCart\OrderTotals.cshtml.


Refactor your view page code in this way:


@model OrderTotalsModel    
@{

  var workContext = EngineContext.Current.Resolve<IWorkContext>();

}
@using Nop.Web.Models.ShoppingCart;
@using Nop.Core.Infrastructure;
@using Nop.Core;

<div class="total-info">    
  <input type="hidden" id="BillingAddrId" value[email protected] />
   ...
     ...


However, I don't know the purpose of this, but mare sure you should consider the all scenario such as guest check out and customers those who doesn't added billing address etc..

Hope this helps!
7 yıl önce
OK - will do.  Thanks for your help.

Toby
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.