Skip to content

Commit

Permalink
Add customer language - #78 (#211)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bkollmann committed May 21, 2021
1 parent 7658c42 commit 7dc9876
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/02_Installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Following options to prepare the customer class are available:
* `zip`: input field
* `city`: input field
* `countryCode`: country selection
* `customerLanguage`: language selection
* `email`: email field
* `phone`: input field
* `manualSegments`: objects relation to `CustomerSegments` or objects with metadata to `CustomerSegments` with
Expand Down
29 changes: 29 additions & 0 deletions install/class_source/optional/class_Customer_export.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,35 @@
"visibleGridView": false,
"visibleSearch": false,
"defaultValueGenerator": ""
},
{
"fieldtype": "language",
"onlySystemLanguages": false,
"options": null,
"width": "",
"defaultValue": null,
"optionsProviderClass": null,
"optionsProviderData": null,
"queryColumnType": "varchar",
"columnType": "varchar",
"columnLength": 190,
"phpdocType": "string",
"dynamicOptions": false,
"name": "customerLanguage",
"title": "Customer Language",
"tooltip": "",
"mandatory": false,
"noteditable": false,
"index": false,
"locked": false,
"style": "",
"permissions": null,
"datatype": "data",
"relationType": false,
"invisible": false,
"visibleGridView": false,
"visibleSearch": false,
"defaultValueGenerator": ""
}
],
"locked": false
Expand Down
5 changes: 5 additions & 0 deletions src/Model/CustomerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ public function getPhone(): ?string;
*/
public function setPhone(?string $phone);

/**
* @return string|null
*/
public function getCustomerLanguage();

/**
* @return CustomerSegmentInterface[]|ObjectMetadata[]
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Model/Traits/CustomerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,8 @@ public function needsExportByNewsletterProviderHandler(NewsletterProviderHandler
{
return $this->getPublished() && $this->getActive();
}

public function getCustomerLanguage() {
return null;
}
}
4 changes: 4 additions & 0 deletions src/Newsletter/ProviderHandler/Mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ public function buildEntry(MailchimpAwareCustomerInterface $customer)
'merge_fields' => $mergeFields
];

if ($language = $customer->getCustomerLanguage()) {
$entry['language'] = $language;
}

if ($interests = $this->buildCustomerSegmentData($customer)) {
$result['interests'] = $interests;
}
Expand Down

0 comments on commit 7dc9876

Please sign in to comment.