Skip to content

CHICPRO

  • Life Log
  • Cycling Log
  • Photo Log
    • Portrait
    • Landscape
    • Flower
    • Etc
  • Coding Log
  • Information

쇼핑몰에서 사용할 오늘 본 상품 관련 코드

2012-06-05 by 편리

<?php
if (!defined(“_GNUBOARD_”)) exit; // 개별 페이지 접근 불가

$product_length = 3;
$tv_idx = get_session(“ss_tv_idx”);
?>

<?php if($tv_idx) { ?>
<div id=”TodayView”>
    <div class=”tv_title”></div>
    <div class=”tv_product”>
        <div>
            <ul>
                <?php
                for ($i=1; $i<=$tv_idx; $i++) {
                    $tv_it_id = get_session(“ss_tv[$i]”);
                    $rowx = sql_fetch(” select it_id, it_name, ca_id from $g4[shop_item_table] where it_id = ‘$tv_it_id’ “);
                    $it_name = get_text(addslashes($rowx[‘it_name’]));
                    $href = “$g4[shop_path]/item.php?ca_id=$rowx[ca_id]&it_id=$rowx[it_id]”;

                    $file = “{$rowx[it_id]}_lt”;
                    //get_item_image(파일명, 가로크기, 세로크기, noimage파일, alt)
                    $img = get_list_image($file, 73, 58, “$g4[img_path]/noimage.jpg”, $it_name);

                    $tv_product = “<a href=”$href”>” . $img . “</a>”;
                ?>
                <li><?php echo $tv_product; ?></li>
                <?php
                }
                ?>
            </ul>
        </div>
    </div><!– /tv_product –>
    <div class=”tv_navi”><img src=”<?php echo $g4[shop_img_path]; ?>/todayview_btn_up.png” id=”todayviewUp” class=”pointer” /><img src=”<?php echo $g4[shop_img_path]; ?>/todayview_btn_down.png” id=”todayviewDown” class=”pointer” /></div>
</div><!– /TodayView –>
<?php } ?>
<div id=”DlPrice”><img src=”<?php echo $g4[shop_img_path]; ?>/todayview_delivery.png” class=”send_cost_info pointer” alt=”지역별 배송비확인” /></div>

<script type=”text/javascript”>
var product_length = parseInt(“<?php echo $product_length; ?>”);
var tv_idx = parseInt(“<?php echo $tv_idx; ?>”);
var up_click_count = down_click_count = 0;

$(function() {
    if(tv_idx > product_length) {
        $(‘div.tv_product’).height(210);
        $(‘#todayviewUp’).addClass(“pointer”);
        up_click_count = Math.ceil(tv_idx / product_length) – 1;
    }

    $(‘#todayviewUp’).click(function() {
        if(up_click_count) {
            var div_position = parseInt($(‘div.tv_product div’).css(“top”));

            $(‘div.tv_product div’).stop().animate(
                { “top”: div_position – 210 }, 500,
                function() {
                    up_click_count–;
                    down_click_count++;
                }
            );
        } else {
            alert(“오늘 본 상품 마지막입니다.”);
        }
    });

    $(‘#todayviewDown’).click(function() {
        if(down_click_count) {
            var div_position = parseInt($(‘div.tv_product div’).css(“top”));

            $(‘div.tv_product div’).stop().animate(
                { “top”: div_position + 210 }, 500,
                function() {
                    up_click_count++;
                    down_click_count–;
                }
            );
        } else {
            alert(“오늘 본 상품 처음입니다.”);
        }
    });
});
</script>

대충 짜보긴 했는데.. 이거 제대로 한 건지 모르겠다. 머리가 멍해져서 대충 테스트 하니 맞는 것 같은데.. 에혀!~

Post navigation

Previous Post:

갤럭시 넥서스 OTA 업데이트

Next Post:

모델 촬영?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • php 배열 연산에서 + 와 array_merge 의 차이
  • pcntl_fork 를 이용한 다중 프로세스 실행
  • 아이폰 단축어를 이용하여 주중 공휴일엔 알람 울리지 않게 하기
  • 구글 캘린더 전체일정 재동기화
  • OpenLiteSpeed 웹서버에 HTTP 인증 적용
  • OpenLiteSpeed 웹어드민 도메인 연결
  • WireGuard를 이용한 VPN 환경 구축
  • Ubuntu 22.04 서버에 OpenLiteSpeed 웹서버 세팅
  • 맥 vim 세팅
  • 우분투 시스템 터미널쉘 zsh 로 변경

Recent Comments

  • 편리 on 업무관리용 그누보드 게시판 스킨
  • 임종섭 on 업무관리용 그누보드 게시판 스킨
  • 캐논 5D 펌웨어 | Dslr 펌웨어 업그레이드 방법 82 개의 베스트 답변 on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • Top 5 캐논 5D 펌웨어 Top 89 Best Answers on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • 편리 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 임팀장 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 편리 on Notepad++ NppFTP 플러그인 수동 설치
  • paul-j on Notepad++ NppFTP 플러그인 수동 설치
  • YS on Windows 10 iCloud 사진 저장 폴더 변경
  • 편리 on Docker를 이용한 Centos7 + httpd + php 5.4 개발환경 구축

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2025 CHICPRO | Built using WordPress and SuperbThemes