فهرست منبع

상품리스트 sort 수정

bin2107 5 سال پیش
والد
کامیت
e9771bb0a9

+ 2 - 0
src/main/java/com/style24/persistence/domain/GoodsSearch.java

@@ -63,6 +63,8 @@ public class GoodsSearch extends TscBaseDomain {
     private String priceRow;
     private String dcrateHigh;
     private String dcrateRow;
+    private String sexGb;
+    private String newProd;
 
     private TscPageRequest pageable;				// 페이징
     private int pageNo = 1;

+ 35 - 3
src/main/java/com/style24/persistence/mybatis/shop/TsfDisplay.xml

@@ -769,6 +769,14 @@
 		           <if test="dcrateRow != null and dcrateRow != ''">
 		           AND    G.DC_RATE <![CDATA[>=]]> #{dcrateRow}
 		           </if>
+		           <if test="sexGb != null and sexGb != ''">
+		           AND    G.SEX_GB = #{sexGb}
+		           </if>
+		           <if test="newProd != null and newProd != ''">
+		           AND    EXISTS ( SELECT 1 FROM TB_GOODS_BENEFIT
+		                           WHERE GOODS_CD = G.GOODS_CD
+		                           AND BENEFIT_GB IN (#{newProd}) )
+		           </if>
 		           <include refid="getCategoryGoodsList_sql"/>
 		) G
 		WHERE  1 = 1
@@ -933,6 +941,15 @@
 		                <if test="dcrateRow != null and dcrateRow != ''">
 		                    AND    G.DC_RATE <![CDATA[>=]]> #{dcrateRow}
 		                </if>
+		                <if test="sexGb != null and sexGb != ''">
+		                    AND    G.SEX_GB = #{sexGb}
+		                </if>
+		                <if test="newProd != null and newProd != ''">
+		                    AND    EXISTS ( SELECT 1 FROM TB_GOODS_BENEFIT
+		                                    WHERE GOODS_CD = G.GOODS_CD
+		                                    AND BENEFIT_GB IN (#{newProd})
+		                        )
+		                </if>
 		                <include refid="getCategoryGoodsList_sql"/>
 		                ) G
 		          WHERE  1 = 1
@@ -967,9 +984,24 @@
 		                 , G.REG_DT             /*등록일시*/
 		                 , G.SELL_WEEK_QTY
 		                 , G.REVIEW_REG_CNT
-		                 , RANK() OVER(ORDER BY G.FORMAL_GB
-		                 , G.REG_DT DESC
-		                 , G.GOODS_CD) AS NUMB
+		                 <choose>
+		                    <when test="sortGb != null and sortGb !=''">
+		                        <choose>
+		                           <when test="sortGb == 'new'">
+		                 , RANK() OVER(ORDER BY G.FORMAL_GB , G.REG_DT DESC , G.GOODS_CD) AS NUMB
+		                           </when>
+		                           <when test="sortGb == 'best'">
+		                 , RANK() OVER(ORDER BY G.FORMAL_GB , G.SELL_WEEK_QTY DESC , G.REG_DT DESC, G.GOODS_CD) AS NUMB
+		                           </when>
+		                           <when test="sortGb == 'review'">
+		                 , RANK() OVER(ORDER BY G.FORMAL_GB , G.REVIEW_REG_CNT DESC , G.REG_DT DESC, G.GOODS_CD) AS NUMB
+		                           </when>
+		                        </choose>
+		                    </when>
+		                    <otherwise>
+		                 , RANK() OVER(ORDER BY G.FORMAL_GB , G.REG_DT DESC , G.GOODS_CD) AS NUMB
+		                    </otherwise>
+		                 </choose>
 		                 FROM TAB_GOODS G
 		                 LEFT OUTER JOIN TAB_OPTION O ON G.GOODS_CD = O.GOODS_CD
 		        ) ORIGINAL

+ 45 - 17
src/main/webapp/WEB-INF/views/web/display/CategoryGoodsListFormWeb.html

@@ -76,10 +76,10 @@
 								</ul>
 								<div class="form_field">
 									<div>
-										<input id="price" type="checkbox" ><label for="price"> <span>남여 공용만 보기</span> </label>
+										<input id="sexGb" type="checkbox" onclick="fnFilterOption(this,'on');"><label for="sexGb"> <span>남여 공용만 보기</span> </label>
 									</div>
 									<div>
-										<input id="chk-2" type="checkbox" checked=""><label for="chk-2"> <span>신상품만 보기</span> </label>
+										<input id="newProd" type="checkbox" onclick="fnFilterOption(this,'on');"><label for="newProd"> <span>신상품만 보기</span> </label>
 									</div>
 								</div>
 							</div>
@@ -222,16 +222,6 @@
 								<!-- 필터 -->
 								<div class="fillter">
 									<div class="fillter_box" id="filterData">
-										<!--										<span>-->
-										<!--											모이몰른-->
-										<!--											<a href="javascript:;" class="filter_delete"></a >-->
-										<!--										</span>-->
-										<!-- 컬러 표시 -->
-										<!--										<span>-->
-										<!--											<span class="pdColor-color12"></span>-->
-										<!--											<a href="javascript:;" class="filter_delete"></a >-->
-										<!--										</span>-->
-										<!-- 컬러 표시 -->
 									</div>
 									<button type="button" class="fillter_reset" onclick="fnFilterReset();"><span>전체 초기화</span></button>
 								</div>
@@ -251,15 +241,15 @@
 										<p><span id="totCntId"></span>개의 상품</p>
 									</div>
 									<div>
-										<ul>
+										<ul id="sortArea">
 											<li>
-												<a href="" class="on">최신상품순</a>
+												<a href="javascript:void(0);" class="on" onclick="fnSortList(this,'new');">최신상품순</a>
 											</li>
 											<li>
-												<a href="">인기상품순</a>
+												<a href="javascript:void(0);" onclick="fnSortList(this,'best');">인기상품순</a>
 											</li>
 											<li>
-												<a href="">리뷰 많은순</a>
+												<a href="javascript:void(0);" onclick="fnSortList(this,'review');">리뷰 많은순</a>
 											</li>
 										</ul>
 									</div>
@@ -294,7 +284,7 @@
 		<input type="hidden" name="cate2No" th:value="${cateInfo.cate2No}"/>
 		<input type="hidden" name="cate3No" th:value="${cateInfo.cate3No}"/>
 		<input type="hidden" name="cate4No" th:value="${cateInfo.cate4No}"/>
-		<input type="hidden" name="sortGb"/>
+		<input type="hidden" name="sortGb" value="new"/>
 	</form>
 
 	<script src="/ux/plugins/gaga/gaga.infinite.scrollSession.js"></script>
@@ -372,6 +362,33 @@
 			fnCreateCategoryList();
 		});
 
+		var fnFilterOption = function (obj, stat){
+			var thisId = $(obj).attr('id');
+			var tag = '';
+
+			if(thisId == 'sexGb'){
+				if(stat=='on'){
+					$(obj).attr('onclick','fnFilterOption(this,\'off\');');
+					tag += '<input type="hidden" name="sexGb" value="G007_Z"/>\n';
+					$("#searchGoodsForm").append(tag);
+				}else{
+					$(obj).attr('onclick','fnFilterOption(this,\'on\');');
+					$("#searchGoodsForm input:hidden[name=sexGb]").remove();
+				}
+			}else{
+				if(stat=='on'){
+					$(obj).attr('onclick','fnFilterOption(this,\'off\');');
+					tag += '<input type="hidden" name="newProd" value="40"/>\n';
+					$("#searchGoodsForm").append(tag);
+				}else{
+					$(obj).attr('onclick','fnFilterOption(this,\'on\');');
+					$("#searchGoodsForm input:hidden[name=newProd]").remove();
+				}
+			}
+			fnCategoryGoodsInfiniteScrollInit();
+			fnGoodsListSearch();
+		}
+
 		// 필터 가격 확인
 		var fnCheckPrice = function (data){
 			$("#priceSpan").remove();
@@ -666,6 +683,17 @@
 			}
 		});
 
+		var fnSortList = function (obj, sortGb){
+			$("#sortArea").find('li').each(function (){
+				$(this).find('a').attr('class','off');
+			});
+
+			$(obj).addClass("on");
+			$("#searchGoodsForm").find("[name=sortGb]").val(sortGb);
+			fnCategoryGoodsInfiniteScrollInit();
+			fnGoodsListSearch();
+		}
+
 		/*]]>*/
 	</script>