0

I added to checkout custom fields following this guide, named 'customer_pec' and 'customer_recipientcode'. For each order I save the data in quote and in quote_address tables

Now I want to add the same fields on Admin side in Order view page.

Now I want to to this (if possible): add my new custom fields under "billing address" and make them editable.

I tried to add in Customer settings -> Address Templates->HTML view the code suggested by the comments below:

{{depend customer_pec}}<br /> PEC: {{var customer_pec}}{{/depend}} 

then refresh cache, but I'm still not able to display the fields.

Edit: since I'm still stuck on this, I checked my code. I re-opened the guide and added several features including the new fields in sales_order_grid.xml:

<column name ="fe_data" class="Fattura24\AppFatturazione\Ui\Component\Listing\Columns\Column\FEData"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Dati FE</item> <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">text</item> <item name="align" xsi:type="string">left</item> </item> </argument> </column> 

Of course I added all needed classes and templates to do this. I ran php bin/magento cache:flush but at the moment I get a blank page 'Http 500 server error' and nothing more in sales->order view.

Any debugging tool, any suggestion? Thanks.

1 Answer 1

1

https://drops.meetanshi.com/8DaaOk

you need to add your variable in this address template to add your custom variable to billing address

8
  • I tried to add in Address Templates strings like these: {{var customer_pec}}, {{var customer_recipientcode}} (Text one line - store view) and these: {{depend customer_recipientcode_id}}<br />Codice Destinatario: {{var customer_recipientcode_id}}{{/depend}} {{depend customer_pec_id}}<br />PEC: {{var customer_pec_id}}{{/depend}} (HTML - store view), then ran php bin/magento cache:flush and php bin/magento indexer:reindex but I'm not able to display new fields. Commented Aug 7, 2019 at 12:25
  • you add this in which field? Commented Aug 7, 2019 at 12:26
  • you can simple add first something like heeloo and check that it display over there of not Commented Aug 7, 2019 at 12:27
  • Now I'm able to display 'hello', but I want to retrieve data from customer_pec and customer_recipientcode input fields if customer enters something in these fields during checkout process. I save these data in quote and in quote_address tables. Actually I added these two fields in my custom checkout process, so I'd like to add the same fields in admin side, in billing address form Commented Aug 7, 2019 at 13:10
  • 1
    now you need to pass the variable name instead of hello and check , if value exist than it display Commented Aug 8, 2019 at 5:00

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.