本文整理汇总了PHP中generate_goods_sn函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_goods_sn函数的具体用法?PHP generate_goods_sn怎么用?PHP generate_goods_sn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_goods_sn函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: copy_goods
/**
* 复制商品表
**/
private function copy_goods()
{
$goods_res = $this->db->getRow("SELECT cat_id,goods_sn,goods_name,goods_number," . "market_price,shop_price,keywords,goods_desc,goods_thumb,goods_img," . "original_img,goods_type,wholesale_price,costing_price,supply_sign_id,is_on_sale,admin_agency_id FROM " . $this->ecs->table('goods') . " WHERE goods_id = {$this->goods_id}");
#代理商添加商品
if ($this->admin_agency_id && $this->shop_price) {
$shop_price = $this->shop_price;
$market_price = $goods_res['shop_price'] * $GLOBALS['_CFG']['market_price_rate'];
$costing_price = $goods_res['shop_price'];
$host_goods_id = $this->goods_id;
} else {
$shop_price = $this->shop_price;
$market_price = $goods_res['market_price'];
$costing_price = $goods_res['costing_price'];
$host_goods_id = 0;
}
$Arr = array('cat_id' => $goods_res['cat_id'], 'goods_sn' => generate_goods_sn($this->db->getOne("SELECT MAX(goods_id) + 1 FROM " . $this->ecs->table('goods'))), 'goods_name' => preg_replace("/['`<> ]/", '', $goods_res['goods_name']), 'goods_number' => $goods_res['goods_number'], 'market_price' => $market_price, 'shop_price' => $shop_price, 'keywords' => $goods_res['keywords'], 'goods_desc' => $goods_res['goods_desc'], 'goods_thumb' => $goods_res['goods_thumb'], 'goods_img' => $goods_res['goods_img'], 'original_img' => $goods_res['original_img'], 'add_time' => time(), 'last_update' => time(), 'goods_type' => $goods_res['goods_type'], 'wholesale_price' => $goods_res['wholesale_price'], 'costing_price' => $costing_price, 'supply_sign_id' => (int) $goods_res['supply_sign_id'], 'is_on_sale' => $goods_res['is_on_sale'], 'admin_agency_id' => $this->admin_agency_id, 'host_goods_id' => $host_goods_id);
$this->db->autoExecute($this->ecs->table('goods'), $Arr, 'INSERT');
return $this->db->insert_id();
}
开发者ID:dlpc,项目名称:ecshop,代码行数:22,代码来源:class_copy_goods.php
示例2: values
}
}
$brand_id = 0;
if (!empty($good_brand)) {
$sql = 'INSERT INTO ' . $ecs->table('brand') . " (brand_name, is_show)" . " values('" . $good_brand . "', '1')";
$db->query($sql);
$brand_id = $db->insert_Id();
}
if (!empty($good_category)) {
$sql = 'INSERT INTO ' . $ecs->table('category') . " (cat_name, parent_id, is_show)" . " values('" . $good_category . "', '0', '1')";
$db->query($sql);
$cat_id = $db->insert_Id();
//货号
require_once ROOT_PATH . 'admin/includes/lib_goods.php';
$max_id = $db->getOne("SELECT MAX(goods_id) + 1 FROM " . $ecs->table('goods'));
$goods_sn = generate_goods_sn($max_id);
include_once ROOT_PATH . 'includes/cls_image.php';
$image = new cls_image($_CFG['bgcolor']);
if (!empty($good_name)) {
/* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */
if (isset($_FILES['goods_img']['error'])) {
// 最大上传文件大小
$php_maxsize = ini_get('upload_max_filesize');
$htm_maxsize = '2M';
// 商品图片
if ($_FILES['goods_img']['error'] == 0) {
if (!$image->check_img_type($_FILES['goods_img']['type'])) {
sys_msg($_LANG['invalid_goods_img'], 1, array(), false);
}
} elseif ($_FILES['goods_img']['error'] == 1) {
sys_msg(sprintf($_LANG['goods_img_too_big'], $php_maxsize), 1, array(), false);
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:index.php
示例3: API_AddGoods
//.........这里部分代码省略.........
client_show_message(215);
}
}
}
}
if (!empty($_POST['goods_thumb']['Data'])) {
if (!in_array($_POST['goods_thumb']['Type'], $allow_file_type)) {
client_show_message(203);
}
if (client_check_image_size($_POST['goods_thumb']['Data']) === false) {
client_show_message(204);
}
$goods_thumb = upload_image($_POST['goods_thumb']);
if ($goods_thumb === false) {
client_show_message(217);
}
} else {
// 未上传,如果自动选择生成,且上传了商品图片,生成所略图
if (isset($_POST['auto_thumb']) && !empty($original_img)) {
// 如果设置缩略图大小不为0,生成缩略图
if ($_CFG['thumb_width'] != 0 || $_CFG['thumb_height'] != 0) {
$goods_thumb = $image->make_thumb(ROOT_PATH . '/' . $original_img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']);
if ($goods_thumb === false) {
client_show_message(218);
}
} else {
$goods_thumb = $original_img;
}
}
}
/* 如果没有输入商品货号则自动生成一个商品货号 */
if (empty($_POST['goods_sn'])) {
$max_id = $is_insert ? $GLOBALS['db']->getOne("SELECT MAX(goods_id) + 1 FROM " . $GLOBALS['ecs']->table('goods')) : $_POST['goods_id'];
$goods_sn = generate_goods_sn($max_id);
} else {
$goods_sn = $_POST['goods_sn'];
}
/* 处理商品数据 */
$is_promote = isset($_POST['is_promote']) && $_POST['is_promote'] ? 1 : 0;
$shop_price = !empty($_POST['shop_price']) ? $_POST['shop_price'] : 0;
$market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : $GLOBALS['_CFG']['market_price_rate'] * $shop_price;
$promote_price = !empty($_POST['promote_price']) ? floatval($_POST['promote_price']) : 0;
$promote_start_date = $is_promote && !empty($_POST['promote_start_date']) ? local_strtotime($_POST['promote_start_date']) : 0;
$promote_end_date = $is_promote && !empty($_POST['promote_end_date']) ? local_strtotime($_POST['promote_end_date']) : 0;
$goods_weight = !empty($_POST['goods_weight']) ? $_POST['goods_weight'] * $_POST['weight_unit'] : 0;
$is_best = isset($_POST['is_best']) && $_POST['is_best'] ? 1 : 0;
$is_new = isset($_POST['is_new']) && $_POST['is_new'] ? 1 : 0;
$is_hot = isset($_POST['is_hot']) && $_POST['is_hot'] ? 1 : 0;
$is_on_sale = isset($_POST['is_on_sale']) && $_POST['is_on_sale'] ? 1 : 0;
$is_alone_sale = isset($_POST['is_alone_sale']) && $_POST['is_alone_sale'] ? 1 : 0;
$goods_number = isset($_POST['goods_number']) ? $_POST['goods_number'] : 0;
$warn_number = isset($_POST['warn_number']) ? $_POST['warn_number'] : 0;
$goods_type = isset($_POST['goods_type']) ? $_POST['goods_type'] : 0;
$goods_name_style = $_POST['goods_name_color'] . '+' . $_POST['goods_name_style'];
$catgory_id = empty($_POST['cat_id']) ? '' : intval($_POST['cat_id']);
$brand_id = empty($_POST['brand_id']) ? '' : intval($_POST['brand_id']);
$new_brand_name = empty($_POST['new_brand_name']) ? '' : trim($_POST['new_brand_name']);
$new_cat_name = empty($_POST['new_cat_name']) ? '' : trim($_POST['new_cat_name']);
if ($catgory_id == '' && $new_cat_name != '') {
if (cat_exists($new_cat_name, $_POST['parent_cat'])) {
/* 同级别下不能有重复的分类名称 */
client_show_message(219);
}
}
if ($brand_id == '' && $new_brand_name != '') {
if (brand_exists($new_brand_name)) {
开发者ID:Ryan007,项目名称:mybb,代码行数:67,代码来源:lib_api.php
示例4: elseif
$field_arr['brand_id'] = $brand_id;
}
} elseif (in_array($field, array('goods_number', 'warn_number', 'integral'))) {
$field_arr[$field] = intval($field_value);
} elseif (in_array($field, array('goods_weight', 'market_price', 'shop_price'))) {
$field_arr[$field] = floatval($field_value);
} elseif (in_array($field, array('is_best', 'is_new', 'is_hot', 'is_on_sale', 'is_alone_sale', 'is_real'))) {
$field_arr[$field] = intval($field_value) > 0 ? 1 : 0;
}
}
if ($field == 'is_real') {
$field_arr[$field] = intval($_POST['goods_class'][$key]);
}
}
if (empty($field_arr['goods_sn'])) {
$field_arr['goods_sn'] = generate_goods_sn($max_id);
}
/* 如果是虚拟商品,库存为0 */
if ($field_arr['is_real'] == 0) {
$field_arr['goods_number'] = 0;
}
$db->autoExecute($ecs->table('goods'), $field_arr, 'INSERT');
$max_id = $db->insert_id() + 1;
/* 如果图片不为空,修改商品图片,插入商品相册*/
if (!empty($field_arr['original_img']) || !empty($field_arr['goods_img']) || !empty($field_arr['goods_thumb'])) {
$goods_img = '';
$goods_thumb = '';
$original_img = '';
$goods_gallery = array();
$goods_gallery['goods_id'] = $db->insert_id();
if (!empty($field_arr['original_img'])) {
开发者ID:554119220,项目名称:kjrscrm,代码行数:31,代码来源:goods_batch.php
示例5: sort_flag
/* 排序标记 */
$sort_flag = sort_flag($tm_goods_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
make_json_result($smarty->fetch('tm_goods_list.htm'), '', array('filter' => $tm_goods_list['filter'], 'page_count' => $tm_goods_list['page_count']));
} elseif ($_REQUEST['act'] == 'batch') {
if (!empty($_POST['checkboxes']) && !empty($_POST['type'])) {
foreach ($_POST['checkboxes'] as $k => $v) {
$Arr = array();
$ArrImg = array();
$tm_res = $db->getRow("select product_title,product_price,price,parameter,colour_sort,image,detail_imgs,tmall_product_id from " . $ecs->table('tm_goods') . "where id = {$v} AND and_add = 0");
if (!$tm_res) {
continue;
}
//商品表
$Arr['cat_id'] = $_POST['type'];
$goods_sn = generate_goods_sn($db->getOne("SELECT MAX(goods_id) + 1 FROM " . $ecs->table('goods')));
$Arr['goods_sn'] = $goods_sn;
$Arr['goods_name'] = $tm_res['product_title'];
$Arr['goods_number'] = '9999';
$Arr['market_price'] = $tm_res['product_price'];
$Arr['shop_price'] = $tm_res['price'];
$Arr['keywords'] = $tm_res['product_title'];
//商品详情图片
if ($tm_res['detail_imgs']) {
$Arr['goods_desc'] = tm_goods_desc(unserialize($tm_res['detail_imgs']));
}
//商品图片
$new_goods_img = tm_goods_image(unserialize($tm_res['image']));
$Arr['goods_thumb'] = $new_goods_img[0]['goods_thumb'];
$Arr['goods_img'] = $new_goods_img[0]['goods_img'];
$Arr['original_img'] = $new_goods_img[0]['goods_img'];
开发者ID:dlpc,项目名称:ecshop,代码行数:31,代码来源:tm_goods.php
注:本文中的generate_goods_sn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论