Opencart减少了从数据库中获取太多数据的加载时间

时间:2013-01-03 07:12:20

标签: loading opencart reduce

我在商店中使用属性过滤器选项。为此,我在管理视图模板中使用以下代码。这将从数据库中获取所有属性,并使用jquery选项卡隐藏所有不活动的选项卡。

我面临的问题是加载时间。我的商店里有超过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 } ?>

0 个答案:

没有答案