Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
155 stars 153 forks source link

Support for Orders Product Customization added #463

Closed sanctusmob closed 1 year ago

sanctusmob commented 1 year ago

After you get the order details you can loop to get customization if exists like this

foreach (Bukimedia.PrestaSharp.Entities.order_detail myOrderDetail in myOrderDetails)
{
    if (myOrderDetail.id_customization != null)
    {
        long lngCustomID = myOrderDetail.id_customization.Value;
        if (lngCustomID > 0)
        {
            try
            {
                Bukimedia.PrestaSharp.Entities.customization myCustomization = LibLocal.customizationFactory.Get(lngCustomID);
                foreach (Bukimedia.PrestaSharp.Entities.customized_data_text_field myCustomizedDataTextField in myCustomization.associations.customized_data_text_fields)
                {
                    Console.WriteLine(myCustomizedDataTextField.value);
                }
            }
            catch (Exception ex)
            {
                LibLocal.WriteToLog("Exception: OrderCustomization: " + ex.Message);
            }
        }
    }
}
LameuleFR commented 1 year ago

Hello @sanctusmob

Thank you for your work LGTM 🚀