EditView: How to customize "Copy address from left" functionality

Just want to share something I just learned.

I have a custom module similar to Accounts module.
I moved the shipping address to the left and billing address to the left (in detail and edit views).
The “copy address from left” checkbox now appears on the left side under the shipping address.

=> I want instead to have this checkbox underneath the billing address on the right side.

The solution is simple.

  • open /custom/modules/[MODULENAME]/metadata/editviewdefs.php

  • search for string “address_street” (or look for the following codeblock):
    (this would be approx what it looks like after you’ve already moved the shipping address to the left in studio)

array (
          0 => 
          array (
            'name' => 'shipping_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'shipping',
              'copy' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          1 => 
          array (
            'name' => 'billing_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          ),
          ),
        ),

Now all you have to do is move the line

'copy' => 'billing',

from the shipping_address_street block to the billing_address_street block.

Probably needs a quick rebuild for it to show up.

That’s it!

2 Likes

Thank you for giving idea.it help many people.