当前位置: 首页>>代码示例>>PHP>>正文


PHP get_goods_attr函数代码示例

本文整理汇总了PHP中get_goods_attr函数的典型用法代码示例。如果您正苦于以下问题:PHP get_goods_attr函数的具体用法?PHP get_goods_attr怎么用?PHP get_goods_attr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_goods_attr函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $id = intval($GLOBALS['request']['id']);
     $user_id = intval($GLOBALS['user_info']['id']);
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     //		if ($user_id >0){
     require APP_ROOT_PATH . 'app/Lib/deal.php';
     require APP_ROOT_PATH . 'app/Lib/uc_goods_func.php';
     $root['user_login_status'] = 1;
     $root['response_code'] = 1;
     if ($id == 0) {
         app_redirect(url("index"));
     }
     $goods = get_goods_info($id, $user_id);
     if (!$goods) {
         app_redirect(url("index"));
     }
     $root['goods_description'] = $goods['description'];
     $root['user_can_buy_number'] = $goods['user_can_buy_number'];
     if ($goods['goods_type_id'] > 0) {
         $goods_type_attr = get_goods_attr($goods['goods_type_id'], $id);
         $root['has_stock'] = $goods_type_attr['has_stock'];
         $root['goods_type_attr'] = $goods_type_attr['goods_type_attr'];
         $root['json_attr_stock'] = json_encode($goods_type_attr['attr_stock']);
     } else {
         $has_stock = 1;
         //$GLOBALS['tmpl']->assign("has_stock",$has_stock);
         $root['has_stock'] = $has_stock;
     }
     $root['goods'] = $goods;
     //		}else{
     //			$root['response_code'] = 0;
     //			$root['show_err'] ="未登录";
     //			$root['user_login_status'] = 0;
     //		}
     $root['program_title'] = "商品详情";
     output($root);
 }
开发者ID:eliu03,项目名称:fanweP2P,代码行数:45,代码来源:goods_information.action.php

示例2: index

 public function index()
 {
     $id = intval($_REQUEST['id']);
     $user_id = intval($GLOBALS['user_info']['id']);
     if ($id == 0) {
         app_redirect(url("index"));
     }
     $goods = get_goods_info($id, $user_id);
     if (!$goods) {
         app_redirect(url("index"));
     }
     if ($goods['goods_type_id'] > 0) {
         $result = get_goods_attr($goods['goods_type_id'], $id);
         $GLOBALS['tmpl']->assign("json_attr_stock", json_encode($result['attr_stock']));
         $GLOBALS['tmpl']->assign("has_stock", $result['has_stock']);
         $GLOBALS['tmpl']->assign("goods_type_attr", $result['goods_type_attr']);
     } else {
         $has_stock = 1;
         $GLOBALS['tmpl']->assign("has_stock", $has_stock);
     }
     $GLOBALS['tmpl']->assign("goods", $goods);
     $GLOBALS['tmpl']->display("page/goods_information.html");
 }
开发者ID:eliu03,项目名称:fanweP2P,代码行数:23,代码来源:goods_informationModule.class.php

示例3: elseif

    }
} elseif ($_REQUEST['act'] == 'search_goods') {
    check_authz_json('whole_sale');
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filter = $json->decode($_GET['JSON']);
    $arr = get_goods_list($filter);
    if (empty($arr)) {
        $arr[0] = array('goods_id' => 0, 'goods_name' => $_LANG['search_result_empty']);
    }
    make_json_result($arr);
} elseif ($_REQUEST['act'] == 'get_goods_info') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $goods_id = intval($_REQUEST['goods_id']);
    $goods_attr_list = array_values(get_goods_attr($goods_id));
    // 将数组中的 goods_attr_list 元素下的元素的数字下标转换成字符串下标
    if (!empty($goods_attr_list)) {
        foreach ($goods_attr_list as $goods_attr_key => $goods_attr_value) {
            if (isset($goods_attr_value['goods_attr_list']) && !empty($goods_attr_value['goods_attr_list'])) {
                foreach ($goods_attr_value['goods_attr_list'] as $key => $value) {
                    $goods_attr_list[$goods_attr_key]['goods_attr_list']['c' . $key] = $value;
                    unset($goods_attr_list[$goods_attr_key]['goods_attr_list'][$key]);
                }
            }
        }
    }
    echo $json->encode($goods_attr_list);
}
/*
 * 取得批发活动列表
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:wholesale.php

示例4: get_price_ladder

/**
 * 商品价格阶梯
 * @param   int     $goods_id     商品ID
 * @return  array
 */
function get_price_ladder($goods_id)
{
    /* 显示商品规格 */
    $goods_attr_list = array_values(get_goods_attr($goods_id));
    $sql = "SELECT prices FROM " . $GLOBALS['ecs']->table('wholesale') . "WHERE goods_id = " . $goods_id;
    $row = $GLOBALS['db']->getRow($sql);
    $arr = array();
    $_arr = unserialize($row['prices']);
    if (is_array($_arr)) {
        foreach (unserialize($row['prices']) as $key => $val) {
            // 显示属性
            if (!empty($val['attr'])) {
                foreach ($val['attr'] as $attr_key => $attr_val) {
                    // 获取当前属性 $attr_key 的信息
                    $goods_attr = array();
                    foreach ($goods_attr_list as $goods_attr_val) {
                        if ($goods_attr_val['attr_id'] == $attr_key) {
                            $goods_attr = $goods_attr_val;
                            break;
                        }
                    }
                    // 重写商品规格的价格阶梯信息
                    if (!empty($goods_attr)) {
                        $arr[$key]['attr'][] = array('attr_id' => $goods_attr['attr_id'], 'attr_name' => $goods_attr['attr_name'], 'attr_val' => isset($goods_attr['goods_attr_list'][$attr_val]) ? $goods_attr['goods_attr_list'][$attr_val] : '', 'attr_val_id' => $attr_val);
                    }
                }
            }
            // 显示数量与价格
            foreach ($val['qp_list'] as $index => $qp) {
                $arr[$key]['qp_list'][$qp['quantity']] = price_format($qp['price']);
            }
        }
    }
    return $arr;
}
开发者ID:dw250100785,项目名称:ECShop-1,代码行数:40,代码来源:wholesale.php

示例5: get_goods_attr_txm

function get_goods_attr_txm($goods_id, $taypes)
{
    if (empty($taypes)) {
        return '';
        //扫描的商品没有属性,返回空
    }
    $taypesinfo = explode('+', $taypes);
    $goods_attr = get_goods_attr($goods_id);
    if (empty($goods_attr)) {
        return '';
        //仓库中的商品没有属性,返回空
    }
    $attr = $price = array();
    foreach ($taypesinfo as $key => $val) {
        foreach ($goods_attr as $gkey => $gval) {
            foreach ($gval['goods_attr_list'] as $akey => $aval) {
                if ($aval == $val) {
                    $attr[$akey] = $gval['attr_name'] . ':' . $val;
                    if (intval($gval['goods_attr_price'][$akey]) > 0) {
                        $attr[$akey] .= "[" . $gval['goods_attr_price'][$akey] . "]";
                        $price[$akey] = $gval['goods_attr_price'][$akey];
                    }
                }
            }
        }
    }
    return array('info' => $attr, 'price' => $price);
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:28,代码来源:lib_goods.php

示例6: elseif

    }
} elseif ($_REQUEST['act'] == 'search_goods') {
    check_authz_json('whole_sale');
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filter = $json->decode($_GET['JSON']);
    $arr = get_goods_list($filter);
    if (empty($arr)) {
        $arr[0] = array('goods_id' => 0, 'goods_name' => $_LANG['search_result_empty']);
    }
    make_json_result($arr);
} elseif ($_REQUEST['act'] == 'get_goods_info') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $goods_id = intval($_REQUEST['goods_id']);
    echo $json->encode(array_values(get_goods_attr($goods_id)));
}
/*
 * 取得批发活动列表
 * @return   array
 */
function wholesale_list()
{
    /* 查询会员等级 */
    $rank_list = array();
    $sql = "SELECT rank_id, rank_name FROM " . $GLOBALS['ecs']->table('user_rank');
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $rank_list[$row['rank_id']] = $row['rank_name'];
    }
    $result = get_filter();
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:wholesale.php


注:本文中的get_goods_attr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。