Skip to content

Commit

Permalink
feat(catalog): CATALOG-3161 Show a retail price range if one exists
Browse files Browse the repository at this point in the history
    and make it strike through.
  • Loading branch information
Ziad Abdo committed Apr 4, 2018
1 parent b03b66c commit 4526f7a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
44 changes: 30 additions & 14 deletions templates/components/products/price-range.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,50 @@
{{#and price_range.min.with_tax price_range.max.with_tax}}
{{#and price.retail_price_range.min.without_tax price.retail_price_range.max.without_tax}}
<div class="price-section price-section--withTax" {{#if schema_org}}itemprop="offers" itemscope itemtype="http://schema.org/Offer"{{/if}}>
<span data-product-price-with-tax class="price">{{price_range.min.with_tax.formatted}} - {{price_range.max.with_tax.formatted}}</span>
{{#and price_range.min.without_tax price_range.max.without_tax}}
<abbr title="{{lang 'products.excluding_tax'}}">{{lang 'products.price_with_tax' tax_label=price_range.min.tax_label}}</abbr>
<span data-product-price-with-tax class="price price--rrp">{{price.retail_price_range.min.without_tax.formatted}} - {{price.retail_price_range.max.without_tax.formatted}}</span>
{{#if schema_org}}
<meta itemprop="availability" content="{{product.availability}}">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/{{product.condition}}Condition">
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/PriceSpecification">
<meta itemprop="minPrice" content="{{price.retail_price_range.min.without_tax.value}}" />
<meta itemprop="price" content="{{price.retail_price_range.min.without_tax.value}}">
<meta itemprop="maxPrice" content="{{price.retail_price_range.max.without_tax.value}}" />
<meta itemprop="priceCurrency" content="{{currency_selector.active_currency_code}}">
<meta itemprop="valueAddedTaxIncluded" content="true">
</div>
{{/if}}
</div>
{{/and}}
{{#and price.price_range.min.with_tax price.price_range.max.with_tax}}
<div class="price-section price-section--withTax" {{#if schema_org}}itemprop="offers" itemscope itemtype="http://schema.org/Offer"{{/if}}>
<span data-product-price-with-tax class="price">{{price.price_range.min.with_tax.formatted}} - {{price.price_range.max.with_tax.formatted}}</span>
{{#and price.price_range.min.without_tax price.price_range.max.without_tax}}
<abbr title="{{lang 'products.excluding_tax'}}">{{lang 'products.price_with_tax' tax_label=price.price_range.min.tax_label}}</abbr>
{{else if schema_org}}
<meta itemprop="availability" content="{{product.availability}}">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/{{product.condition}}Condition">
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/PriceSpecification">
<meta itemprop="minPrice" content="{{price_range.min.with_tax.value}}" />
<meta itemprop="price" content="{{price_range.min.with_tax.value}}">
<meta itemprop="maxPrice" content="{{price_range.max.with_tax.value}}" />
<meta itemprop="minPrice" content="{{price.price_range.min.with_tax.value}}" />
<meta itemprop="price" content="{{price.price_range.min.with_tax.value}}">
<meta itemprop="maxPrice" content="{{price.price_range.max.with_tax.value}}" />
<meta itemprop="priceCurrency" content="{{currency_selector.active_currency_code}}">
<meta itemprop="valueAddedTaxIncluded" content="true">
</div>
{{/and}}
</div>
{{/and}}
{{#and price_range.min.without_tax price_range.max.without_tax}}
{{#and price.price_range.min.without_tax price.price_range.max.without_tax}}
<div class="price-section price-section--withoutTax {{#and price_range.min.with_tax price_range.max.with_tax}}price-section--minor{{/and}}" {{#if schema_org}}itemprop="offers" itemscope itemtype="http://schema.org/Offer"{{/if}}>
<span data-product-price-without-tax class="price price--withoutTax">{{price_range.min.without_tax.formatted}} - {{price_range.max.without_tax.formatted}}</span>
{{#and price_range.min.with_tax price_range.max.with_tax}}
<abbr title="{{lang 'products.excluding_tax'}}">{{lang 'products.price_without_tax' tax_label=price_range.min.tax_label}}</abbr>
<span data-product-price-without-tax class="price price--withoutTax">{{price.price_range.min.without_tax.formatted}} - {{price.price_range.max.without_tax.formatted}}</span>
{{#and price.price_range.min.with_tax price.price_range.max.with_tax}}
<abbr title="{{lang 'products.excluding_tax'}}">{{lang 'products.price_without_tax' tax_label=price.price_range.min.tax_label}}</abbr>
{{/and}}
{{#if schema_org}}
<meta itemprop="availability" content="{{product.availability}}">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/{{product.condition}}Condition">
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/PriceSpecification">
<meta itemprop="minPrice" content="{{price_range.min.without_tax.value}}" />
<meta itemprop="price" content="{{price_range.min.without_tax.value}}">
<meta itemprop="maxPrice" content="{{price_range.max.without_tax.value}}" />
<meta itemprop="minPrice" content="{{price.price_range.min.without_tax.value}}" />
<meta itemprop="price" content="{{price.price_range.min.without_tax.value}}">
<meta itemprop="maxPrice" content="{{price.price_range.max.without_tax.value}}" />
<meta itemprop="priceCurrency" content="{{currency_selector.active_currency_code}}">
<meta itemprop="valueAddedTaxIncluded" content="false">
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/components/products/price.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#and price.price_range (if theme_settings.price_ranges '==' true)}}
{{> components/products/price-range price_range=price.price_range schema_org=schema_org}}
{{> components/products/price-range price=price schema_org=schema_org}}
{{else}}
{{#if price.with_tax}}
<div class="price-section price-section--withTax" {{#if schema_org}}itemprop="offers" itemscope itemtype="http://schema.org/Offer"{{/if}}>
Expand All @@ -26,7 +26,7 @@
{{#if price.rrp_without_tax}}
<span data-product-rrp-without-tax class="price price--rrp">{{price.rrp_without_tax.formatted}}</span>
{{/if}}
<span data-product-price-without-tax class="price price--withoutTax">{{price.without_tax.formatted}}</span>
<span data-product-price-without-tax class="price price--withoutTax">{{price.without_tax.formatted}}</span>
{{#if schema_org}}
<meta itemprop="availability" itemtype="http://schema.org/ItemAvailability"
content="http://schema.org/{{#if product.pre_order}}PreOrder{{else if product.out_of_stock}}OutOfStock{{else if product.can_purchase '===' false}}OutOfStock{{else}}InStock{{/if}}">
Expand Down

0 comments on commit 4526f7a

Please sign in to comment.