123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <?php
- /**
- * FecShop file.
- *
- * @link http://www.fecshop.com/
- * @copyright Copyright (c) 2016 FecShop Software LLC
- * @license http://www.fecshop.com/license/
- */
- ?>
- <div class="content">
- <div class="content-block">
- <?= Yii::$service->page->widget->render('breadcrumbs',$this); ?>
- <div class="category_page">
- <div class="category_img">
- <a href="#">
- <?= $image ? '<img style="width:100%;" src="'.$image.'"/>' : '';?>
- <a>
- </div>
- <div class="category_description" >
- <h1><?= $name ?></h1>
- <?= $description ?>
- </div>
- <div class="sort_filter">
- <a href="#" class="category-open open-filter">Filter <span class="icon icon-caret"></span></a>
- <div class="clear"></div>
- </div>
- <div >
- <!-- 添加 class infinite-scroll 和 data-distance 向下无限滚动可不加infinite-scroll-bottom类,这里加上是为了和下面的向上无限滚动区分-->
- <div class=" infinite-scroll infinite-scroll-bottom" data-distance="10">
- <div class="list-block">
- <div class="list-container">
- <?php if(is_array($products) && !empty($products)): ?>
- <?php
- $parentThis['products'] = $products;
- $config = [
- 'view' => 'cms/home/index/product.php',
- ];
- echo Yii::$service->page->widget->renderContent('category_product_price',$config,$parentThis);
- ?>
- <?php else: ?>
- <?= Yii::$service->page->translate->__('Search results for \'{searchText}\' returns no results',['searchText' => $searchText]); ?>
- <?php endif; ?>
- </div>
- <!-- 加载提示符 -->
- <div class="infinite-scroll-preloader">
- <div class="preloader"></div>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
- <div class="popup popup-filter">
- <div class="content-block">
- <div class="close_popup">
- <a href="#" class="close-popup">×</a></p>
- </div>
- <?php
- # Refind By
- $parentThis = [
- 'refine_by_info' => $refine_by_info,
- ];
- $config = [
- 'view' => 'catalog/category/index/filter/refineby.php',
- ];
- echo Yii::$service->page->widget->renderContent('category_product_filter_refine_by',$config,$parentThis);
- ?>
- <?php
- # Category Left Filter subCategory
- $parentThis = [
- 'filter_category' => $filter_category,
- 'current_category'=> $name,
- ];
- $config = [
- 'view' => 'catalog/category/index/filter/subcategory.php',
- ];
- echo Yii::$service->page->widget->renderContent('category_product_filter_sub_category',$config,$parentThis);
- ?>
- <?php
- # Category Left Filter Product Attributes
- $parentThis = [
- 'filters' => $filter_info,
- ];
- $config = [
- 'view' => 'catalog/category/index/filter/attr.php',
- ];
- echo Yii::$service->page->widget->renderContent('category_product_filter_attr',$config,$parentThis);
- ?>
- <?php
- # Category Left Filter Product Price
- $parentThis = [
- 'filter_price' => $filter_price,
- ];
- $config = [
- 'view' => 'catalog/category/index/filter/price.php',
- ];
- echo Yii::$service->page->widget->renderContent('category_product_filter_price',$config,$parentThis);
- ?>
- </div>
- </div>
- <script>
- <?php $this->beginBlock('category_product_filter') ?>
- $(document).ready(function(){
- $(".product_sort").change(function(){
- url = $(this).find('option').not(function() {return !this.selected}).attr('url');
- window.location.href = url;
- });
- $(".product_num_per_page").change(function(){
- //url = $(this).find("option:selected").attr('url');
- url = $(this).find('option').not(function() {return !this.selected}).attr('url');
- window.location.href = url;
- });
-
- $(".filter_attr_info a").click(function(){
- if($(this).hasClass("checked")){
- $(this).removeClass("checked");
- }else{
- $(this).parent().find("a.checked").removeClass("checked");
- $(this).addClass("checked");
- }
- });
- $("img.lazy").each(function(){
- src = $(this).attr("data-src");
- $(this).attr("src",src);
- });
- });
- $(document).on('click','.open-filter', function () {
- $.popup('.popup-filter');
- });
-
- $(document).on('click','.open-sort', function () {
- $.popup('.popup-sort');
- });
- $(document).on("pageInit", "#page-infinite-scroll-bottom", function(e, id, page) {
- var loading = false;
- var pageNum = 1;
- var maxPage = <?= $page_count ? $page_count : 1 ?>;
- if(maxPage <= pageNum){
- $('.infinite-scroll-preloader').remove();
- }
- function addItems() {
- //alert(pageNum);
- pageNum++;
- var html = '';
- url = window.location.href;
- $.ajax({
- async:true,
- timeout: 60000,
- dataType: 'json',
- type:'get',
- data: {
- 'p':pageNum
- },
- url: url,
- success:function(data, textStatus){
- //alert(data);
- html = data.html;
- //alert(html);
- $('.infinite-scroll .list-container').append(html);
- $("img.lazy").each(function(){
- src = $(this).attr("data-src");
- $(this).attr("src",src);
- });
- },
- error:function (XMLHttpRequest, textStatus, errorThrown){}
- });
- }
-
- $(page).on('infinite', function() {
- //alert(222);
- if (loading) return;
- loading = true;
- if (pageNum >= maxPage) {
- $.detachInfiniteScroll($('.infinite-scroll'));
-
- $('.infinite-scroll-preloader').remove();
- return;
- }
- addItems();
- //alert(pageNum);
- loading = false;
- $.refreshScroller();
-
- });
- });
- $.init();
- <?php $this->endBlock(); ?>
- </script>
- <?php $this->registerJs($this->blocks['category_product_filter'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>
- <?= Yii::$service->page->trace->getTraceSearchJsCode($traceSearchData) ?>
|