Add location name to shipping
This commit is contained in:
parent
503f180094
commit
a67cec91cf
|
|
@ -51,6 +51,7 @@ class LocationData extends AbstractService
|
|||
{
|
||||
return [
|
||||
// Business Address (from business location or client default)
|
||||
'location_name' => $this->getLocationName(),
|
||||
'address' => $this->getBusinessAddress(),
|
||||
'address1' => $this->getBusinessAddress1(),
|
||||
'address2' => $this->getBusinessAddress2(),
|
||||
|
|
@ -62,6 +63,7 @@ class LocationData extends AbstractService
|
|||
'country_code' => $this->getBusinessCountryCode(),
|
||||
|
||||
// Shipping Address (from shipping location or client default)
|
||||
'shipping_location_name' => $this->getShippingLocationName(),
|
||||
'shipping_address' => $this->getShippingAddress(),
|
||||
'shipping_address1' => $this->getShippingAddress1(),
|
||||
'shipping_address2' => $this->getShippingAddress2(),
|
||||
|
|
@ -75,6 +77,16 @@ class LocationData extends AbstractService
|
|||
];
|
||||
}
|
||||
|
||||
private function getLocationName(): string
|
||||
{
|
||||
return $this->businessLocation ? $this->businessLocation->name : '';
|
||||
}
|
||||
|
||||
private function getShippingLocationName(): string
|
||||
{
|
||||
return $this->shippingLocation ? $this->shippingLocation->name : '';
|
||||
}
|
||||
|
||||
private function getBusinessCountry(): ?Country
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1857,6 +1857,7 @@ class PdfBuilder
|
|||
|
||||
$elements = [
|
||||
['element' => 'div', 'content' => ctrans('texts.shipping_address'), 'properties' => ['data-ref' => 'shipping_address-label', 'style' => 'font-weight: bold; text-transform: uppercase']],
|
||||
['element' => 'div', 'content' => $this->service->html_variables['values']['$client.shipping_location_name'], 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_location_name']],
|
||||
['element' => 'div', 'content' => $this->service->html_variables['values']['$client.shipping_address1'], 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address1']],
|
||||
['element' => 'div', 'content' => $this->service->html_variables['values']['$client.shipping_address2'], 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address2']],
|
||||
['element' => 'div', 'content' => "{$this->service->html_variables['values']['$client.shipping_city']} {$this->service->html_variables['values']['$client.shipping_state']} {$this->service->html_variables['values']['$client.shipping_postal_code']}", 'properties' => ['data-ref' => 'shipping_address-client.city_state_postal']],
|
||||
|
|
|
|||
|
|
@ -506,6 +506,7 @@ class HtmlEngine
|
|||
$data['$client.billing_postal_code'] = &$data['$client.postal_code'];
|
||||
$data['$client.billing_country'] = &$data['$client.country'];
|
||||
|
||||
$data['$client.shipping_location_name'] = ['value' => $locationData['shipping_location_name'], 'label' => ctrans('texts.shipping_location_name')];
|
||||
$data['$client.shipping_address'] = ['value' => $locationData['shipping_address'], 'label' => ctrans('texts.shipping_address')];
|
||||
$data['$client.shipping_address1'] = ['value' => $locationData['shipping_address1'], 'label' => ctrans('texts.shipping_address1')];
|
||||
$data['$client.shipping_address2'] = ['value' => $locationData['shipping_address2'], 'label' => ctrans('texts.shipping_address2')];
|
||||
|
|
|
|||
Loading…
Reference in New Issue