Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-05-31 00:31:24 +02:00
parent 326a834e98
commit c26eb99b18
10 changed files with 11015 additions and 441 deletions

View File

@@ -1,107 +1,104 @@
{if $product_combinations}
<div id="pdproductattributeslist" class="products">
<div id="pdproductattributeslist" class="products">
{if $block_heading}
<h3 class="idTabHrefShort page-product-heading">{l s='Select product combination' mod='pdproductattributeslist'}</h3>
{/if}
<table id="pdproductattributeslist_table" class="table table-striped table-bordered table-labeled tablesorter" width="100%">
<thead>
<tr>
<th class="product_image sorter-false filter-false">{l s='Image' mod='pdproductattributeslist'}</th>
<th class="product_variant">{l s='Variant' mod='pdproductattributeslist'}</th>
<th class="product_infos sorter-false filter-false">{l s='Product informations' mod='pdproductattributeslist'}</th>
{if $show_prices}
<th class="product_price">{l s='Price (tax incl.)' mod='pdproductattributeslist'}</th>
<th class="product_price">{l s='Price (tax excl.)' mod='pdproductattributeslist'}</th>
{/if}
<th class="product_qty">{l s='Quantity in stock' mod='pdproductattributeslist'}</th>
{if !$is_catalog}
<th class="product_btn sorter-false filter-false">{l s='Select quantity' mod='pdproductattributeslist'}</th>
{/if}
</tr>
</thead>
<tbody>
{foreach from=$product_combinations item=$combination}
<tr class="product_combination_{if ($combination@index % 2)}alternate_{/if}item">
<td data-column="{l s='Image' mod='pdproductattributeslist'}" class="option_image">
{if $block_heading}
<h3 class="idTabHrefShort page-product-heading">{l s='Select product combination' mod='pdproductattributeslist'}</h3>
{/if}
<table id="pdproductattributeslist_table" class="table table-striped table-bordered table-labeled tablesorter" width="100%">
<thead>
<tr>
<th class="product_image sorter-false filter-false">{l s='Image' mod='pdproductattributeslist'}</th>
<th class="product_variant">{l s='Variant' mod='pdproductattributeslist'}</th>
<th class="product_infos sorter-false filter-false">{l s='Product informations' mod='pdproductattributeslist'}</th>
{if $show_prices}
<th class="product_price">{l s='Price (tax incl.)' mod='pdproductattributeslist'}</th>
<th class="product_price">{l s='Price (tax excl.)' mod='pdproductattributeslist'}</th>
{/if}
<th class="product_qty">{l s='Quantity in stock' mod='pdproductattributeslist'}</th>
{if !$is_catalog}
<th class="product_btn sorter-false filter-false">{l s='Select quantity' mod='pdproductattributeslist'}</th>
{/if}
</tr>
</thead>
<tbody>
{foreach from=$product_combinations item=$combination}
<tr class="product_combination_{if ($combination@index % 2)}alternate_{/if}item">
<td data-column="{l s='Image' mod='pdproductattributeslist'}" class="option_image">
{foreach from=$combination.images item=$img}
<a href="{$img.large_default}" rel="group_{$combination.id_product_attribute}" class="{if ($img@index > 0)}hidden {/if}fancybox">
<img width="{$cartSize.width}" height="{$cartSize.height}" class="img img-fluid img-responsive" src="{$img.home_default}" alt="{$combination.attribute_name}" title="{$combination.attribute_name}" />
</a>
{/foreach}
{foreach from=$combination.images item=$img}
<a href="{$img.large_default}" rel="group_{$combination.id_product_attribute}" class="{if ($img@index > 0)}hidden {/if}fancybox">
<img class="img img-fluid img-responsive" src="{$img.home_default}" alt="{$combination.attribute_name}" title="{$combination.attribute_name}" />
</a>
{/foreach}
</td>
</td>
<td data-column="{l s='Product variant' mod='pdproductattributeslist'}" class="option_variant">
{$combination.attribute_name_html nofilter}
</td>
<td data-column="{l s='Product variant' mod='pdproductattributeslist'}" class="option_variant">
{$combination.attribute_name_html nofilter}
</td>
<td data-column="{l s='Informations' mod='pdproductattributeslist'}" class="option_infos text-xs-left">
<td data-column="{l s='Informations' mod='pdproductattributeslist'}" class="option_infos text-xs-left">
{if isset($combination.reference) AND $combination.reference}
{l s='Reference' mod='pdproductattributeslist'}: <b>{$combination.reference}</b>
{/if}
{if !empty($combination.ean13)}
<br />{l s='Ean' mod='pdproductattributeslist'}: <b>{$combination.ean13}</b>
{/if}
{if isset($combination.reference) AND $combination.reference}
{l s='Reference' mod='pdproductattributeslist'}: <b>{$combination.reference}</b>
{/if}
{if !empty($combination.ean13)}
<br />{l s='Ean' mod='pdproductattributeslist'}: <b>{$combination.ean13}</b>
{/if}
</td>
</td>
{if $show_prices}
<td data-column="{l s='Price tax incl.' mod='pdproductattributeslist'}" class="option_price">
<span class="price product-price">
{Tools::displayPrice($combination.price)}
</span>
{if $combination.price != $combination.price_old}
<br />
<span class="old_price">
{Tools::displayPrice($combination.price_old)}
</span>
{/if}
</td>
{if $show_prices}
<td data-column="{l s='Price tax incl.' mod='pdproductattributeslist'}" class="option_price">
<span class="price product-price">
{Tools::displayPrice($combination.price)}
</span>
{if $combination.price != $combination.price_old}
<br />
<span class="old_price">
{Tools::displayPrice($combination.price_old)}
</span>
{/if}
</td>
<td data-column="{l s='Price tax excl.' mod='pdproductattributeslist'}" class="option_price">
<span class="price product-price">
{Tools::displayPrice($combination.price_tax_excl)}
</span>
<br />
{if $combination.price_tax_excl != $combination.price_old_tax_excl}
<span class="old_price">
{Tools::displayPrice($combination.price_old_tax_excl)}
</span>
{/if}
</td>
{/if}
<td data-column="{l s='Price tax excl.' mod='pdproductattributeslist'}" class="option_price">
<span class="price product-price">
{Tools::displayPrice($combination.price_tax_excl)}
</span>
<br />
{if $combination.price_tax_excl != $combination.price_old_tax_excl}
<span class="old_price">
{Tools::displayPrice($combination.price_old_tax_excl)}
</span>
{/if}
</td>
{/if}
<td data-column="{l s='Quantity on stock' mod='pdproductattributeslist'}" class="option_price">
<b>{$combination.quantity}</b> {l s='pcs' mod='pdproductattributeslist'}
</td>
<td data-column="{l s='Quantity on stock' mod='pdproductattributeslist'}" class="option_price">
<b>{if $combination.quantity <= 10 }{$combination.quantity}{else}>10{/if}</b> {l s='pcs' mod='pdproductattributeslist'}
</td>
{if !$is_catalog}
<td data-id-product="{$combination.id_product|intval}" data-id-product-attribute="{$combination.id_product_attribute|intval}" data-column="{l s='Select quantity' mod='pdproductattributeslist'}" class="option_gty">
<div class="row extra-small-gutters product-quantity">
<input type="number" name="qty" inputmode="numeric" pattern="[0-9]*" class="quantity input-group form-control" min="0" value="0"/>
</div>
</td>
{/if}
</tr>
{/foreach}
{if !$is_catalog}
<td data-id-product="{$combination.id_product|intval}" data-id-product-attribute="{$combination.id_product_attribute|intval}" data-column="{l s='Select quantity' mod='pdproductattributeslist'}" class="option_gty">
<div class="row extra-small-gutters product-quantity">
<input type="number" name="qty" inputmode="numeric" pattern="[0-9]*" class="quantity input-group form-control" min="0" value="0" />
</div>
</td>
{/if}
</tr>
{/foreach}
</tbody>
</table>
<div class="footer_actions">
</tbody>
</table>
<div class="footer_actions">
<button
class="btn btn-lg btn-primary add-to-cart-pdproductattributeslist pull-right"
type="button">
{l s='Add selected to cart' mod='pdproductattributeslist'}
</button>
<button class="btn btn-lg btn-primary add-to-cart-pdproductattributeslist pull-right" type="button">
{l s='Add selected to cart' mod='pdproductattributeslist'}
</button>
</div>
</div>
{/if}
</div>
</div>
{/if}

View File

@@ -26,11 +26,9 @@
{foreach from=$product_combinations item=$combination}
<tr class="product_combination_{if ($combination@index % 2)}alternate_{/if}item">
<td data-column="{l s='Image' mod='pdproductattributeslist'}" class="option_image">
{foreach from=$combination.images item=$img}
<a href="{$img.large_default}" rel="group_{$combination.id_product_attribute}" class="{if ($img@index > 0)}hidden {/if}fancybox">
<img width="{$cartSize.width}" height="{$cartSize.height}" class="img img-fluid img-responsive" src="{$img.home_default}" alt="{$combination.attribute_name}" title="{$combination.attribute_name}" />
<img class="img img-fluid img-responsive" src="{$img.home_default}" alt="{$combination.attribute_name}" title="{$combination.attribute_name}" />
</a>
{/foreach}
@@ -79,7 +77,7 @@
{/if}
<td data-column="{l s='Quantity on stock' mod='pdproductattributeslist'}" class="option_price">
<b>{$combination.quantity}</b> {l s='pcs' mod='pdproductattributeslist'}
<b>{if $combination.quantity <= 10 }{$combination.quantity}{else}>10{/if}</b> {l s='pcs' mod='pdproductattributeslist'}
</td>
{if !$is_catalog}