本文整理汇总了PHP中price_format函数的典型用法代码示例。如果您正苦于以下问题:PHP price_format函数的具体用法?PHP price_format怎么用?PHP price_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了price_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_review_product_filter_get_slider_value
function cw_review_product_filter_get_slider_value($data, $result)
{
if ($data['field'] == 'rating') {
return price_format($data['value']);
}
return $result;
}
示例2: cw_get_products_taxes
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_;
}
示例3: setSomeGoodsValue
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']);
}
}
示例4: edit_allocations_for_transaction
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();
}
示例5: brand_get_goodsex
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;
}
示例6: brand_get_goodsex
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;
}
示例7: app_available_payment_list
/**
* 取得可用的支付方式列表
* @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;
}
}
示例8: get_goodslist
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;
}
示例9: manage_product_columns
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;
}
}
示例10: get_index_best
/**
* 获得推荐商品
*
* @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;
}
示例11: copy_from_cn
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;
}
示例12: get_user_rank_prices
/**
* 获得指定商品的各会员等级对应的价格
*
* @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;
}
示例13: checkout_f
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");
}
示例14: exchange_get_goods
/**
* 获得分类下的商品
*
* @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;
}
示例15: display_po_receive_items
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();
}