duanletao9487 2017-11-16 14:00
浏览 30
已采纳

OpenCart 1.5.x.x ajax随机值

I have dynamic block with show and hide products from table on random sort. But when the cash page is active, this part of page stom showing products and show only first product from query ... i do not understand how can i make it work with this effect and show 10 product on random soring ... the query

$sql = "SELECT * FROM " . DB_PREFIX . "product";
$sql .= " WHERE sp_id = ".$id." AND show=1";
$sql .= " ORDER BY shop_id  asc";
$query = $this->db->query($sql);

return $query->row;

and part with ajax :

 <div id="content" class="group">
   <div id="backItem">
     <div id="footerItemContent">
     </div>
     <div id="footerItemDivider">-</div>
       <div id="footerItemCustomer">...</div>
       </div>
     </div>
   </div>
</div>

and my function

    $(document).ready(function() {
var products = function() {

    for ( var i = 0; i < complex.length; i++ ) {
        var name = complex[i]['pr_name'];
        var desc = complex[i]['pr_text'];
    }

var i = 0;
var fnchange = function() {
    $('#footerItemContent').animate({'opacity': 0}, 2000, function () {
        $(this).text(desc);
    }).animate({'opacity': 1}, 2500);
    $('#footerItemCustomer').animate({'opacity': 0}, 2000, function () {
        $(this).text(name);
    }).animate({'opacity': 1}, 2500);
    if( ++i < json.length ){
        setTimeout(fnchange, 10000);
    } else {
        i = 0;
        setTimeout(fnchange, 10000);
    }
};
setTimeout(fnchange, 1);
};
setTimeout(feedbacks,1);
  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 求无向连通网的所有不同构的最小生成树
      • ¥15 实现0.5秒间隔的单向流水灯
      • ¥30 网络操作系统问题求解
      • ¥30 blob下载word后内容不对
      • ¥15 前端和swagger调导出接口乱码
      • ¥20 有没有ftps服务器可以使用公钥登录的?
      • ¥20 Ffmpeg代码层面如何实现视频陪速播放
      • ¥15 用python定义函数实现功能使用列表中动漫信息
      • ¥15 unity 使用 Vuforia 导入Model target 成功后database下拉菜单不显示导入的内容
      • ¥15 VBA跨工作簿获取目标工作簿内已有数据的列号