Closed mlocati closed 8 months ago
A custom attribute under Order attributes, in the 'Other Customer Choices' set should prompt within the checkout steps. And it can be set to be required as well. The actual link might not be possible, but you could refer to 'our privacy policy as linked in our footer'.
I don't think there's a way to force users to tick a checkbox attribute.
Since I think it's a pretty common requirements, would you accept a PR that implements the following:
/dashboard/store/settings#settings-orders
dashboard page: "ask users to accept the privacy policy"That's interesting, the 'Required in checkout' setting on an attribute used to set the required
html attribute on the output form element, meaning you couldn't progress without filling it out. And for a checkbox that means ticking it.
I do like the idea of your PR, but I think I should also see why this is no longer working.
the 'Required in checkout' setting on an attribute
Is there such a feature? Wow, I wasn't aware of it
the 'Required in checkout' setting on an attribute
I've just tried this:
The checkbox is displayed to the customers, but they can proceed without checking it:
Yes, that used to work, I'm going to take a look at what may have changed.
The problem is in single_pages/checkout.php
.
We have:
$fieldoutput = $cv->renderControl();
if ($ak->isRequired()) {
$fieldoutput = str_replace('<input', '<input required ', $fieldoutput);
$fieldoutput = str_replace('<select', '<select required ', $fieldoutput);
}
echo $fieldoutput;
But we should have something like this:
ob_start();
$fieldoutput1 = $cv->renderControl();
$fieldoutput2 = ob_get_contents();
ob_end_clean();
$fieldoutput = $fieldoutput1 === null ? $fieldoutput2 : $fieldoutput1;
if ($ak->isRequired()) {
$fieldoutput = str_replace('<input', '<input required ', $fieldoutput);
$fieldoutput = str_replace('<select', '<select required ', $fieldoutput);
}
echo $fieldoutput;
For anyone reading this: I've created package that provides a boolean (checkbox) attribute whose description can be a Rich Text, so that for example it can be something like this:
[ ] By submitting this order I accept the terms described here
You can find it here: https://github.com/concrete5-community/boolean_rich
I reckon that would be very handy for other reasons, like on normal (Express) forms
I've submitted the boolean_rich addon to the marketplace and it has just been approved: see https://marketplace.concretecms.com/marketplace/addons/boolean-rich-text/
Of course you can still install it via composer:
{
"require": {
"concrete5-community/boolean_rich": "^1"
}
}
When users submit an order, they give their personal details to the seller.
And that requires that the seller tells the customer what he's going to do with this personal data.
Is there a way to add a (required) checkbox when customers submit orders? Something like this
[ ] By submitting your order, you accept our privacy policy