diff --git a/src/Models/Product.php b/src/Models/Product.php
index 64b03a9..21f2e38 100644
--- a/src/Models/Product.php
+++ b/src/Models/Product.php
@@ -104,6 +104,11 @@ class Product extends Model
);
}
+ public function conversionRate(): ?float
+ {
+ return $this->conversionRate;
+ }
+
public function isDiscontinued(): bool
{
return $this->lastSeen < now()->format('Y-m-d');
diff --git a/templates/productList.html.twig b/templates/productList.html.twig
index 0f5f595..23b6226 100644
--- a/templates/productList.html.twig
+++ b/templates/productList.html.twig
@@ -80,19 +80,30 @@
link |
{% if product.isDiscontinued() or product.priceCurrent == product.productStandardPrice %}
- {{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}
+ {{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}
+ {% if product.conversionRate is not empty and product.conversionRate != 1 %}
+ {{ (product.priceLowest * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
+ {% endif %}
{% else %}
{% if product.priceLowest != product.priceCurrent %}{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}{% else %}
- now lowest{% endif %} |
+ now lowest
+ {% endif %}
{% endif %}
- {{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }} |
+
+ {{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }}
+ {% if product.conversionRate is not empty and product.conversionRate != 1 %}
+ {{ (product.priceCurrent * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
+ {% endif %}
+ |
- {% if product.priceCurrent != product.productStandardPrice %}{{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}
- {{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%
+ {% if product.priceCurrent != product.productStandardPrice %}
+ {{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}
+ {% if product.conversionRate is not empty and product.conversionRate != 1 %}
+ {{ (product.productStandardPrice * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
+ {% endif %}
+ {{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%
{% endif %}
|