zoukankan      html  css  js  c++  java
  • zencart在商品详细页,随机显示一定数量的同类产品

    1, 创建一个新文件 随意命名 没重复就行 例如:tpl_product_info_similar.php复制该文件到includes\templates\你的模板\templates\目录下,论坛里的人把它整理出来了。 

    下载地址:http://www.zen-cart.cn/forum/post380164.html#p380164

    2,找到includes\templates\你的模板\templates\tpl_product_info_display.php文件在相应的位置加上以下代码:

    <?php require($template->get_template_dir('tpl_product_info_similar.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_product_info_similar.php'); ?>

    一般可以加到<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>的上面或下面

    说明:

    1.ORDER BY rand() limit 12 找到这段 12就是显示的个数每行显示多少个。
    <td width="35%" align="center">
    35%; 每行大概显示3个

    设置每行显示多少可以改下面红色的代码

    <?php
    if($mn%3 == 0){
        echo "</tr>";$mn=0;
    }
    }
    if($mn<3){
        $cols = 3-$mn;
        echo "<td colspan='".$cols."'><td></tr>";
    }
    ?>

    3就是每行显示3个。

    这是我用了这文件的效果图:

  • 相关阅读:
    String与StringBuffer
    oracleSQL文
    中国IT成功人士特点6大成功密码全解析
    对java学习有帮助
    Spring之工厂模式
    搭建IBatis 框架
    单例模式(Singleton)
    UVa 10180 Rope Crisis in Ropeland!
    HDU 3711 Binary Number
    UVaLive 4643 / LA 4643 Twenty Questions(对题意的解释已修改)
  • 原文地址:https://www.cnblogs.com/lookyou/p/2132078.html
Copyright © 2011-2022 走看看