本文整理汇总了PHP中update_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP update_goods函数的具体用法?PHP update_goods怎么用?PHP update_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_goods函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif ($_POST['type'] == 'hot') {
/* 检查权限 */
admin_priv('goods_manage');
update_goods($goods_id, 'is_hot', '1');
} elseif ($_POST['type'] == 'not_hot') {
/* 检查权限 */
admin_priv('goods_manage');
update_goods($goods_id, 'is_hot', '0');
} elseif ($_POST['type'] == 'move_to') {
/* 检查权限 */
admin_priv('goods_manage');
update_goods($goods_id, 'cat_id', $_POST['target_cat']);
} elseif ($_POST['type'] == 'restore') {
/* 检查权限 */
admin_priv('remove_back');
update_goods($goods_id, 'is_delete', '0');
/* 记录日志 */
admin_log('', 'batch_restore', 'goods');
} elseif ($_POST['type'] == 'drop') {
/* 检查权限 */
admin_priv('remove_back');
delete_goods($goods_id);
/* 记录日志 */
admin_log('', 'batch_remove', 'goods');
}
}
/* 清除缓存 */
clear_cache_files();
if ($_POST['type'] == 'drop' || $_POST['type'] == 'restore') {
$link[] = array('href' => 'goods.php?act=trash', 'text' => $_LANG['11_goods_trash']);
} else {
示例2: VALUES
}
}
/* 插入货品表 */
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('products') . " (goods_id, goods_attr, product_sn, product_number) VALUES ('" . $product['goods_id'] . "', '{$goods_attr}', '{$value}', '" . $product['product_number'][$key] . "')";
if (!$GLOBALS['db']->query($sql)) {
continue;
//sys_msg($_LANG['sys']['wrong'] . $_LANG['cannot_add_products'], 1, array(), false);
}
//货品号为空 自动补货品号
if (empty($value)) {
$sql = "UPDATE " . $GLOBALS['ecs']->table('products') . "\r\n SET product_sn = '" . $goods['goods_sn'] . "g_p" . $GLOBALS['db']->insert_id() . "'\r\n WHERE product_id = '" . $GLOBALS['db']->insert_id() . "'";
$GLOBALS['db']->query($sql);
}
/* 修改商品表库存 */
$product_count = product_number_count($product['goods_id']);
if (update_goods($product['goods_id'], 'goods_number', $product_count)) {
//记录日志
admin_log($product['goods_id'], 'update', 'goods');
}
}
clear_cache_files();
/* 返回 */
if ($insert) {
$link[] = array('href' => 'goods.php?act=add', 'text' => $_LANG['02_goods_add']);
$link[] = array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list']);
$link[] = array('href' => 'goods.php?act=product_list&goods_id=' . $product['goods_id'], 'text' => $_LANG['18_product_list']);
} else {
$link[] = array('href' => 'goods.php?act=list&uselastfilter=1', 'text' => $_LANG['01_goods_list']);
$link[] = array('href' => 'goods.php?act=edit&goods_id=' . $product['goods_id'], 'text' => $_LANG['edit_goods']);
$link[] = array('href' => 'goods.php?act=product_list&goods_id=' . $product['goods_id'], 'text' => $_LANG['18_product_list']);
}
示例3: VALUES
if ($return_id == "") {
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('stock_control') . " (goods_id, goods_name, log_time, goods_number, costing_price ) VALUES ('" . $goods_id . "', '" . $goods_name . "', '" . gmtime() . "', '" . $goods_number . "' , '" . $costing_price . "')";
$GLOBALS['db']->query($sql);
$stock_control_id = $GLOBALS['db']->insert_id();
//返回stock_stock_control 所产生的最新的id
} else {
$goods_number_new = $return_goods_number + $goods_number;
$GLOBALS['db']->query("UPDATE " . $ecs->table('stock_control') . " SET log_time = '" . gmtime() . "', goods_number = '" . $goods_number_new . "' WHERE id='{$return_id}'");
$stock_control_id = $return_id;
}
$stock_type = 1;
//商品入库处理, 默认为 1(增加) -1(减少)
$stock_status = 1;
//1:添加入库产品,2:发货时候库存减少状态,3:库存不够的时候,4 退货的时候库存会增加状态)
//写入相关的入库数据记录
$sql_log = "INSERT INTO " . $GLOBALS['ecs']->table('stock_control_log') . " (stock_id, goods_name, log_time, goods_number, stock_type, costing_price, stock_number, stock_status, stock_note, ip_address ) VALUES ('" . $stock_control_id . "', '" . $goods_name . "', '" . gmtime() . "', '" . $goods_number . "', '" . $stock_type . "', '" . $costing_price . "' , '" . $stock_number . "' , '" . $stock_status . "', '" . real_ip() . "','" . real_ip() . "')";
$GLOBALS['db']->query($sql_log);
//入库成功之后, 商品的总的库存数量也要相应的增加
$goods_number_old = $GLOBALS['db']->getOne("SELECT goods_number FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id = {$goods_id} ");
$goods_num = $goods_number_old + $goods_number;
if (update_goods($goods_id, 'goods_number', $goods_num)) {
//记录日志
//admin_log($goods_id, 'update', 'goods');
}
/* 显示商品信息页面 */
assign_query_info();
$link[0]['text'] = $_LANG['add_success_message'];
$link[0]['href'] = 'goods_stock_control.php?act=list';
clear_cache_files();
sys_msg($goods_name . $_LANG['succed_message'], 0, $link);
}