Announcement

Collapse
No announcement yet.

New Address Format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Address Format

    Hello everyone,

    I want to add a new format to the 'address format' menu in administration -> Settings.



    I've read the various posts on the forum but so far I haven't been able to add a new one.

    I created a new file tpl with the name 'edit-5.tpl' (/client / res / templates / fields / address)
    and changed the file address.js (/client / src / views / fields)
    but nothing happened.




    PHP Code:
     return Dep.extend({

    type'address',

    listTemplate'fields/address/detail',

    detailTemplate'fields/address/detail',

    editTemplate'fields/address/edit',

    editTemplate1'fields/address/edit-1',

    editTemplate2'fields/address/edit-2',

    editTemplate3'fields/address/edit-3',

    editTemplate4'fields/address/edit-4',

    editTemplate5'fields/address/edit-5',

    searchTemplate'fields/address/search'
    PHP Code:
     getFormattedAddress5: function () {
    var 
    postalCodeValue this.model.get(this.postalCodeField);
    var 
    streetValue this.model.get(this.streetField);
    var 
    cityValue this.model.get(this.cityField);
    var 
    stateValue this.model.get(this.stateField);
    var 
    countryValue this.model.get(this.countryField);

    var 
    html '';
    if (
    streetValue) {
    html += streetValue;
    }
    if (
    cityValue) {
    if (
    html != '') {
    html += '\n';
    }
    html += cityValue;
    }
    if (
    countryValue || stateValue || postalCodeValue) {
    if (
    html != '') {
    html += '\n';
    }
    if (
    postalCodeValue) {
    html += postalCodeValue;
    }
    if (
    stateValue) {
    if (
    postalCodeValue) {
    html += ' ';
    }
    html += stateValue;
    }
    if (
    countryValue) {
    if (
    postalCodeValue || stateValue) {
    html += ' ';
    }
    html += countryValue;
    }
    }

    return 
    html;
    }, 


    I would be very grateful if someone could help me with this problem.


    Thank you
Working...
X