Skip to content

Commit

Permalink
Feat: 장바구니 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterticket committed Dec 10, 2023
1 parent c11e0f8 commit 09daf3d
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<action name="dispHotopayAdminPurchaseList" type="view" />
<action name="dispHotopayAdminPurchaseData" type="view" />
<action name="dispHotopayAdminNotification" type="view" />
<action name="dispHotopayAdminCartList" type="view" />

<action name="procHotopayAdminInsertConfig" type="controller" />
<action name="procHotopayAdminInsertPaymentGatewayConfig" type="controller" />
Expand Down
20 changes: 20 additions & 0 deletions hotopay.admin.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,24 @@ public function dispHotopayAdminDeleteProductExtraInfo()
// 스킨 파일 지정
$this->setTemplateFile('delete_productextrainfo');
}

public function dispHotopayAdminCartList()
{
// 현재 설정 상태 불러오기
$config = $this->getConfig();
$vars = Context::getRequestVars();

// Context에 세팅
Context::set('hotopay_config', $config);

$output = HotopayModel::getCartItemList();
Context::set('cart_item_list', $output->data);
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('page_navigation', $output->page_navigation);

// 스킨 파일 지정
$this->setTemplateFile('index_cartlist');
}
}
11 changes: 11 additions & 0 deletions hotopay.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1173,4 +1173,15 @@ public function updatePurchaseItemSubscriptionSrl(int $item_srl, int $subscripti

return new BaseObject();
}

public static function getCartItemList()
{
$output = executeQueryArray('hotopay.getCartItemList');
if(!$output->toBool())
{
throw new \Rhymix\Framework\Exceptions\DBError(sprintf("DB Error: %s in %s line %s", $output->getMessage(), __FILE__, __LINE__));
}

return $output;
}
}
36 changes: 36 additions & 0 deletions queries/getCartItemList.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<query id="getCartItemList" action="select">
<tables>
<table name="hotopay_cart" />
<table name="hotopay_product" type="left join">
<conditions>
<condition operation="equal" column="hotopay_product.product_srl" default="hotopay_cart.product_srl" />
</conditions>
</table>
<table name="hotopay_product_option" type="left join">
<conditions>
<condition operation="equal" column="hotopay_product_option.option_srl" default="hotopay_cart.option_srl" />
</conditions>
</table>
</tables>
<columns>
<column name="hotopay_cart.*" />
<column name="hotopay_product.product_name" />
<column name="hotopay_product.product_status" />
<column name="hotopay_product.product_pic_src" />
<column name="hotopay_product.document_srl" />
<column name="hotopay_product.tax_rate" />
<column name="hotopay_product_option.title" alias="option_title" />
<column name="hotopay_product_option.description" alias="option_description" />
<column name="hotopay_product_option.price" alias="option_price" />
<column name="hotopay_product_option.stock" alias="stock" />
<column name="hotopay_product_option.status" alias="option_status" />
</columns>
<conditions>
</conditions>
<navigation>
<index var="sort_index" default="cart_item_srl" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>
1 change: 1 addition & 0 deletions tpl/__header.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h1>{$lang->cmd_hotopay} <!--@if($isLicenseValid)--><span style="color: rgb(247,
<li class="x_active"|cond="$act == 'dispHotopayAdminPurchaseList' || $act == 'dispHotopayAdminInsertPurchase'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispHotopayAdminPurchaseList')}">결제 목록</a></li>
<li class="x_active"|cond="$act == 'dispHotopayAdminSubscriptionIndex'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispHotopayAdminSubscriptionIndex')}">정기결제 목록</a></li>
<li class="x_active"|cond="$act == 'dispHotopayAdminBillingKeyIndex'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispHotopayAdminBillingKeyIndex')}">결제수단 목록</a></li>
<li class="x_active"|cond="$act == 'dispHotopayAdminCartList'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispHotopayAdminCartList')}">카트 목록</a></li>
</ul>

<!--@if(\Rhymix\Framework\Router::getRewriteLevel() != 2)-->
Expand Down
88 changes: 88 additions & 0 deletions tpl/index_cartlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<include target="__header.html" />

<h1>카트 목록</h1>

<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>

<div></div>
<table id="cartList" class="x_table x_table-striped x_table-hover">
<caption>
<strong>Total: {number_format($total_count)}, Page: {number_format($page)}/{number_format($total_page)}</strong>
</caption>
<thead>
<tr>
<th scope="col">아이템 번호</th>
<th scope="col">회원</th>
<th scope="col">상품명</th>
<th scope="col">상품 옵션</th>
<th scope="col">수량</th>
<th scope="col">금액</th>
<th scope="col">카트 등록일</th>
<th scope="col">상세</th>
</tr>
</thead>
<tbody>
<tr loop="$cart_item_list => $no,$val">
{@
$member_data = MemberModel::getMemberInfoByMemberSrl($val->member_srl);
}
<td class="nowr">{$val->cart_item_srl}</td>
<td class="nowr"><a href="#popup_menu_area" class="member_{$val->member_srl}">{$member_data->nick_name}</a> ({$val->member_srl})</td>
<td class="nowr">{$val->product_name}<!--@if($val->product_status != 'selling')--> (삭제됨)<!--@endif--></td>
<td class="nowr">{$val->option_title}</td>
<td class="nowr">{number_format($val->quantity)}</td>
<td class="nowr">₩{number_format($val->option_price * (($val->tax_rate/100) + 1))}</td>
<td class="nowr">{date('Y-m-d H:i:s', strtotime($val->regdate))}</td>
<td class="nowr"><a href="{getUrl('act','dispHotopayAdminModifyProduct','product_srl',$val->product_srl)}" title="상품정보">상품정보</a></td>
</tr>
<tr cond="!$cart_item_list">
<td>{$lang->msg_not_exist_data}</td>
</tr>
</tbody>
</table>

<div class="x_clearfix">
<form cond="$page_navigation" action="./" class="x_pagination x_pull-left" no-error-return-url="true" style="margin-top:0">
<input loop="$param => $key, $val" cond="!in_array($key, array('mid', 'vid', 'act'))" type="hidden" name="{$key}" value="{$val}" />
<ul>
<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>
<block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page">
{@$isGoTo = true}
<li>
<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
<span cond="$isGoTo" id="goTo" class="x_input-append">
<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
<button type="submit" class="x_add-on">Go</button>
</span>
</li>
</block>
<!--@while($page_no = $page_navigation->getNextPage())-->
{@$last_page = $page_no}
<li class="x_active"|cond="$page_no == $page"><a href="{getUrl('page', $page_no)}">{$page_no}</a></li>
<!--@end-->
<block cond="$last_page != $page_navigation->last_page && $last_page + 1 != $page_navigation->last_page">
{@$isGoTo = true}
<li>
<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
<span cond="$isGoTo" id="goTo" class="x_input-append">
<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
<button type="submit" class="x_add-on">Go</button>
</span>
</li>
</block>
<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}" title="{$page_navigation->last_page}">{$lang->last_page} &raquo;</a></li>
</ul>
</form>
<a class="x_pull-right x_btn x_btn-inverse" href="{getUrl('','module','admin','act','dispHotopayAdminInsertBillingKey')}">{$lang->cmd_make}</a>
</div>
<form action="./" method="get" class="search center x_input-append" no-error-return-url="true">
<input type="hidden" name="module" value="{$module}" />
<select name="search_target" title="{$lang->search_target}" style="margin-right:4px">
<option value="key_idx" selected="selected"|cond="$search_target=='key_idx'">{$lang->key_idx}</option>
</select>
<input type="search" required name="search_keyword" value="{htmlspecialchars($search_keyword)}" />
<button class="x_btn x_btn-inverse" type="submit">{$lang->cmd_search}</button>
<a class="x_btn" href="{getUrl('', 'module', $module, 'act', $act)}">{$lang->cmd_cancel}</a>
</form>

0 comments on commit 09daf3d

Please sign in to comment.