Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/delete_cart_goods.php
<?php

/**
 * ECSHOP 购物流程
 * ============================================================================
 * 版权所有 2005-2008 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: zblikai $
 * $Id: flow.php 15632 2009-02-20 03:58:31Z zblikai $
 */

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');

include_once('includes/cls_json.php');


$result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '');
$json  = new JSON;
if($_POST['id'])
{
$sql = 'DELETE FROM '.$GLOBALS['ecs']->table('cart')." WHERE rec_id=".$_POST['id'];
$GLOBALS['db']->query($sql);
}
$sql = 'SELECT c.*,IF(c.extension_code = "package_buy",act_name,g.goods_name) as goods_name, '.
		' IF(c.extension_code = "package_buy","package_img",g.goods_thumb) as goods_thumb,g.goods_id,c.goods_number,c.goods_price' .
		' FROM ' . $GLOBALS['ecs']->table('cart') ." AS c ".
		" LEFT JOIN ".$GLOBALS['ecs']->table('goods')." AS g ON g.goods_id=c.goods_id ".
		" left join ".$GLOBALS['ecs']->table('goods_activity')." as pa on pa.act_id=c.goods_id ".
		" WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
$row = $GLOBALS['db']->GetAll($sql);
$arr = array();
foreach($row AS $k=>$v)
{
	
	$arr[$k]['goods_thumb']  = get_image_path($v['goods_id'], $v['goods_thumb'], true);
	$arr[$k]['short_name']   = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
																				 sub_str($v['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $v['goods_name'];
	$arr[$k]['url']          = ($v['extension_code'] == 'package_buy' ? '' : build_uri('goods', array('gid' => $v['goods_id']), $v['goods_name']));
	$arr[$k]['goods_number'] = $v['goods_number'];
	$arr[$k]['goods_name']   = $v['goods_name'];
	$arr[$k]['goods_price']  = price_format($v['goods_price']);
	$arr[$k]['goods_price2']  = $v['goods_price'];
	$arr[$k]['rec_id']       = $v['rec_id'];
}		
$sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' .
			 ' FROM ' . $GLOBALS['ecs']->table('cart') .
			 " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
$row = $GLOBALS['db']->GetRow($sql);

if ($row)
{
		$number = intval($row['number']);
		$amount = floatval($row['amount']);
}
else
{
		$number = 0;
		$amount = 0;
}

foreach($arr as $val)
	{
		$zj['goods_number'] += $val['goods_number'];
		$zj['goods_price'] += $val['goods_price2']*$val['goods_number'];
	}

$GLOBALS['smarty']->assign('str',sprintf($GLOBALS['_LANG']['cart_info'], $number, price_format($amount, false)));
$GLOBALS['smarty']->assign('goods',$arr);
$GLOBALS['smarty']->assign('cart_list',$arr);
$GLOBALS['smarty']->assign('zj',$zj);
$GLOBALS['smarty']->assign('number',$number);

$result['content'] = $GLOBALS['smarty']->fetch('library/cart_info.lbi');
$result['content_top'] = $GLOBALS['smarty']->fetch('library/cart_info_top.lbi');
		
//$smarty->assign('order',$order);

die($json->encode($result));


?>