我在我的商店中使用属性过滤器选项。为此,我在管理视图模板中使用以下代码。这将从数据库中获取所有属性,并使用 jquery 选项卡隐藏所有不活动的选项卡。
我面临的奇怪问题是LOADING TIME。我的商店里有超过 5k 种产品。所以检索所有属性需要很长时间(我认为是这样)。在这种情况下,有人知道减少加载时间吗?
<div id="tab-subcategory-<?php echo $category['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $category['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/><?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $category['category_id']; ?>" type="hidden" value="<?php echo $category['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?> <img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($category['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $category['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php
} ?>
</tbody>
</table>
</div>
<?php foreach ($category['children'] as $child) { ?>
<div id="tab-subcategory-<?php echo $category['category_id']; ?>-<?php echo $child['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $child['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/>
<?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $child['category_id']; ?>" type="hidden" value="<?php echo $child['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($child['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $child['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php foreach ($child['sisters_id'] as $sister) { ?>
<div id="tab-subcategory-<?php echo $category['category_id']; ?>-<?php echo $child['category_id']; ?>-<?php echo $sister['category_id']; ?>" class="htabs-content">
<input name="VALORES_<?php echo $sister['category_id']; ?>" type="checkbox" value="1" onclick="Selecbox(this);"/>
<?php echo $entry_all_values; ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>" type="hidden" value="<?php echo $sister['category_id']; ?>" />
<table width="100%" border="0" cellpadding="2" class="list">
<thead>
<tr>
<td class="left"><?php echo $entry_value; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_values_explanation; ?>" /></td>
<td class="left"><?php echo $entry_separator; ?><img src="view/image/information.png" width="15" height="15" hspace="10" border="0" align="absmiddle" class="tooltip" title="<?php echo $entry_separator_explanation; ?>" /></td>
<td class="left"><?php echo $entry_examples; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($sister['attributes'] as $attribute) { ?>
<tr>
<td class="left">
<?php if ($attribute['checked']) { ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" checked="checked" /><?php echo $attribute['name']; ?>
<?php }else{ ?>
<input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][attribute_id]" type="checkbox" value="<?php echo $attribute['attribute_id']; ?>" /><?php echo $attribute['name']; ?>
<?php } ?>
</td>
<td class="left"><input name="VALORES_<?php echo $sister['category_id']; ?>[attributes][<?php echo $attribute['attribute_id']; ?>][separator]" type="text" value="<?php echo $attribute['separator']; ?>" size="5"/></td>
<td class="left">
<?php foreach ($languages as $language) { ?>
<select name="select" id="select<?php echo $language; ?>" style="width: 150px" >
<?php
if ($attribute['attribute_values'][$language['language_id']]){
natsort($attribute['attribute_values'][$language['language_id']]);
foreach ($attribute['attribute_values'][$language['language_id']] as $valores_default){ ?>
<option><?php echo trim($valores_default); ?></option>
<?php } ?>
<?php }else{ ?>
<option> <?php echo $text_none; ?></option>
<?php } ?>
</select><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<?php } ?>