|
|
|
|
제목 |
대분류 내에서 각각의 브랜드별 정렬을 하여 화면에 보여 주고 싶을때 쉬운 방법을 소개 합니다.  |
작성자 |
푸하라 |
조회 |
9,165 |
도메인 |
|
파일 |
|
등록일 |
2009-07-25 12:15:58 |
goods.class.php 에서 맨 하단에 브랜드별 데이터 추출하는곳을 넣습니다.
function getBrandName()
{
$strBrandList =array();
$ctpose = sprintf("and GDC.CTPOSE like '%s%%'",Lib::getParam('ctpose'));
$rlt = DBConn::dbQuery('SELECT name FROM tops_goods_brand');
while($dat=mysql_fetch_array($rlt))
{
$que = "select count(*)
as CntBrand
from
{$this->tbname['goods']} GD left join {$this->tbname['goods_sale']} GDS on GD.GDNO=GDC.GDNO, {$this->tbname['goods_cate']} GDC
where
GD.GDNO=GDS.GDNO
and GD.BRAND='$dat[name]'
$ctpose";
$rlt2 = DBConn::dbQuery($que);
$count = mysql_fetch_array($rlt2);
$strBrandList[$dat[name]] = "$dat[name] ($count[CntBrand])";
}
return $strBrandList;
}
function listGoods() 이곳에서 약간 소스를 수정해야되는데요..
$stand=Lib::getParam('stand');
$brandName=Lib::getParam('brandName');
if(!$stand) $_GET['stand']=$GoodsUser->dat_cate['LISTSTAND'];
$_SESSION['SQL_QUERY']['GOODS_STAND']=$stand;
switch($stand)
{
case 'level': $option='GDC.LEVEL'; $order='desc'; break;
case 'gdno_desc': $option='GD.GDNO'; $order='desc'; break;
case 'gdno_asc': $option='GD.GDNO'; $order='asc'; break;
case 'price_low': $option='GDS.PRICE_R'; $order='asc'; break;
case 'price_high': $option='GDS.PRICE_R'; $order='desc'; break;
case 'sale': $option='GD.TOTAL_SALE'; $order='desc'; break;
case 'view': $option='GDS.VIEW'; $order='desc'; break;
case 'brand': $option='GD.BRAND'; $order='desc'; break;
}
}
분을 이렇게 수정하시고여...
$que 라고 되어 있는 부분아래에 이한줄 추가 몇군데가 있던데 꼭 이줄 추가해주심되여...
if ($stand == 'brand')
$que .= "and GD.brand='$brandName'";
그리고 난후
shop_goods.php 라는곳에다가 template를 추가하시면 됩니다...
TPL 어쩌고로 되어 있는부분에 넣으시면 됩니다.
마지막으로 스킨에 적용하기 하심됩니다.
<b> Brand List</b><br/>
<?
$brandList = $TPL_VAR['BRAND_LIST'];
foreach($brandList as $k => $v)
{
printf('<A class="small" HREF="주소%s"> %s<br/></A>',$_GET['ctpose'],$k,$TPL_VAR['ROOT_SKIN'],$v);
}
그나저나 template를 사용하기위해서 루프 돌리는 방법등에 관련해서 자세한 정보가 없네용..
소스 찾아가면서 일일이 어디쯤 되어 있는지 분석하면서 봐야되서 만드신 개발자분만이 찾아내실수 있을듯 합니다. 그래서 넘깝깝합니다.
그래도 좋은소스 공유 해주셔서 넘 감사합니다.
|
|
 |
|
|
|
|
|
|
|
|
|
이용약관 |
프로그램소개 |
Tops와 프로모션
|
(주)제이터치 대표이사 이왕태 | 개인정보관리책임자: 이왕태 | 이메일: help@j-touch.com
서울특별시 성동구 하왕십리동 966-21 제3층 | 사업자등록번호: 206-86-69197 | 통신판매업번호: 제2012-서울성동-0626호
|
|
copyright © J-Touch All Rights Reserved.
|
|