Skip to content

Commit 7dc9876

Browse files
author
bkollmann
authored
Add customer language - #78 (#211)
* add customer language and pass it to mailchimp api - #78 * add customer language and pass it to mailchimp api - #78 * add customer language and pass it to mailchimp api - #78 * add customer language and pass it to mailchimp api - #78 * remove type hint
1 parent 7658c42 commit 7dc9876

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

doc/02_Installation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Following options to prepare the customer class are available:
5050
* `zip`: input field
5151
* `city`: input field
5252
* `countryCode`: country selection
53+
* `customerLanguage`: language selection
5354
* `email`: email field
5455
* `phone`: input field
5556
* `manualSegments`: objects relation to `CustomerSegments` or objects with metadata to `CustomerSegments` with

install/class_source/optional/class_Customer_export.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,35 @@
215215
"visibleGridView": false,
216216
"visibleSearch": false,
217217
"defaultValueGenerator": ""
218+
},
219+
{
220+
"fieldtype": "language",
221+
"onlySystemLanguages": false,
222+
"options": null,
223+
"width": "",
224+
"defaultValue": null,
225+
"optionsProviderClass": null,
226+
"optionsProviderData": null,
227+
"queryColumnType": "varchar",
228+
"columnType": "varchar",
229+
"columnLength": 190,
230+
"phpdocType": "string",
231+
"dynamicOptions": false,
232+
"name": "customerLanguage",
233+
"title": "Customer Language",
234+
"tooltip": "",
235+
"mandatory": false,
236+
"noteditable": false,
237+
"index": false,
238+
"locked": false,
239+
"style": "",
240+
"permissions": null,
241+
"datatype": "data",
242+
"relationType": false,
243+
"invisible": false,
244+
"visibleGridView": false,
245+
"visibleSearch": false,
246+
"defaultValueGenerator": ""
218247
}
219248
],
220249
"locked": false

src/Model/CustomerInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ public function getPhone(): ?string;
164164
*/
165165
public function setPhone(?string $phone);
166166

167+
/**
168+
* @return string|null
169+
*/
170+
public function getCustomerLanguage();
171+
167172
/**
168173
* @return CustomerSegmentInterface[]|ObjectMetadata[]
169174
*/

src/Model/Traits/CustomerTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,8 @@ public function needsExportByNewsletterProviderHandler(NewsletterProviderHandler
116116
{
117117
return $this->getPublished() && $this->getActive();
118118
}
119+
120+
public function getCustomerLanguage() {
121+
return null;
122+
}
119123
}

src/Newsletter/ProviderHandler/Mailchimp.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ public function buildEntry(MailchimpAwareCustomerInterface $customer)
566566
'merge_fields' => $mergeFields
567567
];
568568

569+
if ($language = $customer->getCustomerLanguage()) {
570+
$entry['language'] = $language;
571+
}
572+
569573
if ($interests = $this->buildCustomerSegmentData($customer)) {
570574
$result['interests'] = $interests;
571575
}

0 commit comments

Comments
 (0)