About new field for adding customer attributes

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

I test new feature for adding additional custumer fields. It rocks, really useful!
My problem is that I saw it is stored in db as a generic attribute, as xml value
<Attributes><CustomerAttribute ID="1"><CustomerAttributeValue><Value>MyValue</Value></CustomerAttributeValue></CustomerAttribute></Attributes>

I now want to add the attribute in each pdf I generate when placing an order. Like, for example:
if (_addressSettings.PhoneEnabled)
                    cell.AddElement(new Paragraph("   " + String.Format(_localizationService.GetResource("PDFInvoice.Phone", lang.Id), order.BillingAddress.PhoneNumber), font));


Can you help me to use new attribute value when generating pdf orders?
Thanks
10 yıl önce
See  \Presentation\Nop.Web\Controllers\CustomerController.cs
method PrepareCustomerInfoModel
#region Custom customer attributes
10 yıl önce
I see this method set the property.
But how I can set this property to be shown, for example, in billing info when buying or in pdf order details sent by mail?
10 yıl önce
I see this method set the property.
But how I can set this property to be shown, for example, in billing info when buying or in pdf order details sent by mail?
6 yıl önce
Hello, I have same issue because I need to print at the invoice some custom customer attributes. With following code I got those custom attributes:
var customer = _workContext.CurrentCustomer;
                var selectedCustomerAttributes = customer.GetAttribute<string>("CustomCustomerAttributes");

Then I got to the section you mentioned before:
See  \Presentation\Nop.Web\Controllers\CustomerController.cs
method PrepareCustomerInfoModel
#region Custom customer attributes

and code in this section is:
//custom customer attributes
            var customAttributes = PrepareCustomCustomerAttributes(customer, overrideCustomCustomerAttributesXml);
            customAttributes.ForEach(model.CustomerAttributes.Add);

In PdfService.cs I just can not reference PrepareCustomCustomerAttributes, so, how can I do to get those custom customer attributes to print them in the invoice?

Thanks in advance,

Regards,

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