Skip to content

Commit

Permalink
Merge pull request #630 from tblivet/issue-491
Browse files Browse the repository at this point in the history
Fix: issue-491
  • Loading branch information
nicosomb authored Jun 5, 2024
2 parents 15d13c0 + 2c1f730 commit 60d1e51
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 70 deletions.
25 changes: 20 additions & 5 deletions src/scss/custom/pages/product/_product.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,43 @@
margin-bottom: 1.5rem;
}

&__tax-info {
font-size: 0.875rem;
color: var(--bs-gray-600);
}

&__tax-label {
margin-bottom: 1.5rem;
color: var(--bs-gray-700);
white-space: nowrap;
}

&__prices {
font-size: 1.25rem;
}

&__current-price {
font-weight: 700;
font-size: 1.5rem;
font-weight: 600;
line-height: 2rem;
}

&__unit-price {
font-size: 0.875rem;
color: var(--bs-gray-600);
}

&__discount {
margin-left: 0.5rem;
color: var(--bs-gray-700);
font-size: 1rem;
color: var(--bs-gray-600);
}

&__price-regular {
text-decoration: line-through;
}

&__pack-price {
font-size: 1rem;
}

&__variants {
.variant {
margin-bottom: 1.5rem;
Expand Down
28 changes: 12 additions & 16 deletions templates/catalog/_partials/product-discounts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@
*}
<section class="product__discounts js-product-discounts">
{if $product.quantity_discounts}
<p class="h6 product__discounts__title">{l s='Volume discounts' d='Shop.Theme.Catalog'}</p>

{block name='product_discount_table'}
<div class="table-wrapper border border-secondary py-2 px-0 px-md-3 mb-3">
<table class="table product__discounts__table w-100 mb-0">
<thead>
<table class="table product__discounts__table w-100 mb-3 text-center">
<thead>
<tr>
<th class="text-center">{l s='Quantity' d='Shop.Theme.Catalog'}</th>
<th class="text-center">{$configuration.quantity_discount.label}</th>
<th class="text-center">{l s='You Save' d='Shop.Theme.Catalog'}</th>
<th>{l s='Quantity' d='Shop.Theme.Catalog'}</th>
<th>{$configuration.quantity_discount.label}</th>
<th>{l s='You Save' d='Shop.Theme.Catalog'}</th>
</tr>
</thead>
</thead>

<tbody>
<tbody>
{foreach from=$product.quantity_discounts item='quantity_discount' name='quantity_discounts'}
<tr data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value}" data-discount-quantity="{$quantity_discount.quantity}">
<td class="text-center">{$quantity_discount.quantity}</td>
<td class="text-center">{$quantity_discount.discount}</td>
<td class="text-center">{$quantity_discount.save}</td>
<td>{$quantity_discount.quantity}</td>
<td>{$quantity_discount.discount}</td>
<td>{$quantity_discount.save}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</tbody>
</table>
{/block}
{/if}
</section>
106 changes: 57 additions & 49 deletions templates/catalog/_partials/product-prices.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@
{if $product.show_price}
<div class="product__prices js-product-prices">
{block name='product_price'}
<div class="prices__wrapper d-flex align-items-center mb-1">
<div class="product__current-price">
{capture name='custom_price'}{hook h='displayProductPriceBlock' product=$product type='custom_price' hook_origin='product_sheet'}{/capture}

{if '' !== $smarty.capture.custom_price}
{$smarty.capture.custom_price nofilter}
{else}
{$product.price}
{/if}
</div>

<div class="prices__wrapper d-flex flex-column gap-2 mb-4">
{if $product.has_discount}
<div class="product__discount">
{hook h='displayProductPriceBlock' product=$product type="old_price"}
Expand All @@ -33,51 +23,69 @@
{/if}
</div>
{/if}
</div>
{/block}

<div class="d-flex align-items-center gap-2">
<div class="product__current-price">
{capture name='custom_price'}{hook h='displayProductPriceBlock' product=$product type='custom_price' hook_origin='product_sheet'}{/capture}
{if '' !== $smarty.capture.custom_price}
{$smarty.capture.custom_price nofilter}
{else}
{$product.price}
{/if}
</div>

{** OTHER PRICES TO STLYE LATER *}
{block name='product_unit_price'}
{if $displayUnitPrice}
<p class="product__unit-price">{l s='(%unit_price%)' d='Shop.Theme.Catalog' sprintf=['%unit_price%' => $product.unit_price_full]}</p>
{/if}
{/block}
{block name='product_unit_price'}
{if $displayUnitPrice}
<div class="product__unit-price">
{l s='(%unit_price%)' d='Shop.Theme.Catalog' sprintf=['%unit_price%' => $product.unit_price_full]}
</div>
{/if}
{/block}
</div>

{block name='product_without_taxes'}
{if $priceDisplay == 2}
<p class="product__price-taxless">{l s='%price% tax excl.' d='Shop.Theme.Catalog' sprintf=['%price%' => $product.price_tax_exc]}</p>
{/if}
{/block}
{block name='product_pack_price'}
{if $displayPackPrice}
<div class="product__pack-price">
{l s='Instead of %price%' d='Shop.Theme.Catalog' sprintf=['%price%' => $noPackPrice]}
</div>
{/if}
{/block}

{block name='product_pack_price'}
{if $displayPackPrice}
<p class="product__pack-price">{l s='Instead of %price%' d='Shop.Theme.Catalog' sprintf=['%price%' => $noPackPrice]}</p>
{/if}
{/block}
<div class="product__tax-info d-flex align-items-start gap-2">
<div class="product__tax-label">
{if !$configuration.taxes_enabled}
{l s='No tax' d='Shop.Theme.Catalog'}
{elseif $configuration.display_taxes_label}
{$product.labels.tax_long}
{/if}

{hook h='displayProductPriceBlock' product=$product type="price"}
{hook h='displayProductPriceBlock' product=$product type="after_price"}
</div>

{* Separator *}
{if $configuration.display_taxes_label && $product.ecotax.amount > 0}<span class="product__sep-price"> - </span>{/if}

{block name='product_ecotax'}
{if $product.ecotax.amount> 0}
<div class="product__ecotax-price">
{l s='Including %amount% for ecotax' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.ecotax.value]}
{if $product.has_discount}
{l s='(not impacted by the discount)' d='Shop.Theme.Catalog'}
{/if}
</div>
{/if}
{/block}
</div>

{block name='product_ecotax'}
{if $product.ecotax.amount> 0}
<p class="product__ecotax-price">{l s='Including %amount% for ecotax' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.ecotax.value]}
{if $product.has_discount}
{l s='(not impacted by the discount)' d='Shop.Theme.Catalog'}
{block name='product_without_taxes'}
{if $priceDisplay == 2}
<p class="product__price-taxless">{l s='%price% tax excl.' d='Shop.Theme.Catalog' sprintf=['%price%' => $product.price_tax_exc]}</p>
{/if}
</p>
{/if}
{/block}
</div>
{/block}
{** OTHER PRICES TO STLYE LATER *}

{hook h='displayProductPriceBlock' product=$product type="weight" hook_origin='product_sheet'}

<div class="product__tax-label">
{if !$configuration.taxes_enabled}
{l s='No tax' d='Shop.Theme.Catalog'}
{elseif $configuration.display_taxes_label}
{$product.labels.tax_long}
{/if}

{hook h='displayProductPriceBlock' product=$product type="price"}

{hook h='displayProductPriceBlock' product=$product type="after_price"}
</div>
</div>
{/if}

0 comments on commit 60d1e51

Please sign in to comment.