本文整理汇总了PHP中handle_goods_article函数的典型用法代码示例。如果您正苦于以下问题:PHP handle_goods_article函数的具体用法?PHP handle_goods_article怎么用?PHP handle_goods_article使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了handle_goods_article函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_volume_price
break;
}
}
handle_volume_price($goods_id, $_POST['volume_number'], $_POST['volume_price']);
}
/* 处理扩展分类 */
if (isset($_POST['other_cat'])) {
handle_other_cat($goods_id, array_unique($_POST['other_cat']));
}
if ($is_insert) {
/* 处理关联商品 */
handle_link_goods($goods_id);
/* 处理组合商品 */
handle_group_goods($goods_id);
/* 处理关联文章 */
handle_goods_article($goods_id);
}
/* 重新格式化图片名称 */
$original_img = reformat_image_name('goods', $goods_id, $original_img, 'source');
$goods_img = reformat_image_name('goods', $goods_id, $goods_img, 'goods');
$goods_thumb = reformat_image_name('goods_thumb', $goods_id, $goods_thumb, 'thumb');
if ($goods_img !== false) {
$db->query("UPDATE " . $ecs->table('goods') . " SET goods_img = '{$goods_img}' WHERE goods_id='{$goods_id}'");
}
if ($original_img !== false) {
$db->query("UPDATE " . $ecs->table('goods') . " SET original_img = '{$original_img}' WHERE goods_id='{$goods_id}'");
}
if ($goods_thumb !== false) {
$db->query("UPDATE " . $ecs->table('goods') . " SET goods_thumb = '{$goods_thumb}' WHERE goods_id='{$goods_id}'");
}
/* 如果有图片,把商品图片加入图片相册 */
示例2: API_AddGoods
//.........这里部分代码省略.........
$goods_attr_list[$attr_id][$attr_value]['sign'] = 'insert';
$goods_attr_list[$attr_id][$attr_value]['attr_price'] = $attr_price;
}
$val_arr = explode(' ', $attr_value);
foreach ($val_arr as $k => $v) {
if (!isset($keywords_arr[$v]) && $attr_list[$attr_id] == "1") {
$keywords_arr[$v] = $v;
}
}
}
}
$keywords = join(' ', array_flip($keywords_arr));
$sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . " SET keywords = '{$keywords}' WHERE goods_id = '{$goods_id}' LIMIT 1";
$GLOBALS['db']->query($sql);
/* 插入、更新、删除数据 */
foreach ($goods_attr_list as $attr_id => $attr_value_list) {
foreach ($attr_value_list as $attr_value => $info) {
if ($info['sign'] == 'insert') {
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_attr') . " (attr_id, goods_id, attr_value, attr_price)" . "VALUES ('{$attr_id}', '{$goods_id}', '{$attr_value}', '{$info['attr_price']}')";
} elseif ($info['sign'] == 'update') {
$sql = "UPDATE " . $GLOBALS['ecs']->table('goods_attr') . " SET attr_price = '{$info['attr_price']}' WHERE goods_attr_id = '{$info['goods_attr_id']}' LIMIT 1";
} else {
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id = '{$info['goods_attr_id']}' LIMIT 1";
}
$GLOBALS['db']->query($sql);
}
}
}
/* 处理会员价格 */
if (isset($_POST['user_rank']) && isset($_POST['user_price'])) {
handle_member_price($goods_id, $_POST['user_rank'], $_POST['user_price']);
}
/* 处理扩展分类 */
if (isset($_POST['other_cat'])) {
handle_other_cat($goods_id, array_unique($_POST['other_cat']));
}
if ($is_insert) {
/* 处理关联商品 */
handle_link_goods($goods_id);
/* 处理组合商品 */
handle_group_goods($goods_id);
/* 处理关联文章 */
handle_goods_article($goods_id);
}
/* 如果有图片,把商品图片加入图片相册 */
if (isset($img)) {
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('{$goods_id}', '{$gallery_img}', '', '{$gallery_thumb}', '{$img}')";
$GLOBALS['db']->query($sql);
}
/* 处理相册图片
handle_gallery_image($goods_id, $_FILES['img_url'], $_POST['img_desc']);
*/
if (!empty($_POST['img_url'])) {
foreach ($_POST['img_url'] as $key => $img_url) {
if (!in_array($img_url['Type'], $allow_file_type)) {
client_show_message(205);
}
if (client_check_image_size($img_url['Data']) === false) {
client_show_message(206);
}
$img_original = upload_image($img_url);
if ($img_original === false) {
continue;
}
// 暂停生成缩略图
/*
$thumb_url = $image->make_thumb(ROOT_PATH . $img_original, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']);
$thumb_url = is_string($thumb_url) ? $thumb_url : '';
$img_url = $img_original;
// 如果服务器支持GD 则添加水印
if (gd_version() > 0)
{
$pos = strpos(basename($img_original), '.');
$newname = dirname($img_original) . '/' . random_filename() . substr(basename($img_original), $pos);
copy(ROOT_PATH . '/' . $img_original, ROOT_PATH . '/' . $newname);
$img_url = $newname;
$image->add_watermark(ROOT_PATH . $img_url,'',$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']);
}
*/
$img_url = $thumb_url = $img_original;
$img_desc = $_POST['img_desc'][$key];
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('{$goods_id}', '{$img_url}', '{$img_desc}', '{$thumb_url}', '{$img_original}')";
$GLOBALS['db']->query($sql);
}
}
/* 编辑时处理相册图片描述 */
if (!$is_insert && isset($_POST['old_img_desc'])) {
foreach ($_POST['old_img_desc'] as $img_id => $img_desc) {
$sql = "UPDATE " . $GLOBALS['ecs']->table('goods_gallery') . " SET img_desc = '{$img_desc}' WHERE img_id = '{$img_id}' LIMIT 1";
$GLOBALS['db']->query($sql);
}
}
/* 清空缓存 */
clear_cache_files();
/* 提示页面 */
client_show_message(0, true, '', $goods_id);
}