Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
address.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
12 if ($block->getIsShipping()):
13  $_fieldsContainerId = 'order-shipping_address_fields';
14  $_addressChoiceContainerId = 'order-shipping_address_choice';
15  ?>
16  <script>
17  require(["Magento_Sales/order/create/form"], function(){
18 
19  order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>';
20  order.setAddresses(<?= /* @escapeNotVerified */ $block->getAddressCollectionJson() ?>);
21 
22  });
23  </script>
24  <?php
25 else:
26  $_fieldsContainerId = 'order-billing_address_fields';
27  $_addressChoiceContainerId = 'order-billing_address_choice';
28  ?>
29  <script>
30  require(["Magento_Sales/order/create/form"], function(){
31  order.billingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>';
32  });
33  </script>
34  <?php
35 endif; ?>
36 
37 <fieldset class="admin__fieldset">
38  <legend class="admin__legend <?= /* @escapeNotVerified */ $block->getHeaderCssClass() ?>">
39  <span><?= /* @escapeNotVerified */ $block->getHeaderText() ?></span>
40  </legend><br>
41 
42  <fieldset id="<?= /* @escapeNotVerified */ $_addressChoiceContainerId ?>" class="admin__fieldset order-choose-address">
43  <?php if ($block->getIsShipping()): ?>
44  <div class="admin__field admin__field-option admin__field-shipping-same-as-billing">
45  <input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing"
46  onclick="order.setShippingAsBilling(this.checked)" class="admin__control-checkbox"
47  <?php if ($block->getIsAsBilling()): ?>checked<?php endif; ?> />
48  <label for="order-shipping_same_as_billing" class="admin__field-label">
49  <?= /* @escapeNotVerified */ __('Same As Billing Address') ?>
50  </label>
51  </div>
52  <?php endif; ?>
53  <div class="admin__field admin__field-select-from-existing-address">
54  <label class="admin__field-label"><?= /* @escapeNotVerified */ __('Select from existing customer addresses:') ?></label>
55  <?php $_id = $block->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?>
56  <div class="admin__field-control">
57  <select id="<?= /* @escapeNotVerified */ $_id ?>"
58  name="<?= $block->getForm()->getHtmlNamePrefix() ?>[customer_address_id]"
59  onchange="order.selectAddress(this, '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>')"
60  class="admin__control-select">
61  <option value=""><?= /* @escapeNotVerified */ __('Add New Address') ?></option>
62  <?php foreach ($block->getAddressCollection() as $_address): ?>
63  <?php //if($block->getAddressAsString($_address)!=$block->getAddressAsString($block->getAddress())): ?>
64  <option
65  value="<?= /* @escapeNotVerified */ $_address->getId() ?>"<?php if ($_address->getId() == $block->getAddressId()): ?> selected="selected"<?php endif; ?>>
66  <?= /* @escapeNotVerified */ $block->getAddressAsString($_address) ?>
67  </option>
68  <?php //endif; ?>
69  <?php endforeach; ?>
70  </select>
71  </div>
72  </div>
73  </fieldset>
74 
75  <div class="order-address admin__fieldset" id="<?= /* @escapeNotVerified */ $_fieldsContainerId ?>">
76  <?= $block->getForm()->toHtml() ?>
77 
78  <div class="admin__field admin__field-option order-save-in-address-book">
79  <input name="<?= $block->getForm()->getHtmlNamePrefix() ?>[save_in_address_book]" type="checkbox"
80  id="<?= $block->getForm()->getHtmlIdPrefix() ?>save_in_address_book"
81  value="1"
82  <?php if (!$block->getDontSaveInAddressBook() && $block->getAddress()->getSaveInAddressBook()): ?> checked="checked"<?php endif; ?>
83  class="admin__control-checkbox"/>
84  <label for="<?= $block->getForm()->getHtmlIdPrefix() ?>save_in_address_book"
85  class="admin__field-label"><?= /* @escapeNotVerified */ __('Save in address book') ?></label>
86  </div>
87  </div>
88  <?php $hideElement = 'address-' . ($block->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?>
89  <div style="display: none;" id="<?= /* @escapeNotVerified */ $hideElement ?>" class="order-methods-overlay">
90  <span><?= /* @escapeNotVerified */ __('You don\'t need to select a shipping address.') ?></span>
91  </div>
92 
93  <script>
94  require(["Magento_Sales/order/create/form"], function(){
95  order.bindAddressFields('<?= /* @escapeNotVerified */ $_fieldsContainerId ?>');
96  order.bindAddressFields('<?= /* @escapeNotVerified */ $_addressChoiceContainerId ?>');
97  <?php if ($block->getIsShipping() && $block->getIsAsBilling()): ?>
98  order.disableShippingAddress(true);
99  <?php endif; ?>
100  });
101  </script>
102 </fieldset>
if($block->getIsShipping()) $_addressChoiceContainerId
Definition: address.phtml:14
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
__()
Definition: __.php:13
$block
Definition: block.php:8
endif
Definition: address.phtml:31
endforeach
Definition: address.phtml:66
if(! $block->getDontSaveInAddressBook() && $block->getAddress() ->getSaveInAddressBook()) $hideElement
Definition: address.phtml:88