Custom field in delivery method

Is it possible to add custom field to a delivery method?

Litium version: 6.2.2

You can add custom panels in this views that you can handle your extra field and data.

Yes, i tried that but doesn’t seem to show any extra custom field.

Here my code:
using System.Linq;
using Litium.Foundation.ModuleExtensions;
using Litium.Foundation.Modules.ECommerce.Carriers;

namespace Litium.Accelerator.Mvc.Site.ECommerce.Panels
{
public partial class DeliveryJeevesField : System.Web.UI.UserControl, IPanelData<DeliveryCarrier>
{
    private readonly string _jeevesCommentKey = "JeevesComment";

    public void InitPanelData(DeliveryCarrier value)
    {
        // Get administrator comment that is stored as additional delivery info
        var jeevesComment = value.AdditionalDeliveryInfo.FirstOrDefault(x => x.Key == _jeevesCommentKey);
        if (jeevesComment != null)
        {
            JeevesCommentTextBox.Text = jeevesComment.Value;
        }
    }

    public void SavePanel(DeliveryCarrier value)
    {
        // Save administrator comment to additional delivery info
        var jeevesComment = value.AdditionalDeliveryInfo.FirstOrDefault(x => x.Key == _jeevesCommentKey);
        if (jeevesComment != null)
        {
            jeevesComment.Value = JeevesCommentTextBox.Text;
        }
        else
        {
            value.AdditionalDeliveryInfo.Add(new AdditionalDeliveryInfoCarrier(_jeevesCommentKey, value.ID, JeevesCommentTextBox.Text));
        }
    }

}
}

image

Try to use the IPanelData<DeliveryMethodCarrier> instead of the IPanelData<DeliveryCarrier>, the DeliveryCarrier is used during order creation.

Ok, where can i save this data?

CustomData or Panels?

can i save it as DictionaryCollection?

Thanks

You can stor the information on the DeliveryMethodCarrier.CustomData this object will be serialized to json and stored with the delivery method, so all datatypes that can be converted to and from json with Json.Net can be used.

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