Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/scss/layouts/_layouts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
// Product Sale Badges
@import "products/productSaleBadges";

// Featured Promotion Callouts
@import "products/promotionCallout";

// Product view
@import "products/productSwatch";

Expand Down
57 changes: 57 additions & 0 deletions assets/scss/layouts/products/_promotionCallout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// =============================================================================
// PRODUCT Promotion Callouts (CSS)
// =============================================================================

.promotionCallout {
margin-top: spacing("quarter");
}

.promotionCallout-item {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: spacing("quarter");
padding: spacing("quarter") spacing("half");
background: stencilColor("color_bg_featured_promotions");
border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 4px;
}

.promotionCallout-icon {
flex-shrink: 0;
width: 16px;
height: 16px;
stroke: stencilColor("color_text_featured_promotions");
}

.promotionCallout-text {
font-size: fontSize("smaller");
color: stencilColor("color_text_featured_promotions");
font-weight: fontWeight("semibold");
line-height: lineHeight("smallest");
}

.promotionCallout-more {
flex-basis: 100%;
font-size: fontSize("smallest");
color: stencilColor("color_text_featured_promotions");
opacity: 0.7;
}

.promotionCallout--full {
list-style: none;
margin: 0 0 spacing("half");
padding: 0;

.promotionCallout-item + .promotionCallout-item {
margin-top: spacing("quarter");
}
}

.card-body .promotionCallout--compact {
margin-top: spacing("quarter");
}

.listItem-actions .promotionCallout--compact {
margin-top: spacing("quarter");
}
3 changes: 3 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@
"color_badge_product_sold_out_badges": "#007dc6",
"color_text_product_sold_out_badges": "#ffffff",
"color_hover_product_sold_out_badges": "#000000",
"show_featured_promotions": true,
"color_bg_featured_promotions": "#fef9e7",
"color_text_featured_promotions": "#856404",
"focusTooltip-textColor": "#ffffff",
"focusTooltip-backgroundColor": "#313440",
"swatch_option_size": "22x22",
Expand Down
5 changes: 4 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,10 @@
"suffix": "each"
}
},
"card_default_image_alt": "Image coming soon"
"card_default_image_alt": "Image coming soon",
"featured_promotions": {
"more_offers": "more offers"
}
},
"invoice": {
"for_order": "{name} Invoice for Order #{id}",
Expand Down
24 changes: 24 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,30 @@
"reference": "product_sold_out_badges",
"reference_default": "none"
},
{
"type": "heading",
"content": "i18n.FeaturedPromotions"
},
{
"type": "checkbox",
"label": "i18n.ShowFeaturedPromotions",
"force_reload": true,
"id": "show_featured_promotions"
},
{
"type": "color",
"label": "i18n.FeaturedPromotionBackgroundColor",
"id": "color_bg_featured_promotions",
"reference": "show_featured_promotions",
"reference_default": false
},
{
"type": "color",
"label": "i18n.FeaturedPromotionTextColor",
"id": "color_text_featured_promotions",
"reference": "show_featured_promotions",
"reference_default": false
},
{
"type": "heading",
"content": "i18n.DisplaySettings"
Expand Down
12 changes: 12 additions & 0 deletions schemaTranslations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,18 @@
"pl": "Tło stopki",
"ja": "フッターの背景"
},
"i18n.FeaturedPromotions": {
"default": "Featured Promotions"
},
"i18n.ShowFeaturedPromotions": {
"default": "Show featured promotions"
},
"i18n.FeaturedPromotionBackgroundColor": {
"default": "Featured promotion background color"
},
"i18n.FeaturedPromotionTextColor": {
"default": "Featured promotion text color"
},
"i18n.DisplaySettings": {
"default": "Display settings",
"fr": "Paramètres d'affichage",
Expand Down
6 changes: 6 additions & 0 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,11 @@ <h3 class="card-title">
</div>
{{{region name="product_item_below_price"}}}
{{> components/products/bulk-discount-rates}}
{{#if theme_settings.show_featured_promotions}}
{{> components/products/promotion-callout
promotions=featured_promotions
mode="compact"
}}
{{/if}}
</div>
</article>
6 changes: 6 additions & 0 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ <h4 class="listItem-title">
{{else}}
{{> components/common/login-for-pricing}}
{{/or}}
{{#if theme_settings.show_featured_promotions}}
{{> components/products/promotion-callout
promotions=featured_promotions
mode="compact"
}}
Comment thread
cursor[bot] marked this conversation as resolved.
{{/if}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" data-event-type="product-click" class="button button--small" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
Expand Down
6 changes: 6 additions & 0 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ <h2 class="productView-brand">
{{/or}}
</div>
{{{region name="product_below_price"}}}
{{#if theme_settings.show_featured_promotions}}
{{> components/products/promotion-callout
promotions=product.featured_promotions
mode="full"
}}
{{/if}}
<div class="productView-rating">
{{#if settings.show_product_rating}}
{{> components/products/ratings rating=product.rating}}
Expand Down
22 changes: 22 additions & 0 deletions templates/components/products/promotion-callout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{#if promotions.length}}
{{#if mode '===' 'compact'}}
<div class="promotionCallout promotionCallout--compact">
<div class="promotionCallout-item">
<span class="promotionCallout-text">{{promotions.[0].text}}</span>
{{#if promotions.[1]}}
<span class="promotionCallout-more">
+{{subtract promotions.length 1}} {{lang 'products.featured_promotions.more_offers'}}
</span>
{{/if}}
</div>
</div>
{{else}}
<ul class="promotionCallout promotionCallout--full">
{{#each promotions}}
<li class="promotionCallout-item">
<span class="promotionCallout-text">{{text}}</span>
</li>
{{/each}}
</ul>
{{/if}}
{{/if}}
Loading