index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. ?>
  10. <div class="main container two-columns-left">
  11. <?php // echo count($products); ?>
  12. <?php $count = 4; $end = $count-1; ?>
  13. <div class="col-main">
  14. <?= Yii::$service->page->widget->render('breadcrumbs',$this); ?>
  15. <div class="menu_category">
  16. <?php if(is_array($products) && !empty($products)): ?>
  17. <div class="panelBar">
  18. <?php
  19. $parentThis = [
  20. 'query_item' => $query_item,
  21. 'product_page'=>$product_page,
  22. ];
  23. $config = [
  24. 'view' => 'catalogsearch/index/index/toolbar.php',
  25. ];
  26. $toolbar = Yii::$service->page->widget->renderContent('category_toolbar',$config,$parentThis);
  27. echo $toolbar;
  28. ?>
  29. </div>
  30. <div class="category_product">
  31. <?php $i = 0; foreach($products as $product): ?>
  32. <?php if(isset($product['sku']) && $product['sku']): ?>
  33. <?php if($i%$count == 0): ?>
  34. <ul>
  35. <?php endif; ?>
  36. <li>
  37. <div class="c_img">
  38. <a href="<?= $product['url'] ?>">
  39. <img class="js_lazy" src="<?= Yii::$service->image->getImgUrl('images/lazyload.gif'); ?>" data-original="<?= Yii::$service->product->image->getResize($product['image'],[230,230],false) ?>" />
  40. </a>
  41. </div>
  42. <div class="c_name">
  43. <a href="<?= $product['url'] ?>">
  44. <?= $product['name'] ?>
  45. </a>
  46. </div>
  47. <?php
  48. $config = [
  49. 'class' => 'fecshop\app\appfront\modules\Catalog\block\category\Price',
  50. 'view' => 'catalog/category/price.php',
  51. 'price' => $product['price'],
  52. 'special_price' => $product['special_price'],
  53. ];
  54. echo Yii::$service->page->widget->renderContent('category_product_price',$config);
  55. ?>
  56. </li>
  57. <?php if($i%$count == $end): ?>
  58. </ul>
  59. <?php endif; ?>
  60. <?php $i++; ?>
  61. <?php endif; ?>
  62. <?php endforeach; ?>
  63. <?php if($i%$count != $end): ?>
  64. </ul>
  65. <?php endif; ?>
  66. </div>
  67. <div class="clear"></div>
  68. <div class="panelBar">
  69. <?php echo $toolbar; ?>
  70. </div>
  71. <?php else: ?>
  72. <?= Yii::$service->page->translate->__('Search results for \'{searchText}\' returns no results',['searchText' => $searchText]); ?>
  73. <?php endif; ?>
  74. </div>
  75. </div>
  76. <div class="col-left ">
  77. <?php
  78. # Refind By
  79. $parentThis = [
  80. 'refine_by_info' => $refine_by_info,
  81. ];
  82. $config = [
  83. 'view' => 'catalog/category/index/filter/refineby.php',
  84. ];
  85. echo Yii::$service->page->widget->renderContent('category_product_filter_refine_by',$config,$parentThis);
  86. ?>
  87. <?php
  88. # Category Left Filter Product Attributes
  89. $parentThis = [
  90. 'filters' => $filter_info,
  91. ];
  92. $config = [
  93. 'view' => 'catalog/category/index/filter/attr.php',
  94. ];
  95. echo Yii::$service->page->widget->renderContent('category_product_filter_attr',$config,$parentThis);
  96. ?>
  97. <?php
  98. # Category Left Filter Product Price
  99. $parentThis = [
  100. 'filter_price' => $filter_price,
  101. ];
  102. $config = [
  103. 'view' => 'catalog/category/index/filter/price.php',
  104. ];
  105. echo Yii::$service->page->widget->renderContent('category_product_filter_price',$config,$parentThis);
  106. ?>
  107. </div>
  108. <div class="clear"></div>
  109. </div>
  110. <script>
  111. <?php $this->beginBlock('category_product_filter') ?>
  112. $(document).ready(function(){
  113. $(".product_sort").change(function(){
  114. url = $(this).find("option:selected").attr('url');
  115. window.location.href = url;
  116. });
  117. $(".product_num_per_page").change(function(){
  118. url = $(this).find("option:selected").attr('url');
  119. window.location.href = url;
  120. });
  121. $(".filter_attr_info a").click(function(){
  122. if($(this).hasClass("checked")){
  123. $(this).removeClass("checked");
  124. }else{
  125. $(this).parent().find("a.checked").removeClass("checked");
  126. $(this).addClass("checked");
  127. }
  128. });
  129. });
  130. <?php $this->endBlock(); ?>
  131. </script>
  132. <?php $this->registerJs($this->blocks['category_product_filter'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>
  133. <?= Yii::$service->page->trace->getTraceSearchJsCode($traceSearchData) ?>