function insert_load_goods_time_status() { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(url("shop", "index")); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 $goods = get_goods($id); $GLOBALS['tmpl']->assign("goods", $goods); return $GLOBALS['tmpl']->fetch("inc/goods_detail_time_status.html"); }
} } if ($brand) { //если выбран какой-то бренд $category = implode(',', $brand); } $products = filter($category, $startprice, $endprice); //вызываем функцию выбора товаров break; case 'product': //отдельный товар $goods_id = abs((int) $_GET['goods_id']); //проверка на значение что может ввести пользователь if ($goods_id) { //id не равно 0 $goods = get_goods($goods_id); $brand_name = brand_name($goods['goods_brandid']); // хлебные крошхи } break; case 'cabinet': //личный кабинет if ($_SESSION['auth']) { $user_area = get_user1($_SESSION['auth']['customer_id']); } $user_orders = get_user_order($_SESSION['auth']['customer_id']); break; case 'user_edit': //редактирование своего профиля if ($_SESSION['auth']) { $user_area = get_user1($_SESSION['auth']['customer_id']);
public function index() { $preview = intval($_REQUEST['preview']); $id = intval($_REQUEST['id']); if ($preview > 0) { $goods = get_goods($id, $preview); if ($goods['buy_type'] == 0) { app_redirect(url("shop", "goods", array("id" => $goods['id'], "preview" => $preview))); } $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($goods['id']) . " and d.is_shop = 1 and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 if ($preview > 0) { $goods = get_goods($id, $preview); } else { $goods = get_goods($id); } //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
$buyername = $od['pp_name']; $goodname = $od['pp_name'] . '님 개인결제'; $amt_tot = (int) $od['pp_receipt_price']; $amt_sup = (int) round($amt_tot * 10 / 11); $amt_svc = 0; $amt_tax = (int) ($amt_tot - $amt_sup); } else { $od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '{$od_id}' "); if (!$od) { die('<p id="scash_empty">주문서가 존재하지 않습니다.</p>'); } if ($od['od_cash'] == 1) { alert('이미 등록된 현금영수증 입니다.'); } $buyername = $od['od_name']; $goods = get_goods($od['od_id']); $goodname = $goods['full_name']; $amt_tot = (int) $od['od_tax_mny'] + (int) $od['od_vat_mny'] + (int) $od['od_free_mny']; $amt_sup = (int) $od['od_tax_mny'] + (int) $od['od_free_mny']; $amt_tax = (int) $od['od_vat_mny']; $amt_svc = 0; } $reg_num = $id_info; $useopt = $tr_code; $currency = 'WON'; /********************* * 3. 발급 정보 설정 * *********************/ $inipay->SetField("type", "receipt"); // 고정 $inipay->SetField("pgid", "INIphpRECP");
} $smarty->assign('yu', $yu); //echo $yu; /* age_0:孕前孕后---母乳喂养用品977、外出用品981、妈妈洗护用品1000 age_1:0-3月---奶瓶881、宝宝配饰784、寝具653 age_2:3-6月---(宝宝)护理664、寝具653、奶瓶881 age_3:6-12月---学饮杯887、图书941、宝宝外出服780 age_4:1-3岁---宝宝外出服780、餐具885、图书941 age_5:3岁+ ---宝宝外出服780、哺育喂养879、玩具图书828 */ $goods_baby = array(); $arr_cartId = get_arr_cartId(); $arr_ages = get_arr_ages(); for ($i = 0; $i < count($arr_cartId); $i++) { $goods_baby[$i] = get_goods($arr_cartId[$i], $arr_ages[$i]); $goods_baby[$i][0]['age_index'] = $arr_ages[$i]; } // var_dump($goods_baby[0]); $smarty->assign('goods_baby', $goods_baby); $smarty->assign('num', array(0, 1, 2, 3, 4, 5)); //猜你喜欢 随机出 标记有精品的商品is_best=1 guan $cai = $db->getALL('SELECT g.goods_id,g.goods_name,g.market_price,g.shop_price,g.goods_thumb,sum(o.goods_number) as num FROM ' . $ecs->table("goods") . 'AS g,' . $ecs->table("order_goods") . ' AS o WHERE g.goods_id=o.goods_id AND g.is_best=1 ORDER BY RAND() LIMIT 1 '); foreach ($cai as $caiKey => $caiVal) { $cai[$caiKey]['url'] = build_uri('goods', array('gid' => $caiVal['goods_id']), $caiVal['goods_name']); } $smarty->assign('cai', $cai); /* 首页右一右二广告位 position_id=3,4 */ $you = $db->getAll('SELECT ad_code,ad_link,position_id FROM ' . $ecs->table("ad") . ' WHERE position_id in(3,4) ORDER BY ad_id DESC LIMIT 2 '); $smarty->assign('you', $you); /* 页面中的动态内容 */
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 $goods = get_goods($id); //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
function insert_get_goods_stock($para) { $deal = get_goods(intval($para['id'])); return $deal['stock']; //return intval($GLOBALS['db']->getOne("select (max_bought - buy_count) from ".DB_PREFIX."deal where id =".intval($para['id']))); }
/** * 获取订单列表 */ function get_order($limit, $user_id, $condition) { $count_sql = "SELECT count(*) from " . DB_PREFIX . "goods_order go where {$condition} and go.user_id = " . $user_id; $count = $GLOBALS['db']->getOne($count_sql); if ($count > 0) { $sql = "SELECT go.* from " . DB_PREFIX . "goods_order go where {$condition} and go.user_id = " . $user_id . " order by go.id DESC LIMIT " . $limit; $order_info = $GLOBALS['db']->getAll($sql); $attr_str = ""; foreach ($order_info as $k => $v) { $order_info[$k]['attr_format'] = unserialize($v['attr']); foreach ($order_info[$k]['attr_format'] as $kk => $vv) { $attr_str .= $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "goods_type_attr where id =" . $kk); $attr_str .= ":"; $attr_str .= $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "goods_attr where id =" . $vv); $attr_str .= " "; } $order_info[$k]['attr_format'] = $attr_str; $attr_str = ""; if ($order_info[$k]['is_delivery'] == 0) { $order_info[$k]['is_delivery_format'] = "否"; } else { $order_info[$k]['is_delivery_format'] = "是"; } if ($order_info[$k]['order_status'] == 0) { $order_info[$k]['order_status_format'] = "未发货"; } elseif ($order_info[$k]['order_status'] == 1) { $order_info[$k]['order_status_format'] = "已发货"; } elseif ($order_info[$k]['order_status'] == 2) { $order_info[$k]['order_status_format'] = "无效订单"; } elseif ($order_info[$k]['order_status'] == 3) { $order_info[$k]['order_status_format'] = "用户取消"; } $a = get_goods($order_info[$k]['goods_id']); $order_info[$k]['img'] = $a['img']; $order_info[$k]['ex_time'] = to_date($v['ex_time'], "Y-m-d H:i:s"); $order_info[$k]['delivery_time'] = to_date($v['delivery_time'], "Y-m-d H:i:s"); } } return array("list" => $order_info, 'count' => $count); }
if (!$is_combine) { //非组合料号 $enname = substr($itmetitle, 0, 128); $count = $v['amount']; $description = substr($itmetitle, 0, 60); $sku_info = get_goods($v['sku']); $unit = ''; $weight = isset($sku_info['goodsWeight']) ? round(floatval($sku_info['goodsWeight']) * $count, 3) : 0; $cnname = isset($sku_info['goodsName']) ? substr($sku_info['goodsName'], 0, 64) : ''; } else { $enname = substr($itmetitle, 0, 128); $count = $v['amount']; $weight = 0; $sku = isset($is_combine['sku']) ? $is_combine['sku'] : ''; $counts = isset($is_combine['count']) ? $is_combine['count'] : 0; $sku_info = get_goods($sku); $unit = ''; $weight_sku = isset($sku_info['goodsWeight']) ? floatval($sku_info['goodsWeight']) * $counts : 0; $cnname = isset($sku_info['goodsName']) ? substr($sku_info['goodsName'], 0, 64) : ''; $weight += $weight_sku; } $items .= "<item><cnname><![CDATA[{$cnname}]]></cnname><enname><![CDATA[{$enname}]]></enname><count><![CDATA[{$count}]]></count><unit><![CDATA[{$unit}]]></unit><weight><![CDATA[{$weight}]]></weight><origin><![CDATA[CN]]></origin><delcarevalue>0</delcarevalue><description><![CDATA[{$description}]]></description></item>"; } //上传给EUB服务器的内容 $xml_data = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; $xml_data .= "<orders xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><order>"; $xml_data .= "<orderid><![CDATA[{$orderid}]]></orderid><customercode><![CDATA[{$customercode}]]></customercode><vipcode></vipcode><clcttype><![CDATA[{$clcttype}]]></clcttype><pod><![CDATA[{$pod}]]></pod><untread><![CDATA[{$untread}]]></untread><printcode>{$printcode}</printcode><volweight><![CDATA[{$volweight}]]></volweight><remark><![CDATA[{$remark}]]></remark>"; $xml_data .= "<sender><name><![CDATA[{$s_name}]]></name><postcode><![CDATA[{$s_postcode}]]></postcode><phone><![CDATA[{$s_phone}]]></phone><mobile><![CDATA[{$s_mobile}]]></mobile><country>{$s_country}</country><province><![CDATA[{$s_province}]]></province><city><![CDATA[{$s_city}]]></city><county><![CDATA[{$s_county}]]></county><company><![CDATA[{$s_company}]]></company><street><![CDATA[{$s_street}]]></street><email><![CDATA[{$s_email}]]></email></sender>"; $xml_data .= "<collect><name><![CDATA[{$c_name}]]></name><postcode><![CDATA[{$c_postcode}]]></postcode><phone><![CDATA[{$c_phone}]]></phone><mobile><![CDATA[{$c_mobile}]]></mobile><country>{$c_country}</country><province><![CDATA[{$c_province}]]></province><city><![CDATA[{$c_city}]]></city><county><![CDATA[{$c_county}]]></county><company><![CDATA[{$c_company}]]></company><street><![CDATA[{$c_street}]]></street><email><![CDATA[{$c_email}]]></email></collect>"; $xml_data .= "<receiver><name><![CDATA[{$r_name}]]></name><postcode><![CDATA[{$r_postcode}]]></postcode><phone><![CDATA[{$r_phone}]]></phone><mobile><![CDATA[{$r_mobile}]]></mobile><country><![CDATA[{$r_country}]]></country><province><![CDATA[{$r_province}]]></province><city><![CDATA[{$r_city}]]></city><street><![CDATA[{$r_street}]]></street></receiver>"; $xml_data .= "<items>{$items}</items>";
if ($val['city'] == '441') { $result[$k]['city'][] = '北京'; } elseif ($val['city'] == '442') { $result[$k]['city'][] = '上海'; } elseif ($val['city'] == '443') { $result[$k]['city'][] = '天津'; } elseif ($val['city'] == '440') { $result[$k]['city'][] = '杭州'; } $result[$k]['is_listed'][$val['id']] = $val['is_on_sale']; //$result[$k]['last_update'][]=date("Y-m-d H:i:s",$val['last_update']); } } //echo "<pre>";print_r($result);exit; $smarty->assign('list', $result); $smarty->assign('goods', get_goods()); $smarty->assign('sale', array('未上市', '已上市')); $smarty->display('list.html'); } elseif ($act == 'update') { $time = time() + 3600 * 8; $sql = "update is_on_sale set is_on_sale={$_GET['is_listed']},last_update={$time} where id={$_GET['id']}"; $res = $db->query($sql); if ($res) { echo "1"; } else { echo "0"; } } elseif ($act == "sale_log") { $sql = "select a.goods_id,b.goods_name_style,a.city,a.is_on_sale,a.last_update from is_on_sale as a,ecs_goods as b where a.goods_id=b.goods_id order by last_update desc"; $result = $db->getAll($sql); $res = array();
/** * 编辑产品 * @author 枫叶 <*****@*****.**> */ public function edit($goods_id = 0) { if (IS_POST) { $status = I('status'); //去保存草稿 if ($status == '2') { $this->savedraftbox(); } $model = D('Goods'); if ($model->create()) { //$model->position=implode(',',I('position')); //取原来的产品类型 $srcid = get_goods($goods_id); $srcid = $srcid['goods_type_id']; if (!$model->pic) { $model->pic = $this->getFirstPicture($model->content); } $result = $model->save(); if (0 < $result) { //判断产品类型是否变化啦如果是的话就删除原有信息 if (I('goods_type_id') != $srcid) { M('GoodsAttribute')->where('goods_id=' . $goods_id)->delete(); } //保存产品附加属性表中的信息 $msg = $this->updateGoodsInfo($goods_id); if ($msg['status'] === 0) { $this->error($msg['info']); } else { $this->success($msg['info'], U('index', array('category_id' => I('category_id')))); } } else { $this->error($model->geterror()); } } else { $this->error($model->getError()); } } else { $info = array(); /* 获取数据 */ $info = M('Goods')->field(true)->find($goods_id); if (false === $info) { $this->error('获取产品信息错误'); } //$field=Api('Model/GoodsModel'); $field = get_model_attr('Goods'); $this->assign('data', $info); $this->assign('fieldarr', $field); $this->meta_title = '编辑产品'; $this->display(); } }
<?php /** * Created by PhpStorm. * User: Игорь * Date: 10.09.2015 * Time: 20:22 */ $db = connectDB(); if ($_GET['sort_id']) { $str = explode("/", $_GET['sort_id']); $goods = get_goods($db, $str[0], $str[1]); foreach ($goods as $item) { echo ' <li> <div class="description f_r"> <a href="?module=Product/' . $item['id'] . '">' . $item['title'] . '</a> <div class="f_l"> <div class="price-f-s_24 clearfix"> <span class="grn">' . $item['price_g'] . ' грн.</span><br> <span class="dol"> <span class="val_sum ">' . $item['price_g'] . '</span> <span class="pointer"><span class="d_l_r">$</span><span class="icon arrow_red"></span></span> <span class="drop"> <span class="USD">$</span> <span class="RUR">руб</span> <span class="EUR">€</span> </span> </span> </div>
echo '</div>'; echo '<h3>Add a new type</h3>'; echo '<div>'; set_session_site_has_cat_id($site_has_cat_id); //here we set global variable called seesion that we use in loop until close is set // echo '<h3>Add new goods</h3>'; // echo '<div>goods</div>'; // echo '<h2> Define a new processed goods</h2>'; create_new_item_processed($site_has_cat_id); // echo '</BR>'; //echo '=====================================================================</BR>'; //draw_detected(detect_pre_processed_items(if_investigate_request($num)[1])); echo '</div>'; echo '<h3>Define processed goods</h3>'; echo '<div>'; show_goods(get_goods(), $site_has_cat_id); } echo '</div>'; //return ?> </div> <!--accordion div--> </div> <!--min div--> <?php if (empty($if_print_detected)) { echo '<p><a href="index.php">Return</a></p>'; } ?> <!-- </fieldset> --> </div><!-- END of content-->