Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -106,23 +106,26 @@ echo $this -> settings['newsletter_header'];
|
||||
</td>
|
||||
<td style="text-align: right; white-space: nowrap; padding: 0 5px;">
|
||||
<?
|
||||
echo \Shared\Helpers\Helpers::decimal( $position['price_brutto_promo'] ) . ' zł';
|
||||
|
||||
if ( $position['price_brutto_promo'] and $position['price_brutto_promo'] < $position['price_brutto'])
|
||||
echo '<u style="font-size: 15px; font-weight: 400; color: #c3c3c3; margin-left: 5px; text-decoration: line-through;">' . \Shared\Helpers\Helpers::decimal( $position['price_brutto'] ) . ' zł</u>';
|
||||
|
||||
if ( $position['price_brutto_promo'] and $position['price_brutto_promo'] < $position['price_brutto'] )
|
||||
$discount += \Shared\Helpers\Helpers::normalize_decimal( ( $position['price_brutto'] - $position['price_brutto_promo'] ) * $position['quantity'] );
|
||||
$_promo = round( (float)$position['price_brutto_promo'], 2 );
|
||||
$_base = round( (float)$position['price_brutto'], 2 );
|
||||
if ( $_promo > 0 and $_promo < $_base ) {
|
||||
echo \Shared\Helpers\Helpers::decimal( $_promo ) . ' zł';
|
||||
echo '<u style="font-size: 15px; font-weight: 400; color: #c3c3c3; margin-left: 5px; text-decoration: line-through;">' . \Shared\Helpers\Helpers::decimal( $_base ) . ' zł</u>';
|
||||
$discount += \Shared\Helpers\Helpers::normalize_decimal( ( $_base - $_promo ) * $position['quantity'] );
|
||||
} else {
|
||||
echo \Shared\Helpers\Helpers::decimal( $_base ) . ' zł';
|
||||
}
|
||||
$_effective = ( $_promo > 0 and $_promo < $_base ) ? $_promo : $_base;
|
||||
?>
|
||||
</td>
|
||||
<td style="text-align: right; white-space: nowrap; padding: 0 5px;">
|
||||
<?= $position['quantity'];?>
|
||||
</td>
|
||||
<td style="text-align: right; white-space: nowrap; padding: 0 5px;">
|
||||
<?= \Shared\Helpers\Helpers::decimal( \Shared\Helpers\Helpers::normalize_decimal( $position['price_brutto_promo'] * $position['quantity'] ) );?> zł
|
||||
<?= \Shared\Helpers\Helpers::decimal( \Shared\Helpers\Helpers::normalize_decimal( $_effective * $position['quantity'] ) );?> zł
|
||||
</td>
|
||||
</tr>
|
||||
<? $summary += \Shared\Helpers\Helpers::normalize_decimal( $position['price_brutto'] * $position['quantity'] );?>
|
||||
<? $summary += \Shared\Helpers\Helpers::normalize_decimal( $_base * $position['quantity'] );?>
|
||||
<? $quantity += $position['quantity'];?>
|
||||
<? endforeach; endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user