本文整理汇总了PHP中flow_clear_cart_alone函数的典型用法代码示例。如果您正苦于以下问题:PHP flow_clear_cart_alone函数的具体用法?PHP flow_clear_cart_alone怎么用?PHP flow_clear_cart_alone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flow_clear_cart_alone函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: flow_drop_cart_goods
/**
* 删除购物车中的商品
*
* @access public
* @param integer $id
* @return void
*/
function flow_drop_cart_goods($id)
{
/* 取得商品id */
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id = '{$id}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row) {
//如果是超值礼包
if ($row['extension_code'] == 'package_buy') {
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '{$id}' LIMIT 1";
} elseif ($row['parent_id'] == 0 && $row['is_gift'] == 0) {
/* 检查购物车中该普通商品的不可单独销售的配件并删除 */
$sql = "SELECT c.rec_id\n FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('group_goods') . " AS gg, " . $GLOBALS['ecs']->table('goods') . " AS g\n WHERE gg.parent_id = '" . $row['goods_id'] . "'\n AND c.goods_id = gg.goods_id\n AND c.parent_id = '" . $row['goods_id'] . "'\n AND c.extension_code <> 'package_buy'\n AND gg.goods_id = g.goods_id\n AND g.is_alone_sale = 0 AND c.group_id='" . $row['group_id'] . "'";
//by mike add
$res = $GLOBALS['db']->query($sql);
$_del_str = $id . ',';
while ($id_alone_sale_goods = $GLOBALS['db']->fetchRow($res)) {
$_del_str .= $id_alone_sale_goods['rec_id'] . ',';
}
$_del_str = trim($_del_str, ',');
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND (rec_id IN ({$_del_str}) OR parent_id = '{$row['goods_id']}' OR is_gift <> 0) AND group_id='" . $row['group_id'] . "'";
} else {
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '{$id}' LIMIT 1";
}
$GLOBALS['db']->query($sql);
}
flow_clear_cart_alone();
}
开发者ID:ChanHarold,项目名称:ecshop,代码行数:34,代码来源:delete_cart_goods2.php
示例2: flow_drop_cart_goods
/**
* 删除购物车中的商品
*
* @access public
* @param integer $id
* @return void
*/
function flow_drop_cart_goods($id)
{
/* 取得商品id */
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id = '{$id}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row) {
$sql_where = $_SESSION['user_id'] > 0 ? "user_id='" . $_SESSION['user_id'] . "' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";
//添加 www.68ecshop.com
//如果是超值礼包
if ($row['extension_code'] == 'package_buy') {
/* 代码修改_start By www.68ecshop.com 将这块替换掉*/
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE {$sql_where} " . "AND rec_id = '{$id}' LIMIT 1";
/* 代码修改_end By www.68ecshop.com */
} elseif ($row['parent_id'] == 0 && $row['is_gift'] == 0) {
/* 检查购物车中该普通商品的不可单独销售的配件并删除 */
$sql = "SELECT c.rec_id\n FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('group_goods') . " AS gg, " . $GLOBALS['ecs']->table('goods') . " AS g\n WHERE gg.parent_id = '" . $row['goods_id'] . "'\n AND c.goods_id = gg.goods_id\n AND c.parent_id = '" . $row['goods_id'] . "'\n AND c.extension_code <> 'package_buy'\n AND gg.goods_id = g.goods_id\n AND g.is_alone_sale = 0";
$res = $GLOBALS['db']->query($sql);
$_del_str = $id . ',';
while ($id_alone_sale_goods = $GLOBALS['db']->fetchRow($res)) {
$_del_str .= $id_alone_sale_goods['rec_id'] . ',';
}
$_del_str = trim($_del_str, ',');
/* 代码修改_start By www.68ecshop.com 将这块替换掉*/
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE {$sql_where} " . "AND (rec_id IN ({$_del_str}) OR parent_id = '{$row['goods_id']}' OR is_gift <> 0)";
/* 代码修改_end By www.68ecshop.com */
} else {
/* 代码修改_start By www.68ecshop.com 将这块替换掉*/
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE {$sql_where} " . "AND rec_id = '{$id}' LIMIT 1";
/* 代码修改_end By www.68ecshop.com */
}
$GLOBALS['db']->query($sql);
}
flow_clear_cart_alone();
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:41,代码来源:flow.php
注:本文中的flow_clear_cart_alone函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论