Jump to content

产品页面的"in the same categories"可以改成显示固定产品个数吗?


Guest Steven_king

Recommended Posts

产品页面的"in the same categories"可以改成显示固定产品个数吗?

因为一个目录里产品太多会严重影响页面下载速度。

改成两行,固定产品个数。

可以实现吗?

Link to comment
Share on other sites

这不是a cake walk。以下仅供参考,未测试:

1. 修改/modules/productscategory/productscategory.php里$sizeOfCategoryProducts的几个value,以固定显示产品个数

2. 修改/modules/productscategory/productscategory.tpl,去除productscategory.js效果;根据“两行”的产品个数修改相应的smarty和html

建议:备份后再行修改。

Link to comment
Share on other sites

这问题确实比较麻烦,感谢回答。


productscategory.php 要修改的估计就以下几处,但不知怎么改,对代码不是很熟:

       // Get infos
       $sizeOfCategoryProducts = $category->getProducts(intval($cookie->id_lang), 1, 30, NULL, NULL, true);
       $categoryProducts = $category->getProducts(intval($cookie->id_lang), 1, $sizeOfCategoryProducts);



    // If products tab higher than 30, slice it
       if ($sizeOfCategoryProducts > 30)
       {
           $categoryProducts = array_slice($categoryProducts, $middlePosition - 15, 30, true);
           $middlePosition = 15;
       }



----------------------
productscategory.tpl换行应该在这里改,但不知怎么改:

 5}style="width: {math equation="width * nbImages" width=107 nbImages=$categoryProducts|@count}px"{/if}>
       {foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}

getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category)}" title="{$categoryProduct.name|htmlspecialchars}">
getImageLink($categoryProduct.link_rewrite, $categoryProduct.id_image, 'medium')}" alt="{$categoryProduct.name|htmlspecialchars}" />


getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category)}" title="{$categoryProduct.name|htmlspecialchars}">
           {$categoryProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'}


       {/foreach}




请版主指教,万分感谢!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...