Created
January 11, 2013 11:34
-
-
Save gomasaba/4510086 to your computer and use it in GitHub Desktop.
ECCUBEで管理画面に前後の商品リンクメモ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 前後の商品 | |
* | |
*/ | |
public function neighbors($product_id){ | |
$objQuery =& SC_Query_Ex::getSingletonInstance(); | |
//prev | |
$objQuery->setOrder('product_id DESC'); | |
$objQuery->setLimit('1'); | |
$prev = $objQuery->select('product_id','dtb_products','del_flg = 0 and product_id < ?', array($product_id)); | |
//next | |
$objQuery->setOrder('product_id ASC'); | |
$objQuery->setLimit('1'); | |
$next = $objQuery->select('product_id','dtb_products','del_flg = 0 and product_id > ?', array($product_id)); | |
return array( | |
'prev'=>(empty($prev))? false : $prev[0]['product_id'], | |
'next'=>(empty($next))? false : $next[0]['product_id'], | |
); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form name="form0" id="form1" method="post" action="?" enctype="multipart/form-data"> | |
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> | |
<input type="hidden" name="product_id" value="<!--{$arrForm.product_id|h}-->" /> | |
<input type="hidden" name="mode" value="pre_edit" /> | |
<div style="text-align:right;"> | |
<!--{if $neighbors.prev}--> | |
<a class="btn-action" href="<!--{$smarty.const.ROOT_URLPATH}-->" onclick="fnFormModeSubmit('form0','pre_edit', 'product_id', <!--{$neighbors.prev}-->); return false;" >前の商品を編集</a> | |
<!--{/if}--> | |
<!--{if $neighbors.next}--> | |
<a class="btn-action" href="<!--{$smarty.const.ROOT_URLPATH}-->" onclick="fnFormModeSubmit('form0','pre_edit', 'product_id', <!--{$neighbors.next}-->); return false;" >次の商品を編集</a> | |
<!--{/if}--> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment