Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Billing info not showing up on order in Commerce Manager

Vote:
 

Hi

I set the shipping and billing info on my cart.

This is an example of how I set billing info:

var orderAddress = _orderGroupFactory.CreateOrderAddress(cart);

orderAddress.Id = "billing";
orderAddress.Email = "some@email.com";
orderAddress.FirstName = "John";
orderAddress.LastName = "Doe";

cart.GetFirstForm().Payments.First().BillingAddress = orderAddress;

To finalize this I save the cart.

I can retrieve billing info like:

var billingAddress = cart.GetFirstForm()?.Payments?.FirstOrDefault()?.BillingAddress;

var email = billingAddress?.Email; // This gives me the email "some@email.com"
...

Eventually I save the cart as a purchase order.

However when I go to Commerce Manager to look at an order, the "Edit Billing Address" button is disabled, and I don't see the billing info anywhere (except for the id "billing" appearing in Name).

What am I missing here?

#196585
Edited, Sep 05, 2018 8:20
Vote:
 

If you load your purchase order, is the billing address there. how does it look like in data? 

#196586
Sep 05, 2018 8:39
Vote:
 

If I run this code to first retrieve the purchaseorder, and then get the billing address:

var purchaseOrder = _orderRepository.Load(orderReference) as IPurchaseOrder;

var billingAddress = purchaseOrder.GetFirstForm().Payments.First().BillingAddress;

then, this is what the billingAddress contains (printed from Visual Studio's Immediate Window):

? billingAddress
{Mediachase.Commerce.Orders.OrderAddress}
City: ""
ConnectionHandler: {EPiServer.ServiceLocation.Injected<Mediachase.Data.Provider.IConnectionStringHandler>}
CountryCode: ""
CountryName: ""
Created: {05-09-2018 07:13:56}
CreatorId: null
DaytimePhoneNumber: ""
DisableSync: false
Email: "some@test.dk"
EveningPhoneNumber: ""
FaxNumber: ""
FieldStorage: Count = 0
FirstName: "John"
Id: 111
LastName: "Doe"
Line1: ""
Line2: ""
MetaClass: {Mediachase.MetaDataPlus.Configurator.MetaClass}
Modified: {05-09-2018 07:13:57}
ModifierId: null
Name: "billing"
ObjectState: Unchanged
OrderGroupAddressId: 111
OrderGroupId: 96
Organization: ""
Parent: {Mediachase.Commerce.Orders.PurchaseOrder}
PostalCode: ""
RegionCode: ""
RegionName: ""
State: ""
SystemFieldStorage: Count = 19

#196588
Edited, Sep 05, 2018 9:20
Vote:
 

My Commerce is version 11.8.3 by the way.

#196589
Sep 05, 2018 10:28
Vote:
 

Address is actually the combination of line1, line2, city ... and you address is missing that so that's why it's empty. same goes with the phone number.

Edit billing address button is actually much ... complicated. I am having hard time understand why it is disabled. Perhaps when you add complete address information it will magically ... be enabled?

#196591
Sep 05, 2018 11:37
Vote:
 

I have tried to set the same address properties on the billing address object, as I do on the shipping object. Specfically I set these properties:

orderAddress.Id
orderAddress.Email
orderAddress.FirstName
orderAddress.LastName
orderAddress.Line1
orderAddress.PostalCode
orderAddress.City
orderAddress.CountryName

Unfortunately the Edit Billing button remains disabled (for what it's worth, the Edit Shipping button works fine).

#196593
Sep 05, 2018 12:28
Vote:
 

If in my browser I navigate to the DOM element of the Edit Billing button on the order, and remove the disabled="disabled" attribute, the button is enabled. Interestingly, if I then click the button, a popup shows billing information as expected...

Any chance you can see, in which situation the disabled="disabled" attribute is set on the button?

#196594
Edited, Sep 05, 2018 12:46
Vote:
 

That's the complicated part I mention about. there is a lot of code to check if you can. or should edit the shipping address ... 

#196596
Sep 05, 2018 12:57
Vote:
 

Actually it's not that I need to edit the billing address information on the order. It's just that I set the fields email, firstname and lastname from code on the billing address object, and I need to be able to see this information on the order in Commerce Manager. It seems that this information only is viewable if I go into the Edit Billing popup, as I showed in my first post image attachment.

But I guess manually removing the attribute Disabled="Disabled" from the DOM on the Edit Billing button can be a workaround, to get to access the billing information...although it's obviously not very user friendly.

#196597
Edited, Sep 05, 2018 13:03
Vote:
 

Editing Commerce Manager code is usually not recommended because it could result in painful upgrades if you rely on changing it too much.

Either way, I'm not sure how to solve adding custom data to the string, but I can give a suggestion on how you can control when the button is enabled.

First create an overload of the OrderbillingAddress.OnPreRender()-method (this method is what decides if the button should be enabled or disabled):

using System;
using Mediachase.Commerce.Manager.Apps.Order.CustomPrimitives;

namespace <your namespace>
{
    public class MyOrderBillingAddress : OrderBillingAddress
    {
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            btnEditAddress.Disabled = false; // Set this based on whatever you want.
        }
    }
}

Then "simply" use this control instead of the built in one in your OrderBillingAddress.ascx view in Commerce manager:

// OrderBillingAddress.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrderBillingAddress.ascx.cs" Inherits="<your namespace>.MyOrderBillingAddress" %>

You'll probably have to set some kind of restriction on when it's enabled or not because you may not want the address to be editable all the time (for example when you've processed your payments or when you don't have an address available at all), but hopefully this helps you move forward.

#196629
Sep 05, 2018 20:44
Vote:
 

Thanks Jafet, that works.

#196641
Edited, Sep 06, 2018 7:33
Vote:
 

One better option is to file a support ticket so we can properly look into it :).

#196642
Sep 06, 2018 7:36
Vote:
 

Quan Mai, I will create a support ticket, and refer to this thread. Thanks for your help so far :-)

#196647
Edited, Sep 06, 2018 7:58
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.