ecshop后台编辑上一商品下一商品

2010-06-01 11:18 来源:www.chinab4c.com 作者:admin

          ecshop在编辑商品的时候,很多是否编辑之后,会跳转到列表。不利于编辑下一个商品。我们可以模仿ecshop订单编辑的时候,选择上一个订单和下一个订单,通过对ecshop后台二次开发。达到让ecshop后台编辑商品的时候方便快捷。
  1:admin/goods.php
   if(isset($_REQUEST['goods_id'])){
    
  $sql = "SELECT MAX(goods_id) FROM " . $ecs->table('goods') . " as o WHERE goods_id < '$_REQUEST[goods_id]'";
  $smarty->assign('prev_id', $db->getOne($sql));
  $sql = "SELECT MIN(goods_id) FROM " . $ecs->table('goods') . " as o WHERE goods_id > '$_REQUEST[goods_id]'";
  $smarty->assign('next_id', $db->getOne($sql));

  $smarty->assign('is',$_REQUEST['goods_id']);

   
 }

   2:admin/templates/goods_info.htm
   {if $is}
      <div align="center">
    <input name="next" type="button" class="button" onClick="location.href='goods.php?act=edit&goods_id={$next_id}';" value="上一个商品" {if !$next_id}disabled{/if} />
        <input name="prev" type="button" class="button" onClick="location.href='goods.php?act=edit&goods_id={$prev_id}';" value="下一个商品" {if !$prev_id}disabled{/if} />
      
    
    </div>
 {/if}
  来源:http://www.chinab4c.com