November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If you load your purchase order, is the billing address there. how does it look like in data?
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
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?
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).
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?
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 ...
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.
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.
One better option is to file a support ticket so we can properly look into it :).
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?