|
14 | 14 | } |
15 | 15 |
|
16 | 16 | var uccStoreLogoUrl = checkoutPage.Value<IPublishedContent>("uccStoreLogo")?.Url(); |
| 17 | + |
| 18 | + if (string.IsNullOrWhiteSpace(uccStoreLogoUrl)) |
| 19 | + { |
| 20 | + // Fallback to the store logo if the checkout page logo is not set |
| 21 | + uccStoreLogoUrl = store.LogoImageUrl; |
| 22 | + } |
| 23 | + |
| 24 | + if (!string.IsNullOrWhiteSpace(uccStoreLogoUrl) && !uccStoreLogoUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) |
| 25 | + { |
| 26 | + // Ensure the logo URL is absolute |
| 27 | + uccStoreLogoUrl = BaseUrl + uccStoreLogoUrl; |
| 28 | + } |
| 29 | + |
17 | 30 | var uccStoreTsAndCsUrl = checkoutPage.Value<IPublishedContent>("uccTermsAndConditionsPage")?.Url(); |
18 | 31 | var uccStorePrivacyPolicyUrl = checkoutPage.Value<IPublishedContent>("uccPrivacyPolicyPage")?.Url(); |
| 32 | + |
19 | 33 | var uccStoreAddress = checkoutPage.Value<string>("uccStoreAddress"); |
20 | | - var uccThemeColor = checkoutPage.Value<string>("uccThemeColor", defaultValue: "000000"); |
| 34 | + if (string.IsNullOrWhiteSpace(uccStoreAddress) && store.DefaultLocationId.HasValue) |
| 35 | + { |
| 36 | + // If the store address is not set, we can try to get it from the default location |
| 37 | + var location = await UmbracoCommerceApi.GetLocationAsync(store.DefaultLocationId.Value); |
| 38 | + if (location != null) |
| 39 | + { |
| 40 | + uccStoreAddress = $"{location.AddressLine1}, {location.City}, {location.ZipCode}"; |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + var uccThemeColor = checkoutPage.Value<string>("uccThemeColor"); |
| 45 | + |
| 46 | + if (string.IsNullOrWhiteSpace(uccThemeColor)) |
| 47 | + { |
| 48 | + // Fallback to the store theme color if the checkout page theme color is not set |
| 49 | + uccThemeColor = store.ThemeColor ?? "#000000"; |
| 50 | + } |
21 | 51 | } |
22 | | -<style type="text/css"> |
| 52 | +<style> |
23 | 53 | #ucc, #ucc td, #ucc p { |
24 | 54 | font-family: sans-serif; |
25 | 55 | font-size: 14px; |
26 | 56 | line-height: 18px; |
27 | 57 | color: #5f6a70; |
28 | 58 | } |
29 | | -
|
30 | | - #ucc td { |
| 59 | + #ucc td { |
31 | 60 | vertical-align: top; |
32 | 61 | } |
33 | 62 | </style> |
|
43 | 72 |
|
44 | 73 | @if (!string.IsNullOrWhiteSpace(uccStoreLogoUrl)) |
45 | 74 | { |
46 | | - <a href="@(BaseUrl)" target="_blank"><img src="@Html.Raw(BaseUrl + uccStoreLogoUrl.GetCropUrl(200, 100, imageCropMode: ImageCropMode.Max))" alt="@(store.Name)" border="0" /></a> |
| 75 | + <a href="@(BaseUrl)" target="_blank"><img src="@Html.Raw(uccStoreLogoUrl.GetCropUrl(200, 100, imageCropMode: ImageCropMode.Max))" alt="@(store.Name)" border="0" /></a> |
47 | 76 | } |
48 | 77 | else |
49 | 78 | { |
50 | | - <h1 class="margin: 0 0 20px; font-size: 30px; line-height: 38px; color: ##000;"><a href="@(BaseUrl)" style="color: #000;" target="_blank">@(store.Name)</a></h1> |
| 79 | + <h1 class="margin: 0 0 20px; font-size: 30px; line-height: 38px; color: #000;"><a href="@(BaseUrl)" style="color: #000;" target="_blank">@(store.Name)</a></h1> |
51 | 80 | } |
52 | 81 |
|
53 | 82 | <hr style="border: 0; height: 1px; background: #ebebe9; margin: 20px 0;" /> |
54 | 83 |
|
55 | | - <h2 style="margin: 0 0 20px; font-size: 20px; line-height: 28px; color: #@(uccThemeColor);">Here is your Gift Card for @(store.Name)</h2> |
| 84 | + <h2 style="margin: 0 0 20px; font-size: 20px; line-height: 28px; color: @(uccThemeColor);">Here is your Gift Card for @(store.Name)</h2> |
56 | 85 |
|
57 | | - <table style="background-color: #@(uccThemeColor); border-radius: 10px; width: 400px; margin: 0 auto 20px;"> |
| 86 | + <table style="background-color: @(uccThemeColor); border-radius: 10px; width: 400px; margin: 0 auto 20px;"> |
58 | 87 | <tr> |
59 | 88 | <td style="padding: 40px 20px;"> |
60 | 89 | <table style="width: 100%;"> |
61 | 90 | <tr> |
62 | 91 | <td style="color:white; font-size: 60px; line-height: 60px; padding-bottom: 15px;text-align: center;">@(await Model.OriginalAmount.FormattedAsync())</td> |
63 | 92 | </tr> |
64 | 93 | <tr> |
65 | | - <td style="background-color:white; font-size: 20px; line-height: 20px; color: #@(uccThemeColor); text-align: center; padding: 5px 10px;">@(Model.Code)</td> |
| 94 | + <td style="background-color:white; font-size: 20px; line-height: 20px; color: @(uccThemeColor); text-align: center; padding: 5px 10px;">@(Model.Code)</td> |
66 | 95 | </tr> |
67 | 96 | </table> |
68 | 97 | </td> |
|
77 | 106 |
|
78 | 107 | <hr style="border: 0; height: 1px; background: #ebebe9; margin: 20px 0;" /> |
79 | 108 | <p style="text-align: center;"> |
80 | | - <a href="@(BaseUrl + uccStoreTsAndCsUrl)" target="_blank" style="color: #@(uccThemeColor);">Terms of Service</a> | <a href="@(BaseUrl + uccStorePrivacyPolicyUrl)" target="_blank" style="color: #@(uccThemeColor);">Privacy Policy</a> |
| 109 | + <a href="@(BaseUrl + uccStoreTsAndCsUrl)" target="_blank" style="color: @(uccThemeColor);">Terms of Service</a> | <a href="@(BaseUrl + uccStorePrivacyPolicyUrl)" target="_blank" style="color: @(uccThemeColor);">Privacy Policy</a> |
81 | 110 | </p> |
82 | 111 | <p style="text-align: center; margin-bottom: 0;">@(store.Name), @(uccStoreAddress)</p> |
83 | 112 |
|
|
0 commit comments