generated from boboko/starter
marketing consent to recovery consent and connection with core
This commit is contained in:
@@ -164,16 +164,14 @@ public function saveAddress(string $locale, Request $request): JsonResponse
|
|||||||
$this->checkout->setBillingAddress($billing);
|
$this->checkout->setBillingAddress($billing);
|
||||||
$cart = $this->checkout->setShippingAddress($shipping);
|
$cart = $this->checkout->setShippingAddress($shipping);
|
||||||
|
|
||||||
$cart->meta = [
|
$cart->meta = [...($cart->meta?->toArray() ?? []), 'ship_to_billing' => $sameAsBilling];
|
||||||
...($cart->meta?->toArray() ?? []),
|
|
||||||
'ship_to_billing' => $sameAsBilling,
|
|
||||||
// Interim storage only — the proper consent record (timestamp,
|
|
||||||
// policy version) is the back-end Task 2. This just lets the
|
|
||||||
// checkbox round-trip on reload like every other field.
|
|
||||||
'marketing_consent' => $request->boolean('marketing_consent'),
|
|
||||||
];
|
|
||||||
$cart->save();
|
$cart->save();
|
||||||
|
|
||||||
|
// Abandoned-cart-recovery opt-in — boboko-core owns the record (bool +
|
||||||
|
// timestamp + policy version on Cart::meta, RecoveryConsentSet event).
|
||||||
|
// Deliberately its own scope, not merged with any future newsletter opt-in.
|
||||||
|
$this->checkout->setRecoveryConsent($request->boolean('recovery_consent'));
|
||||||
|
|
||||||
// ShippingManifest is a request-lifetime singleton whose getOptions()
|
// ShippingManifest is a request-lifetime singleton whose getOptions()
|
||||||
// appends without ever clearing, and addOption() keeps the FIRST entry
|
// appends without ever clearing, and addOption() keeps the FIRST entry
|
||||||
// per identifier. The setBillingAddress() recalc above ran ApplyShipping
|
// per identifier. The setBillingAddress() recalc above ran ApplyShipping
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ private function lines(): array
|
|||||||
'page.guest_tab' => ['Guest', 'Ως επισκέπτης'],
|
'page.guest_tab' => ['Guest', 'Ως επισκέπτης'],
|
||||||
'page.login_tab' => ['Log in', 'Σύνδεση'],
|
'page.login_tab' => ['Log in', 'Σύνδεση'],
|
||||||
'page.email_label' => ['Email', 'Email'],
|
'page.email_label' => ['Email', 'Email'],
|
||||||
'page.marketing_consent' => [
|
'page.recovery_consent' => [
|
||||||
'Email me offers, news and order reminders',
|
"Email me a reminder if I don't finish my order",
|
||||||
'Στείλε μου προσφορές, νέα και υπενθυμίσεις παραγγελιών',
|
'Στείλε μου μια υπενθύμιση αν δεν ολοκληρώσω την παραγγελία μου',
|
||||||
],
|
],
|
||||||
'page.login_email_label' => ['Email', 'Email'],
|
'page.login_email_label' => ['Email', 'Email'],
|
||||||
'page.send_code' => ['Send code', 'Αποστολή κωδικού'],
|
'page.send_code' => ['Send code', 'Αποστολή κωδικού'],
|
||||||
|
|||||||
@@ -63,21 +63,21 @@ class="bbk-checkout-tab"
|
|||||||
form="bbk-address-form"
|
form="bbk-address-form"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{{-- One combined marketing opt-in (offers + news + unfinished-order
|
{{-- Abandoned-cart-recovery opt-in. Optional, unticked, never
|
||||||
reminders). Optional, unticked, never required — all of it is
|
required — direct marketing under ePrivacy (GR L. 3471/2006
|
||||||
direct marketing under ePrivacy (GR L. 3471/2006 art. 11), so it
|
art. 11), so it needs an explicit opt-in and checkout can't be
|
||||||
needs an explicit opt-in and checkout can't be gated on it.
|
gated on it. Narrow scope by design (boboko-core's
|
||||||
The bool round-trips via cart.meta (see saveAddress); the proper
|
setRecoveryConsent) — a general newsletter opt-in, if wanted,
|
||||||
consent record — timestamp, policy version — is back-end Task 2. --}}
|
is a separate checkbox. --}}
|
||||||
<label class="bbk-checkbox bbk-checkbox--stacked">
|
<label class="bbk-checkbox bbk-checkbox--stacked">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="marketing_consent"
|
name="recovery_consent"
|
||||||
value="1"
|
value="1"
|
||||||
form="bbk-address-form"
|
form="bbk-address-form"
|
||||||
{{ old('marketing_consent', data_get($cart, 'meta.marketing_consent')) ? 'checked' : '' }}
|
{{ old('recovery_consent', data_get($cart, 'meta.recovery_consent')) ? 'checked' : '' }}
|
||||||
>
|
>
|
||||||
{{ __('checkout.page.marketing_consent') }}
|
{{ __('checkout.page.recovery_consent') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user