diff --git a/src/config.php b/src/config.php index 6bf517a..2efdc77 100644 --- a/src/config.php +++ b/src/config.php @@ -23,6 +23,20 @@ */ return [ + // Plugin options + 'options' => [ + // Whether or not to show the "save for later" button + 'enableSaveForLater' => false, // true|false + + // Whether or not to show the shipping estimator + 'enableEstimatedShipping' => false, // true|false + + // Whether or not to show the free shipping message + 'enableFreeShippingMessage' => false, // true|false + + // Whether or not to show the "No Image" placeholder images + 'enablePlaceholderImages' => false, + ], // Branding Settings 'branding' => [ // The brand primary custom color in HEX color diff --git a/src/models/Settings.php b/src/models/Settings.php index 4dc4fcf..490e487 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -9,6 +9,13 @@ */ class Settings extends Model { + public array $options = [ + 'enableSaveForLater' => false, + 'enableEstimatedShipping' => false, + 'enableFreeShippingMessage' => false, + 'enablePlaceholderImages' => false, + ]; + public array $branding = [ 'color' => '#1F2937', 'font' => 'Rubik', diff --git a/src/services/Checkout.php b/src/services/Checkout.php index 6122168..0139af0 100644 --- a/src/services/Checkout.php +++ b/src/services/Checkout.php @@ -25,6 +25,15 @@ */ class Checkout extends Component { + /* + * Gets the options settings array + */ + public function options(): array + { + $settings = FosterCheckout::getInstance()->getSettings(); + return $settings->options; + } + /* * Gets the branding settings array */ diff --git a/src/templates/_components/app/line-item-cart.twig b/src/templates/_components/app/line-item-cart.twig index 37ed83c..dd9728d 100644 --- a/src/templates/_components/app/line-item-cart.twig +++ b/src/templates/_components/app/line-item-cart.twig @@ -22,22 +22,24 @@
-
-
- {{ 'Image of'|t('foster-checkout') ~ ' ' ~ lineItem.description }} -
-
+ {% if imageUrl or craft.checkout.options.enablePlaceholderImages %} +
+
+ {{ 'Image of'|t('foster-checkout') ~ ' ' ~ lineItem.description }} +
+
+ {% endif %}
diff --git a/src/templates/_components/app/line-item-checkout.twig b/src/templates/_components/app/line-item-checkout.twig index 9daea78..a4e6414 100644 --- a/src/templates/_components/app/line-item-checkout.twig +++ b/src/templates/_components/app/line-item-checkout.twig @@ -11,18 +11,20 @@ {% set imageUrl = previewImage.getUrl(preview) %} {% endif %} -
+
-
-
- {{ 'Image of'|t('foster-checkout') ~ ' ' ~ lineItem.description }} -
-
+ {% if imageUrl or craft.checkout.options.enablePlaceholderImages %} +
+
+ {{ 'Image of'|t('foster-checkout') ~ ' ' ~ lineItem.description }} +
+
+ {% endif %}
@@ -32,4 +34,4 @@

{{ lineItem.totalAsCurrency() }}

-
\ No newline at end of file +
diff --git a/src/translations/en/foster-checkout.php b/src/translations/en/foster-checkout.php index 4f978c9..7334f83 100644 --- a/src/translations/en/foster-checkout.php +++ b/src/translations/en/foster-checkout.php @@ -98,4 +98,5 @@ 'dateFormat' => 'n/j/y', 'Same as shipping address' => 'Same as shipping address', 'Use an address from your address book' => 'Use an address from your address book', + 'No Image' => 'No Image', ];