public function getFormFields(Order $order)
{
$fields = parent::getFormFields($order);
if ($existingaddressfields = $this->getExistingAddressFields()) {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.min.js');
Requirements::javascript(SHOP_DIR . '/javascript/CheckoutPage.js');
// add the fields for a new address after the dropdown field
$existingaddressfields->merge($fields);
// group under a composite field (invisible by default) so we
// easily know which fields to show/hide
$label = _t("Address.{$this->addresstype}Address", "{$this->addresstype} Address");
return FieldList::create(CompositeField::create($existingaddressfields)->addExtraClass('hasExistingValues')->setLegend($label)->setTag(Config::inst()->get('AddressBookCheckoutComponent', 'composite_field_tag')));
}
return $fields;
}