如何在ecmall产品详细页面增加支付宝按扭

2009-10-29 14:40 来源:www.chinab4c.com 作者:ecshop专家

     在ecmall中,商品详细页面,可以直接增加一个购买按扭,把“支付宝”按扭放在详细页面,可以方便客户直接下订单,直接购买。

     1:themes\store\default\goodsinfo.html

      下面增加<li><a href="index.php?app=cashier&goods_id={$goods.goods_id}&act=sub"><img src="./includes/payments/alipay/logo.gif"></a>
      2:新建themes\store\default\goods.payform.html

         <h3>{$lang.connecting_pay_gateway}</h3>
  <form action="{$payform.gateway}" id="payform" method="{$payform.method}" style="display:none">
  <!-- {foreach from=$payform.params item=value key=_k} -->
    <input type="hidden" name="{$_k}" value="{$value}" />
  <!-- {/foreach} -->
  </form>
  <script type="text/javascript">
      document.getElementById('payform').submit();
  </script>

        3:app/cashier.app.php文件中增加sub()函数

           function sub(){
  $goods_mod = & m('goods');
  $payment_model =& m('payment');
  $goods = $goods_mod->get_info($_GET['goods_id']);
  $payment_info  = $payment_model->get("payment_code = 'alipay' AND store_id={$goods['store_id']}");
        $payment    = $this->_get_payment('alipay', $payment_info);
  $order_info['order_amount']= $goods[_specs][0][price];
  $order_info['order_sn']= time();
  $order_info['out_trade_sn']= time();
  
  
        $payment_form = $payment->get_payform($order_info);  
         $this->assign('payform', $payment_form);
            $this->assign('payment', $payment_info);
            $this->assign('order', $order_info);
           
  $this->display('goods.payform.html');
  
 }

      相关文章:

    分析配置ecmall邮件服务器  

   ecmall中系统参数是如何加载进来的 
       来源:中国B4C电子商务