当前位置: 首页 > PbootCMS教程 > Pbootcms自定义产品参数实现多级自由筛选

Pbootcms自定义产品参数实现多级自由筛选

源码商城 / 2022-01-12
[] [] []

在使用PBOOTCMS建设网站的时候出现一个客户特殊需求,在众多产品分类且每个分类都有大量自定义参数前提下,进行目标产品的自由筛选;实现效果如下:

Pbootcms自定义产品参数实现多级自由筛选

具体实现方法如下:

第一步、制作前端筛选模板;

在所需要设置筛选的模板里面进行添加以下代码:

<div class="fo-section fo-padding-top fo-padding-bottom filter section-filterproduct" data-section="filter"> 
<div class="container" data-filter-section="filterproduct"> 
<div class="row row-small-gutter fo-neighbor"> 
{pboot:nav parent=5 num=21}
<div class="col-md-3 col-6"><div class="filter-item text-body text-truncate {pboot@if([nav:i]==1)}active{/pboot@if}" data-mcode="[nav:mcode]" data-scode="[nav:scode]"> [nav:name] </div></div> 
{/pboot:nav}
</div> 
<div class="filter-params fo-neighbor" data-filter-params="filterproduct"></div> 
<div class="filter-goods fo-neighbor" data-filter-goods="filterproduct"></div>
</div>
<script type="text/html" id="filterParams">
{{each column o index}}
<div class="filter-params-content" data-property="{{index}}">
<label class="filter-params-item primary">
{{o.title}}
</label>
<label class="filter-params-item all">
全部
</label>
{{each o.value sub}}
<label class="filter-params-item">
{{sub}}
</label>
{{/each}}
</div>
{{/each}}
</script>
<script type="text/html" id="filterGoods">
<div class="table-responsive d-md-block d-none">
<table class="table table-bordered table-hover">
<thead class="thead-dark">
<tr>
<th>
产品名称
</th>
{{each column o}}
<th>
{{o.title}}
</th>
{{/each}}
</tr>
</thead>
<tbody>
{{each items o}}
{{if o.active}}
<tr>
<td>
<a href="{{o.url}}" target="_blank">{{o.name}}</a>
</td>
{{each column p}}
<td>
{{o.params[p.title] || ''}}
</td>
{{/each}}
</tr>
{{/if}}
{{/each}}
</tbody>
</table>
</div>
<div class="filter-slides d-block d-md-none">
{{each items o}}
{{if o.active}}
<div class="filter-slide">
<h3 class="text-heading fo-icon-down">
{{o.name}}
</h3>
<a href="{{o.url}}">
<div class="filter-slide-content">
<p>{{o.name}}</p>
{{each column p}}
{{if o.params[p.title]}}
<p>
{{p.title}}: {{o.params[p.title]}}
</p>
{{/if}}
{{/each}}
</div>
</a>
</div>
{{/if}}
{{/each}}
</div>
</script> 
</div>

在以上的代码中已经包括了数据封闭;

第二步、前端实例化解析

在第一步代码所在文件中添加以下解析代码:

<script>fo.init({siteId:"1363654298283708417",title:"{pboot:companyname}",lang:"cn",design:false,rootURL:"/",env:"test",pageId:"1363654408820396034",pageType:"productDetail",collectionId:""});</script>

第三步、调用封闭数据对应的JS文件

<script src="{pboot:sitetplpath}/js/vue.js"></script>
<script src="{pboot:sitetplpath}/js/fo.js"></script>
<script src="{pboot:sitetplpath}/js/fo.regular.js"></script>

以上三个JS文件下载地址如下:

2021121414382646

第四步、调用前端页面展示样式

将以下样式调用添加至上述步骤所在文件中:

<link rel="stylesheet" href="/images/fo.css"> 
<link rel="stylesheet" href="/images/base.css">

以上两个样式文件下载地址如下:

2021121414400745

本文链接:http://www.365ymw.com/article-1734.html 转载请保留出处,谢谢!

中查找“Pbootcms自定义产品参数实现多级自由筛选”更多相关内容

用户评论

暂时还没有任何用户评论
用户名: 匿名用户
E-mail:
评价等级:
评论内容:
验证码: captcha

浏览历史

免责条款 | 隐私保护 | 联系我们 | 公司简介 | 报价单 | 积分商城 | 留言板
Copyright © 2010-2024 365ymw.com All Rights Reserved. 365源码商城
免责声明:部分图片素材及板块内容来自网络,如有侵犯您的权益,请联系我们,站长会立即处理!
备案号:鄂ICP备2024039974号