{*
Template: components/campaign-text.html
Description: Outputs the human-readable condition for ONE campaign, or NOTHING when the
campaign cannot actually be triggered.
Shared by product-campaign.html and campaign-alert.html so the wording cannot drift apart
between the two. Callers decide whether to render at all by capturing the output and
testing whether it is empty:
<{capture assign="campaign_text"}><{include file="components/campaign-text.html" campaign=$campaign}><{/capture}>
<{if $campaign_text|trim}> ... <{/if}>
The conditions below mirror Basket::price() (admin/class/basket.php). A campaign we cannot
describe correctly is a campaign we must not advertise — most importantly, fixed /
cheapest_free / percent are switched off entirely by min_product_count = 0 (basket.php ~2191).
*}>
<{$ct_model = $campaign->getPriceModel()}>
<{$ct_count = $campaign->getMinProductCount()}>
<{$ct_percent = $campaign->getPercent()}>
<{if $ct_model == 'threshold'}>
<{if $campaign->getThresholdAmount() && $campaign->getThresholdPercent()}>
<{t x=$campaign->getThresholdAmount()|number_format:$smarty.capture.decimal_number:$smarty.capture.decimal:$smarty.capture.thousand y=$campaign->getThresholdPercent() z=$webshop->getCurrency()}>Save {y}% when you spend over {x} {z}<{/t}><{if $campaign->getThresholdExcludeSale()}> <{t}>(sale items excluded)<{/t}><{/if}>
<{/if}>
<{elseif $ct_model == 'bundle'}>
<{if $ct_percent}>
<{$ct_bundle_amount = $campaign->getBundleThresholdAmount()}>
<{if $ct_bundle_amount}>
<{t x=$ct_percent y=$ct_bundle_amount|number_format:$smarty.capture.decimal_number:$smarty.capture.decimal:$smarty.capture.thousand z=$webshop->getCurrency()}>Get {x}% off when you also spend {y} {z}<{/t}>
<{else}>
<{t x=$ct_percent}>Save {x}% — buy specific items together<{/t}>
<{/if}><{if $campaign->getBundleExcludeSale()}> <{t}>(sale items excluded)<{/t}><{/if}>
<{/if}>
<{elseif $ct_count >= 1}>
<{if $ct_model == 'percent' && $ct_percent}>
<{t x=$ct_count y=$ct_percent}>Buy {x} and get {y}% off<{/t}>
<{elseif $ct_model == 'fixed' && $campaign->getPrice()}>
<{t x=$ct_count y=$campaign->getPrice()|number_format:$smarty.capture.decimal_number:$smarty.capture.decimal:$smarty.capture.thousand z=$webshop->getCurrency()}>{x} for {y} {z}<{/t}>
<{elseif $ct_model == 'cheapest_free'}>
<{t x=$ct_count}>Buy {x} and get the cheapest one free<{/t}>
<{/if}>
<{/if}>