Release version 1.0.1

- Add Twig template engine integration
- Migrate all templates to Twig format
- Add German (Switzerland, Informal) translation
- Improve template organization and security
- Add Composer dependency management
- Create comprehensive changelog
This commit is contained in:
2025-12-21 04:56:50 +01:00
commit 7273c9cde7
32 changed files with 2987 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
{#
# Frontend Package Pricing Display Template
#
# @package WC_Tier_Package_Prices
# @var array packages
#}
<div class="wc-tpp-package-pricing-table">
<h3>{{ 'Package Deals'|__('wc-tier-package-prices') }}</h3>
<div class="wc-tpp-packages">
{% for index, package in packages %}
{% set price_per_unit = package.qty > 0 ? package.price / package.qty : 0 %}
<div class="wc-tpp-package" data-qty="{{ package.qty|esc_attr }}" data-price="{{ package.price|esc_attr }}">
<div class="wc-tpp-package-header">
{% if package.label is not empty %}
<h4>{{ package.label|esc_html }}</h4>
{% endif %}
</div>
<div class="wc-tpp-package-details">
<div class="wc-tpp-package-qty">
<strong>{{ package.qty|esc_html }}</strong> {{ 'pieces'|__('wc-tier-package-prices') }}
</div>
<div class="wc-tpp-package-price">
{{ wc_price(package.price)|raw }}
</div>
<div class="wc-tpp-package-unit-price">
{{ wc_price(price_per_unit)|raw }} {{ 'per unit'|__('wc-tier-package-prices') }}
</div>
</div>
<button type="button" class="button wc-tpp-select-package" data-package-index="{{ index|esc_attr }}">
{{ 'Select Package'|__('wc-tier-package-prices') }}
</button>
</div>
{% endfor %}
</div>
</div>

View File

@@ -0,0 +1,17 @@
{#
# Frontend Pricing Table Template
#
# @package WC_Tier_Package_Prices
# @var object product
# @var array tiers
# @var array packages
#}
<div class="wc-tpp-pricing-container">
{% if tiers is not empty and get_option('wc_tpp_enable_tier_pricing') == 'yes' %}
{% include 'frontend/tier-pricing-table.twig' with {'product': product, 'tiers': tiers} %}
{% endif %}
{% if packages is not empty and get_option('wc_tpp_enable_package_pricing') == 'yes' %}
{% include 'frontend/package-pricing-display.twig' with {'packages': packages} %}
{% endif %}
</div>

View File

@@ -0,0 +1,41 @@
{#
# Frontend Tier Pricing Table Template
#
# @package WC_Tier_Package_Prices
# @var object product
# @var array tiers
#}
<div class="wc-tpp-tier-pricing-table">
<h3>{{ 'Volume Discounts'|__('wc-tier-package-prices') }}</h3>
<table class="wc-tpp-table">
<thead>
<tr>
<th>{{ 'Quantity'|__('wc-tier-package-prices') }}</th>
<th>{{ 'Price per Unit'|__('wc-tier-package-prices') }}</th>
<th>{{ 'You Save'|__('wc-tier-package-prices') }}</th>
</tr>
</thead>
<tbody>
{% set regular_price = product.get_regular_price() %}
{% for tier in tiers %}
{% set savings = 0 %}
{% set savings_percent = 0 %}
{% if regular_price > 0 %}
{% set savings = regular_price - tier.price %}
{% set savings_percent = (savings / regular_price) * 100 %}
{% endif %}
<tr data-min-qty="{{ tier.min_qty|esc_attr }}" data-price="{{ tier.price|esc_attr }}">
<td>{{ tier.min_qty|esc_html }}+</td>
<td>{{ wc_price(tier.price)|raw }}</td>
<td>
{% if savings > 0 %}
{{ wc_price(savings)|raw }} ({{ savings_percent|round(2) }}%)
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>