function cw_review_product_filter_get_slider_value($data, $result) { if ($data['field'] == 'rating') { return price_format($data['value']); } return $result; }
function cw_get_products_taxes(&$product, $user_info, $calculate_discounted_price = false, $taxes = '', $include_in_any_case = false) { global $config; $amount = $product['amount'] > 0 ? $product['amount'] : 1; $clear_price = $product['price']; if ($calculate_discounted_price && isset($product['discounted_price'])) { $tps = $taxed_price = $product['discounted_price'] / $amount; } else { $tps = $taxed_price = $product['price']; } if (empty($taxes)) { $taxes = cw_get_product_tax_rates($product, $user_info, $include_in_any_case); } if ($include_in_any_case && is_array($taxes)) { foreach ($taxes as $k => $v) { $taxes[$k]['display_including_tax'] = 1; } } $clear_price = cw_taxes_price_without_tax($product['price'], $taxes); if ($product['free_tax'] == 'Y') { $taxes_ = $taxes; } else { $taxes_ = cw_taxes_calc_simple($taxed_price, $taxes, $amount); } if ($clear_price != $tps && $product['free_tax'] != 'Y') { $taxes_ = cw_taxes_calc_simple($clear_price, $taxes, $amount); } else { $clear_price = $taxed_price; } $product['taxed_price'] = price_format($taxed_price, true); $product['taxed_clear_price'] = price_format($clear_price, true); $product['display_price'] = $clear_price; return $taxes_; }
function setSomeGoodsValue(&$goods, $dsct) { $dsct['discountVal'] = floatval($dsct['discountVal']); if ($dsct['discountType'] == 2) { if ($dsct['discountVal'] > 100 || $dsct['discountVal'] < 0) { $dsct['discountVal'] = 100; } } foreach ($goods as $k => $v) { $goods[$k]['url'] = build_uri('goods', array('gid' => $goods[$k]['goods_id']), $goods[$k]['goods_name']); switch ($dsct['discountType']) { case 1: //现金减免 $goods[$k]['discountPrice'] = $goods[$k]['market_price'] - $dsct['discountVal'] > 0 ? $goods[$k]['market_price'] - $dsct['discountVal'] : 0; break; case 2: //打折 $goods[$k]['discountPrice'] = $goods[$k]['market_price'] * $dsct['discountVal'] / 100.0; break; } $goods[$k]['shop_price'] = price_format($goods[$k]['shop_price']); $goods[$k]['market_price'] = price_format($goods[$k]['market_price']); $goods[$k]['discountPrice'] = price_format($goods[$k]['discountPrice']); } }
function edit_allocations_for_transaction($type, $trans_no) { global $systypes_array; $cart = $_SESSION['alloc']; display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no)); display_heading($cart->person_name); display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>"); display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>"); if ($cart->currency != $cart->person_curr) { $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr); display_heading2($total); } echo "<br>"; start_form(); div_start('alloc_tbl'); if (count($cart->allocs) > 0) { show_allocatable(true); submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true); submit('Process', _("Process"), true, _('Process allocations'), 'default'); submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel'); } else { display_note(_("There are no unsettled transactions to allocate."), 0, 1); submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel'); } div_end(); end_form(); }
function brand_get_goodsex($brand_id, $cate, $size, $page, $sort, $order) { $cate_where = $cate > 0 ? 'AND ' . get_children($cate) : ''; /* 获得商品列表 */ $sql = 'SELECT g.goods_id, g.goods_name, g.goods_sn, g.market_price, g.shop_price AS org_price, g.is_new,' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . '(select AVG(r.comment_rank) from ' . $GLOBALS['ecs']->table('comment') . ' as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, ' . '(select IFNULL(sum(og.goods_number), 0) from ' . $GLOBALS['ecs']->table('order_goods') . ' as og where og.goods_id = g.goods_id) AS sell_number, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '{$brand_id}' {$cate_where}" . "ORDER BY {$sort} {$order}"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); } else { $promote_price = 0; } $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; if ($GLOBALS['display'] == 'grid') { $arr[$row['goods_id']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; } $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; $arr[$row['goods_id']]['goods_sn'] = $row['goods_sn']; $arr[$row['goods_id']]['comment_rank'] = $row['comment_rank']; $arr[$row['goods_id']]['sell_number'] = $row['sell_number']; $arr[$row['goods_id']]['is_new'] = $row['is_new']; $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ''; $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); } return $arr; }
function brand_get_goodsex($brand_id, $cate, $size, $page, $sort, $order) { $cate_where = 0 < $cate ? "AND " . get_children($cate) : ""; $sql = "SELECT g.goods_id, g.goods_name, g.goods_sn, g.market_price, g.shop_price AS org_price,g.is_promote, g.is_new, g.is_best, g.is_hot," . ("IFNULL(mp.user_price, g.shop_price * '" . $_SESSION['discount'] . "') AS shop_price, g.promote_price, ") . "(select AVG(r.comment_rank) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, (select IFNULL(sum(r.id_value), 0) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_count, (select IFNULL(sum(og.goods_number), 0) from " . $GLOBALS['ecs']->table("order_goods") . " as og where og.goods_id = g.goods_id) AS sell_number, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img FROM " . $GLOBALS['ecs']->table("goods") . " AS g LEFT JOIN " . $GLOBALS['ecs']->table("member_price") . " AS mp " . ("ON mp.goods_id = g.goods_id AND mp.user_rank = '" . $_SESSION['user_rank'] . "' ") . ("WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '" . $brand_id . "' {$cate_where}") . ("ORDER BY " . $sort . " {$order}"); $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { if (0 < $row['promote_price']) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); } else { $promote_price = 0; } $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; if ($GLOBALS['display'] == "grid") { $arr[$row['goods_id']]['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; } $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; $arr[$row['goods_id']]['goods_sn'] = $row['goods_sn']; $arr[$row['goods_id']]['comment_count'] = $row['comment_count']; $arr[$row['goods_id']]['comment_rank'] = $row['comment_rank']; $arr[$row['goods_id']]['sell_number'] = $row['sell_number']; $arr[$row['goods_id']]['is_promote'] = $row['is_promote']; $arr[$row['goods_id']]['is_new'] = $row['is_new']; $arr[$row['goods_id']]['is_best'] = $row['is_best']; $arr[$row['goods_id']]['is_hot'] = $row['is_hot']; $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $arr[$row['goods_id']]['promote_price'] = 0 < $promote_price ? price_format($promote_price) : ""; $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], TRUE); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['url'] = build_uri("goods", array("gid" => $row['goods_id']), $row['goods_name']); } return $arr; }
/** * 取得可用的支付方式列表 * @param bool $support_cod 配送方式是否支持货到付款 * @param int $cod_fee 货到付款手续费(当配送方式支持货到付款时才传此参数) * @param int $is_online 是否支持在线支付 * @return array 配送方式数组 */ function app_available_payment_list($support_cod, $cod_fee = 0, $is_online = false) { $sql = 'SELECT pay_id, pay_code, pay_name, pay_fee, pay_desc, pay_config, is_cod' . ' FROM ' . $GLOBALS['ecs']->table('payment') . ' WHERE enabled = 1 '; if (!$support_cod) { $sql .= 'AND is_cod = 0 '; // 如果不支持货到付款 } if ($is_online) { $sql .= "AND is_online = '1' "; } $sql .= 'ORDER BY pay_order'; // 排序 $res = $GLOBALS['db']->query($sql); $pay_list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($row['is_cod'] == '1') { $row['pay_fee'] = $cod_fee; } $row['format_pay_fee'] = strpos($row['pay_fee'], '%') !== false ? $row['pay_fee'] : price_format($row['pay_fee'], false); $modules[] = $row; } //include_once(ROOT_PATH.'includes/lib_compositor.php'); if (isset($modules)) { return $modules; } }
function get_goodslist($cat_id = 0) { $where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_team=1 "; if ($cat_id > 0) { $where .= "AND g.cat_id = " . $cat_id; } $sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.goods_name_style, g.little_img, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img,g.little_img ' . ' ,g.team_num,g.team_price ' . 'FROM ' . $GLOBALS['hhs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['hhs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE {$where} ORDER BY g.sort_order, g.goods_id"; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res as $idx => $row) { $arr[$idx]['goods_name'] = $row['goods_name']; $arr[$idx]['goods_brief'] = $row['goods_brief']; $arr[$idx]['goods_number'] = $row['goods_number']; $arr[$idx]['market_price'] = price_format($row['market_price'], false); $arr[$idx]['shop_price'] = price_format($row['shop_price'], false); $arr[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$idx]['little_img'] = get_image_path($row['goods_id'], $row['little_img'], true); $arr[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$idx]['url'] = "tgoods.php?id=" . $row['goods_id']; //build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']); $arr[$idx]['team_num'] = $row['team_num']; $arr[$idx]['team_price'] = price_format($row['team_price'], false); //echo $arr[$idx]['url'];exit(); $arr[$idx]['team_discount'] = number_format($row['team_price'] / $row['shop_price'] * 10, 1); } return $arr; }
function manage_product_columns($column_name, $product_id) { $price_value = product_price($product_id); switch ($column_name) { case 'id': echo $product_id; break; case 'shortcode': echo '[show_products product="' . $product_id . '"]'; break; case 'price': if ($price_value != '') { echo price_format($price_value); } break; case 'image': echo the_post_thumbnail(array(40, 40)); break; case 'product_cat': echo get_the_term_list($product_id, 'al_product-cat', '', ', ', ''); break; default: break; } }
/** * 获得推荐商品 * * @access public * @param string $type 推荐类型,可以是 best, new, hot * @return array */ function get_index_best($limit = '') { $time = gmtime(); //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中 $sql = 'SELECT g.goods_id, g.goods_name,g.click_count, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' "; $sql .= ' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = "best" '; $sql .= ' ORDER BY g.sort_order, g.last_update DESC'; $sql .= " {$limit}"; $result = $GLOBALS['db']->getAll($sql); foreach ($result as $idx => $row) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ''; } else { $goods[$idx]['promote_price'] = ''; } $goods[$idx]['id'] = $row['goods_id']; $goods[$idx]['name'] = $row['goods_name']; $goods[$idx]['brief'] = $row['goods_brief']; $goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : ''; $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']); $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']); $goods[$idx]['market_price'] = price_format($row['market_price']); $goods[$idx]['shop_price'] = price_format($row['shop_price']); $goods[$idx]['thumb'] = '../' . get_image_path($row['goods_id'], $row['goods_thumb'], true); $goods[$idx]['goods_img'] = '../' . get_image_path($row['goods_id'], $row['goods_img']); $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $goods[$idx]['sell_count'] = selled_count($row['goods_id']); $goods[$idx]['pinglun'] = get_evaluation_sum($row['goods_id']); $goods[$idx]['count'] = selled_count($row['goods_id']); $goods[$idx]['click_count'] = $row['click_count']; } return $goods; }
function copy_from_cn() { $_POST['CreditText'] = $_SESSION['Items']->Comments; $_POST['OrderDate'] = $_SESSION['Items']->document_date; $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost); $_POST['Location'] = $_SESSION['Items']->Location; $_POST['sales_type_id'] = $_SESSION['Items']->sales_type; $_POST['ref'] = $_SESSION['Items']->reference; $_POST['ShipperID'] = $_SESSION['Items']->ship_via; }
/** * 获得指定商品的各会员等级对应的价格 * * @access public * @param integer $goods_id * @return array */ function get_user_rank_prices($goods_id, $shop_price) { $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * {$shop_price} / 100) AS price, r.rank_name, r.discount " . 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = '{$goods_id}' AND mp.user_rank = r.rank_id " . "WHERE r.show_price = 1 OR r.rank_id = '{$_SESSION['user_rank']}'"; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['rank_id']] = array('rank_name' => htmlspecialchars($row['rank_name']), 'price' => price_format($row['price'])); } return $arr; }
public function checkout_f() { $rslist = $this->model('cart')->get_all($this->cart_id); if (!$rslist) { error(P_Lang('您的购物车里没有任何产品'), $this->url, "notice", 5); } //生成随机码,以确定客户通过正确途径下单 $_SESSION['order_spam'] = str_rand(10); $totalprice = 0; foreach ($rslist as $key => $value) { $totalprice += price_format_val($value['price'] * $value['qty'], $value['currency_id'], $this->site['currency_id']); } $price = price_format($totalprice, $this->site['currency_id']); $this->assign('price', $price); $this->assign("rslist", $rslist); $shipping = $billing = array(); if ($_SESSION['user_id']) { $shipping_list = $this->model('address')->address_list($_SESSION['user_id'], 'shipping'); if ($shipping_list) { foreach ($shipping_list as $key => $value) { if ($value['is_default']) { $shipping = $value; } } if (!$shipping) { reset($shipping_list); $shipping = current($shipping_list); } } if ($this->site['biz_billing']) { $billing_list = $this->model('address')->address_list($_SESSION['user_id'], 'billing'); if ($billing_list) { foreach ($billing_list as $key => $value) { if ($value['is_default']) { $billing = $value; } } if (!$billing) { reset($billing_list); $billing = current($billing_list); } } } } else { if ($_SESSION['address']['shipping']) { $shipping = $_SESSION['address']['shipping']; } if ($_SESSION['address']['billing']) { $billing = $_SESSION['address']['billing']; } } $this->assign('shipping', $shipping); $this->assign('billing', $billing); $this->view("cart_checkout"); }
/** * 获得分类下的商品 * * @access public * @param string $children * @return array */ function exchange_get_goods($children, $min, $max, $ext, $size, $page, $sort, $order) { $display = $GLOBALS['display']; $where = "eg.is_exchange = 1 AND g.is_delete = 0 AND " . "($children OR " . model('Goods')->get_extension_goods($children) . ')'; if ($min > 0) { $where .= " AND eg.exchange_integral >= $min "; } if ($max > 0) { $where .= " AND eg.exchange_integral <= $max "; } /* 获得商品列表 */ $start = ($page - 1) * $size; $sort = $sort =='sales_volume'? 'xl.sales_volume': $sort; $sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.goods_name_style, eg.exchange_integral, ' . 'g.goods_type, g.goods_brief, g.goods_thumb , g.goods_img, eg.is_hot ' . 'FROM ' . $this->pre . 'exchange_goods AS eg LEFT JOIN ' . $this->pre . 'goods AS g ' . 'ON eg.goods_id = g.goods_id ' . ' LEFT JOIN ' . $this->pre . 'touch_goods AS xl ' . ' ON g.goods_id=xl.goods_id ' . " WHERE $where $ext ORDER BY $sort $order LIMIT $start ,$size "; $res = $this->query($sql); $arr = array(); foreach ($res as $row) { $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; if ($display == 'grid') { $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; } else { $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; } $arr[$row['goods_id']]['name'] = $row['goods_name']; $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief']; $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']); $arr[$row['goods_id']] ['market_price'] = price_format($row ['market_price']); $arr[$row['goods_id']]['exchange_integral'] = $row['exchange_integral']; $arr[$row['goods_id']]['type'] = $row['goods_type']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['url'] = build_uri('exchange_goods', array('gid' => $row['goods_id']), $row['goods_name']); $arr[$row['goods_id']]['sc'] = model('GoodsBase')->get_goods_collect($row['goods_id']); $arr[$row['goods_id']]['mysc'] = 0; // 检查是否已经存在于用户的收藏夹 if ($_SESSION ['user_id']) { unset($where); // 用户自己有没有收藏过 $where['goods_id'] = $row ['goods_id']; $where['user_id'] = $_SESSION ['user_id']; $rs = $this->model->table('collect_goods')->where($where)->count(); $arr[$row['goods_id']]['mysc'] = $rs; } } return $arr; }
function display_po_receive_items() { div_start('grn_items'); start_table(TABLESTYLE, "colspan=7 width=90%"); $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total")); table_header($th); /*show the line items on the order with the quantity being received for modification */ $total = 0; $k = 0; //row colour counter if (count($_SESSION['PO']->line_items) > 0) { foreach ($_SESSION['PO']->line_items as $ln_itm) { alt_table_row_color($k); $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received; if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) { //If no quantites yet input default the balance to be received $ln_itm->receive_qty = $qty_outstanding; } $line_total = $ln_itm->receive_qty * $ln_itm->price; $total += $line_total; label_cell($ln_itm->stock_id); if ($qty_outstanding > 0) { text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50); } else { label_cell($ln_itm->item_description); } $dec = get_qty_dec($ln_itm->stock_id); qty_cell($ln_itm->quantity, false, $dec); label_cell($ln_itm->units); qty_cell($ln_itm->qty_received, false, $dec); qty_cell($qty_outstanding, false, $dec); if ($qty_outstanding > 0) { qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec); } else { label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right"); } amount_decimal_cell($ln_itm->price); amount_cell($line_total); end_row(); } } $colspan = count($th) - 1; $display_sub_total = price_format($total); label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right"); $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true); $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included); $display_total = price_format($total + input_num('freight_cost') + $tax_total); start_row(); label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'"); end_row(); end_table(); div_end(); }
/** * 获得品牌下的商品 * * @access private * @param integer $brand_id * @return array */ function brand_get_goods($brand_id, $cate, $sort, $order, $size, $page) { $cate_where = ($cate > 0) ? 'AND ' . get_children($cate) : ''; $start = ($page - 1) * $size; /* 获得商品列表 */ $sort = $sort =='sales_volume'? 'xl.sales_volume': $sort; $sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $this->pre . 'goods AS g ' . 'LEFT JOIN ' . $this->pre . 'touch_goods AS xl ' . "ON g.goods_id=xl.goods_id " . 'LEFT JOIN ' . $this->pre . 'member_price AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '$brand_id' $cate_where" . "ORDER BY $sort $order LIMIT $start , $size"; $res = $this->query($sql); $arr = array(); foreach ($res as $row) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); } else { $promote_price = 0; } $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; if ($GLOBALS['display'] == 'grid') { $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; } else { $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; } $arr[$row['goods_id']]['discount'] = $row['market_price'] > 0 ? (round((($promote_price > 0 ? $promote_price : $row['shop_price']) / $row['market_price']) * 10)) : 0; $arr[$row['goods_id']]['goods_number'] = $row['goods_number']; $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $arr[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : ''; $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['url'] = build_uri('goods/index', array( 'id' => $row['goods_id'] ), $row['goods_name']); $arr[$row['goods_id']]['sales_count'] = model('GoodsBase')->get_sales_count($row['goods_id']); $arr[$row['goods_id']]['sc'] = model('GoodsBase')->get_goods_collect($row['goods_id']); $arr[$row['goods_id']]['promotion'] = model('GoodsBase')->get_promotion_show($row['goods_id']); $arr[$row['goods_id']]['mysc'] = 0; // 检查是否已经存在于用户的收藏夹 if ($_SESSION['user_id']) { unset($where); // 用户自己有没有收藏过 $where['goods_id'] = $row['goods_id']; $where['user_id'] = $_SESSION['user_id']; $rs = $this->model->table('collect_goods') ->where($where) ->count(); $arr[$row['goods_id']]['mysc'] = $rs; } } return $arr; }
function get_deposit_by_user_id($user_id, $page, $size) { $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('deposit') . " WHERE user_id = '{$user_id}'"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['id']]['id'] = $row['id']; $arr[$row['id']]['add_time'] = local_date('Y-m-d', $row['add_time']); $arr[$row['id']]['deposit_money'] = price_format($row['deposit_money']); $arr[$row['id']]['status'] = $row['status']; } return $arr; }
/** * 获取数据 */ public function show($fromusername, $info) { $articles = array('type' => 'text', 'content' => '暂无积分信息'); $uid = model('Base')->model->table('wechat_user')->field('ect_uid')->where('openid = "' . $fromusername . '"')->getOne(); if (!empty($uid)) { $data = model('Base')->model->table('users')->field('rank_points, pay_points, user_money')->where('user_id = ' . $uid)->find(); if (!empty($data)) { $articles['content'] = '余额:' . price_format($data['user_money'], false) . "\r\n" . '等级积分:' . $data['rank_points'] . "\r\n" . '消费积分:' . $data['pay_points']; // 积分赠送 $this->give_point($fromusername, $info); } } return $articles; }
/** * 调用购物车信息 * * @access public * @return string */ function insert_cart_info() { $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . ' FROM {pre}cart' . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'"; $row = $GLOBALS['db']->GetRow($sql); if ($row) { $number = intval($row['number']); $amount = floatval($row['amount']); } else { $number = 0; $amount = 0; } $str = sprintf(L('cart_info'), $number, price_format($amount, false)); return '<a href="flow.php" title="' . L('view_cart') . '">' . $str . '</a>'; }
/** * 调用购物车信息 * * @access public * @return string */ function insert_cart_info() { $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'"; $row = $GLOBALS['db']->GetRow($sql); if ($row) { $number = intval($row['number']); $amount = floatval($row['amount']); } else { $number = 0; $amount = 0; } $str = sprintf($GLOBALS['_LANG']['cart_info'], $number, price_format($amount, false)); return '<a href ="' . build_uri('flow', array(null)) . '" title="' . $GLOBALS['_LANG']['view_cart'] . '">' . $str . '</a>'; }
function serve_user($goods_list) { foreach ($goods_list as $all_list) { $goods_id = $all_list['goods_id']; $price = $all_list['shop_price']; $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * {$price} / 100) AS price, r.rank_name, r.discount " . 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = '{$goods_id}' AND mp.user_rank = r.rank_id " . "WHERE r.show_price = 1 OR r.rank_id = '{$_SESSION['user_rank']}'"; $res = $GLOBALS['db']->getAll($sql); foreach ($res as $row) { $arr[$row['rank_id']] = array('rank_name' => htmlspecialchars($row['rank_name']), 'price' => price_format($row['price'])); } $arr_list[$goods_id] = $arr; } return $arr_list; }
/** * 获取指定id package 的信息 * * @access public * @param int $id package_id * * @return array array(package_id, package_name, goods_id,start_time, end_time, min_price, integral) */ function get_package_info($id) { global $ecs, $db, $_CFG; $id = is_numeric($id) ? intval($id) : 0; $now = gmtime(); $sql = "SELECT act_id AS id, act_name AS package_name, goods_id , goods_name, start_time, end_time, act_desc, ext_info" . " FROM " . $this->pre . "goods_activity WHERE act_id='{$id}' AND act_type = " . GAT_PACKAGE; $package = $this->row($sql); /* 将时间转成可阅读格式 */ if ($package['start_time'] <= $now && $package['end_time'] >= $now) { $package['is_on_sale'] = "1"; } else { $package['is_on_sale'] = "0"; } $package['start_time'] = local_date('Y-m-d H:i', $package['start_time']); $package['end_time'] = local_date('Y-m-d H:i', $package['end_time']); $row = unserialize($package['ext_info']); unset($package['ext_info']); if ($row) { foreach ($row as $key => $val) { $package[$key] = $val; } } $sql = "SELECT pg.package_id, pg.goods_id, pg.goods_number, pg.admin_id, " . " g.goods_sn, g.goods_name, g.market_price, g.goods_thumb, g.is_real, " . " IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS rank_price " . " FROM " . $this->pre . "package_goods AS pg " . " LEFT JOIN " . $this->pre . "goods AS g " . " ON g.goods_id = pg.goods_id " . " LEFT JOIN " . $this->pre . "member_price AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . " WHERE pg.package_id = " . $id . " " . " ORDER BY pg.package_id, pg.goods_id"; $goods_res = $this->query($sql); $market_price = 0; $real_goods_count = 0; $virtual_goods_count = 0; foreach ($goods_res as $key => $val) { $goods_res[$key]['goods_thumb'] = get_image_path($val['goods_id'], $val['goods_thumb'], true); $goods_res[$key]['market_price_format'] = price_format($val['market_price']); $goods_res[$key]['rank_price_format'] = price_format($val['rank_price']); $market_price += $val['market_price'] * $val['goods_number']; /* 统计实体商品和虚拟商品的个数 */ if ($val['is_real']) { $real_goods_count++; } else { $virtual_goods_count++; } } if ($real_goods_count > 0) { $package['is_real'] = 1; } else { $package['is_real'] = 0; } $package['goods_list'] = $goods_res; $package['market_package'] = $market_price; $package['market_package_format'] = price_format($market_price); $package['package_price_format'] = price_format($package['package_price']); return $package; }
/** * 获取用户信息数组 * * @access public * @param * * @return array $user 用户信息数组 */ function get_user_info($id = 0) { if ($id == 0) { $id = $_SESSION['user_id']; } $time = date('d-m-Y'); $sql = 'SELECT u.user_id, u.email, u.user_name, u.user_money, u.pay_points' . ' FROM ' . $GLOBALS['ecs']->table('users') . ' AS u ' . " WHERE u.user_id = '{$id}'"; $user = $GLOBALS['db']->getRow($sql); $bonus = get_user_bonus($id); $user['username'] = $user['user_name']; $user['user_points'] = $user['pay_points'] . $GLOBALS['_CFG']['integral_name']; $user['user_money'] = price_format($user['user_money'], false); $user['user_bonus'] = price_format($bonus['bonus_value'], false); return $user; }
/** * 团购列表 */ public function index() { $condition['act_type'] = GAT_GROUP_BUY; $res = $this->model->table('goods_activity')->field('act_id , act_name, goods_name, end_time ,ext_info')->where($condition)->order('act_id DESC')->select(); foreach ($res as $row) { $ext_info = unserialize($row['ext_info']); $stat = model('GroupBuyBase')->group_buy_stat($row['act_id'], $ext_info['deposit']); $arr = array_merge($row, $stat, $ext_info); /* 处理价格阶梯 */ $price_ladder = $arr['price_ladder']; if (!is_array($price_ladder) || empty($price_ladder)) { $price_ladder = array(array('amount' => 0, 'price' => 0)); } else { foreach ($price_ladder AS $key => $amount_price) { $price_ladder[$key]['formated_price'] = price_format($amount_price['price']); } } /* 计算当前价 */ $cur_price = $price_ladder[0]['price']; // 初始化 $cur_amount = $stat['valid_goods']; // 当前数量 foreach ($price_ladder AS $amount_price) { if ($cur_amount >= $amount_price['amount']) { $cur_price = $amount_price['price']; } else { break; } } $arr['cur_price'] = $cur_price; $status = model('GroupBuyBase')->group_buy_status($arr); $arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']); $arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']); $arr['cur_status'] = L('gbs.' . $status); $list[] = $arr; } /* 模板赋值 */ $filter['page'] = '{page}'; $offset = $this->pageLimit(url('index', $filter), 12); $total = $this->model->table('goods_activity')->where($condition)->count(); $this->assign('page', $this->pageShow($total)); $this->assign('list', $list); $this->assign('ur_here', L('group_buy_list')); $this->display(); }
function check_inputs() { if ($_POST['amount'] == "") { $_POST['amount'] = price_format(0); } if (!check_num('amount', 0)) { display_error(tr("The entered amount is invalid or less than zero.")); set_focus('amount'); return false; } if ($_POST['discount'] == "") { $_POST['discount'] = 0; } if (!check_num('discount', 0)) { display_error(tr("The entered discount is invalid or less than zero.")); set_focus('amount'); return false; } if (input_num('amount') - input_num('discount') <= 0) { display_error(tr("The total of the amount and the discount negative. Please enter positive values.")); set_focus('amount'); return false; } if (!is_date($_POST['DatePaid'])) { display_error(tr("The entered date is invalid.")); set_focus('DatePaid'); return false; } elseif (!is_date_in_fiscalyear($_POST['DatePaid'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('DatePaid'); return false; } if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 22)) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } return true; }
/** * 获得商品的详细信息 * * @access public * @param integer $goods_id * @return void */ function get_goods_info_detail($goods_id) { $time = gmtime(); $sql = 'SELECT g.*, c.measure_unit, b.brand_id, b.brand_name AS goods_brand, m.type_money AS bonus_money, ' . 'IFNULL(AVG(r.comment_rank), 0) AS comment_rank, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS rank_price " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('category') . ' AS c ON g.cat_id = c.cat_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON g.brand_id = b.brand_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('comment') . ' AS r ' . 'ON r.id_value = g.goods_id AND comment_type = 0 AND r.parent_id = 0 AND r.status = 1 ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('bonus_type') . ' AS m ' . "ON g.bonus_type_id = m.type_id AND m.send_start_date <= '{$time}' AND m.send_end_date >= '{$time}'" . " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.goods_id = '{$goods_id}' AND g.is_delete = 0 " . "GROUP BY g.goods_id"; $row = $GLOBALS['db']->getRow($sql); if ($row !== false) { /* 用户评论级别取整 */ $row['comment_rank'] = ceil($row['comment_rank']) == 0 ? 5 : ceil($row['comment_rank']); /* 获得商品的销售价格 */ $row['market_price'] = price_format($row['market_price']); $row['shop_price_formated'] = price_format($row['shop_price']); /* 修正促销价格 */ if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); } else { $promote_price = 0; } $row['promote_price_org'] = $promote_price; $row['promote_price'] = price_format($promote_price); /* 修正重量显示 */ $row['goods_weight'] = intval($row['goods_weight']) > 0 ? $row['goods_weight'] . $GLOBALS['_LANG']['kilogram'] : $row['goods_weight'] * 1000 . $GLOBALS['_LANG']['gram']; /* 修正上架时间显示 */ $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); /* 促销时间倒计时 */ $time = gmtime(); if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date']) { $row['gmt_end_time'] = $row['promote_end_date']; } else { $row['gmt_end_time'] = 0; } /* 是否显示商品库存数量 */ $row['goods_number'] = $GLOBALS['_CFG']['use_storage'] == 1 ? $row['goods_number'] : ''; /* 修正积分:转换为可使用多少积分(原来是可以使用多少钱的积分) */ $row['integral'] = $GLOBALS['_CFG']['integral_scale'] ? round($row['integral'] * 100 / $GLOBALS['_CFG']['integral_scale']) : 0; /* 修正优惠券 */ $row['bonus_money'] = $row['bonus_money'] == 0 ? 0 : price_format($row['bonus_money'], false); return $row; } else { return false; } }
/** * 调用浏览历史 * * @access public * @return string */ function insert_history() { $str = ''; if (!empty($_COOKIE['HHS']['history'])) { $where = db_create_in($_COOKIE['HHS']['history'], 'goods_id'); $sql = 'SELECT goods_id, goods_name, goods_thumb, shop_price FROM ' . $GLOBALS['hhs']->table('goods') . " WHERE {$where} AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0"; $query = $GLOBALS['db']->query($sql); $res = array(); while ($row = $GLOBALS['db']->fetch_array($query)) { $goods['goods_id'] = $row['goods_id']; $goods['goods_name'] = $row['goods_name']; $goods['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $goods['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $goods['shop_price'] = price_format($row['shop_price']); $goods['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $str .= '<ul class="clearfix"><li class="goodsimg"><a href="' . $goods['url'] . '" target="_blank"><img src="' . $goods['goods_thumb'] . '" alt="' . $goods['goods_name'] . '" class="B_blue" /></a></li><li><a href="' . $goods['url'] . '" target="_blank" title="' . $goods['goods_name'] . '">' . $goods['short_name'] . '</a><br />' . $GLOBALS['_LANG']['shop_price'] . '<font class="f1">' . $goods['shop_price'] . '</font><br /></li></ul>'; } $str .= '<ul id="clear_history"><a onclick="clear_history()">' . $GLOBALS['_LANG']['clear_history'] . '</a></ul>'; } return $str; }
/** * 调用浏览历史 */ function insert_siy_history() { $str = ''; if (!empty($_COOKIE['ECS']['history'])) { $where = db_create_in($_COOKIE['ECS']['history'], 'goods_id'); $sql = 'SELECT goods_id, goods_name, goods_thumb, shop_price FROM ' . $GLOBALS['ecs']->table('goods') . " WHERE {$where} AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0"; $query = $GLOBALS['db']->query($sql); $res = array(); $str .= '<div id="history" class="box"> <b class="tp"><b></b></b> <div class="hd"><h3>' . $GLOBALS['_LANG']['view_history'] . '</h3><span class="more" onclick="clear_history()">' . $GLOBALS['_LANG']['clear_history'] . '</span></div> <div class="bd"> <ul class="goods-list">'; while ($row = $GLOBALS['db']->fetch_array($query)) { $goods['goods_id'] = $row['goods_id']; $goods['goods_name'] = $row['goods_name']; $goods['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $goods['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $goods['shop_price'] = price_format($row['shop_price']); $goods['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $str .= ' <li> <span class="photo"> <a href="' . $goods['url'] . '" title="' . $goods['goods_name'] . '" class="image"><img src="' . $goods['goods_thumb'] . '" alt="' . $goods['goods_name'] . '"/></a> </span> <span class="info"> <a href="' . $goods['url'] . '" title="' . $goods['goods_name'] . '" class="name">' . $goods['short_name'] . '</a> <em class="price">' . $goods['shop_price'] . '</em> </span> <span class="action"> <a href="' . $goods['url'] . '" class="detail">' . $GLOBALS['_LANG']['btn_detail'] . '</a> </span> </li>'; } $str .= ' </ul> </div> <b class="bt"><b></b></b> </div>'; } return $str; }
function cw_payment_authorize_sim_run_processor($params, $return) { if ($params['payment_data']['processor'] == authorize_sim_addon_name) { global $config, $tables, $current_location, $cart, $APP_SESS_ID; $addon_name = str_replace("-", "_", authorize_sim_addon_name); $asim_api_login_id = $config[$addon_name]['asim_api_login_id']; $asim_transaction_key = $config[$addon_name]['asim_transaction_key']; $asim_md5_hash = $config[$addon_name]['asim_md5_hash']; $asim_mode = $config[$addon_name]['asim_test_live_mode']; $asim_currency = $config[$addon_name]['asim_currency']; $asim_prefix = intval($config[$addon_name]['asim_prefix']); if (empty($asim_api_login_id) || empty($asim_transaction_key)) { $top_message = array("content" => "Enter your merchant credentials on settings page before running the payment.", "type" => "E"); cw_header_location($current_location . "index.php?target=cart&mode=checkout"); } define("AUTHORIZENET_API_LOGIN_ID", $asim_api_login_id); define("AUTHORIZENET_TRANSACTION_KEY", $asim_transaction_key); define("AUTHORIZENET_SANDBOX", $asim_mode == "live" ? FALSE : TRUE); define("AUTHORIZENET_MD5_SETTING", $asim_md5_hash); $payment_data = $params['payment_data']; $userinfo = $params['userinfo']; $doc_ids = $params['doc_ids']; $cart =& cw_session_register('cart'); $time = time(); $asim_amount = price_format($cart['info']['total']); $asim_fp_sequence = $asim_prefix . $time; $asim_fp_hash = AuthorizeNetDPM::getFingerprint($asim_api_login_id, $asim_transaction_key, $asim_amount, $asim_fp_sequence, $time); $asim_fp_timestamp = $time; $asim_relay_url = $current_location . '/index.php?target=' . authorize_sim_addon_target; // save $APP_SESS_ID $unique_id = strtolower(md5($asim_md5_hash . $asim_api_login_id . $userinfo['email'])); db_query("INSERT INTO {$tables['payment_data']} (ref_id, session_id) VALUES ('{$unique_id}', '{$APP_SESS_ID}')"); $card_expire_Month = intval($_POST['card_expire_Month']); $card_expire_Year = intval($_POST['card_expire_Year']); cw_func_call('cw_payment_create_form', array('url' => AUTHORIZENET_SANDBOX ? AuthorizeNetDPM::SANDBOX_URL : AuthorizeNetDPM::LIVE_URL, 'fields' => array('x_relay_response' => "FALSE", 'x_version' => "3.1", 'x_delim_char' => ",", 'x_delim_data' => "TRUE", 'x_amount' => $asim_amount, 'x_fp_sequence' => $asim_fp_sequence, 'x_fp_hash' => $asim_fp_hash, 'x_fp_timestamp' => $time, 'x_relay_response' => "TRUE", 'x_relay_url' => $asim_relay_url, 'x_login' => $asim_api_login_id, 'x_card_num' => $_POST['card_number'], 'x_exp_date' => date("m/y", mktime(0, 0, 0, $card_expire_Month, 1, $card_expire_Year)), 'x_card_code' => $_POST['card_cvv2'], 'x_first_name' => $_POST['first_name'], 'x_last_name' => $_POST['last_name'], 'x_address' => $_POST['address'], 'x_city' => $_POST['city'], 'x_state' => $_POST['state'], 'x_zip' => $_POST['zipcode'], 'x_country' => $_POST['country'], 'x_email' => $userinfo['email']), 'name' => $payment_data['title'])); exit; } return $return; }
/** * 获取指定用户的收藏商品列表 * * @access public * @param int $user_id 用户ID * @param int $num 列表最大数量 * @param int $start 列表其实位置 * * @return array $arr */ function zy_get_collection_goods($user_id, $num = 10, $start = 0) { $sql = 'SELECT g.goods_id, g.goods_name,g.goods_desc,g.goods_thumb,g.shop_price,g.market_price '. ' FROM ' . $GLOBALS['ecs']->table('collect_goods') . ' AS c' . ' LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g '. 'ON g.goods_id = c.goods_id '. " WHERE c.user_id = '$user_id' ORDER BY c.rec_id DESC"; $res = $GLOBALS['db'] -> selectLimit($sql, $num, $start); $goods_list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $goods_list[$row['goods_id']]['goods_id'] = $row['goods_id']; $goods_list[$row['goods_id']]['goods_name'] = $row['goods_name']; $goods_list[$row['goods_id']]['goods_desc'] = $row['goods_desc']; $goods_list[$row['goods_id']]['goods_thumb'] = $row['goods_thumb']; $goods_list[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $goods_list[$row['goods_id']]['market_price'] = price_format($row['market_price']); } return $goods_list; }