Authored by hf

do add product detail page

... ... @@ -30,7 +30,7 @@ class DetailModel
$result = array();
if (is_numeric($productId) && is_numeric($goodsId)) {
// 调用接口
// 调用服务
$baseInfo = DetailData::baseInfo($productId, $uid);
// 商品名称
... ... @@ -176,9 +176,134 @@ class DetailModel
*/
public static function getSizeInfo($productSkn)
{
$result = array();
if (is_numeric($productSkn)) {
// 调用服务
$sizeInfo = DetailData::sizeInfo($productSkn);
var_dump($sizeInfo);
// 商品信息
if (isset($sizeInfo['productDescBo']['erpProductId'])) {
$result['goodsDescription'] = array(
'title' => '商品信息',
'enTitle' => 'PRODUCT INFO',
'detail' => array(
array('param' => '编号:' . $sizeInfo['productDescBo']['erpProductId']),
array('param' => '颜色:' . $sizeInfo['productDescBo']['colorName']),
),
);
}
if (!empty($sizeInfo['productDescBo']['standardBos'])) {
foreach ($sizeInfo['productDescBo']['standardBos'] as $value) {
$result['goodsDescription']['detail'][] = $value['standardName'] . ':' . $value['standardVal'];
}
}
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true);
if ($productIntro) {
$result['goodsDescription']['desc'] = strtr($productIntro, array('<p>\r\n\t' => ''));
}
}
// 尺码信息
if (!empty($sizeInfo['productIntroBo']['sizeInfoBo'])) {
$result['sizeInfo'] = array(
'title' => '尺码信息',
'enTitle' => 'SIZE INFO',
'detail' => array('list' => array()),
);
$sizeNameList = array(0 => array('param' => '吊牌尺码') ); // 尺码名称
$sizeBoGroup = array(); // 尺码按ID分组
foreach ($sizeInfo['productIntroBo']['sizeInfoBo']['sizeAttributeBos'] as $attr) {
$sizeBoGroup[ $attr['id'] ][0] = array('param' => $value['attributeName']);
}
foreach ($sizeInfo['productIntroBo']['sizeInfoBo']['sizeBoList'] as $value) {
foreach ($value['sortAttributes'] as $attr) {
$sizeBoGroup[ $attr['id'] ][] = array('param' => $attr['sizeValue']);
$sizeNameList[] = array('param' => $value['sizeName']);
}
}
// 根据模板页面的显示,按表格一列一列来显示
$result['detail']['list'][0] = $sizeNameList;
foreach ($sizeBoGroup as $value) {
$result['detail']['list'][] = $value;
}
}
// 测量方式
if (isset($sizeInfo['sizeImage'])) {
$result['measurementMethod'] = array(
'title' => '测量方式',
'enTitle' => 'MEASUREMENT METHOD',
'img' => $sizeInfo['sizeImage'],
);
}
// 模特试穿
if (!empty($sizeInfo['modelBos'])) {
$result['reference'] = array(
'title' => '模特试穿',
'enTitle' => 'REFERENCE',
'detail' => array('list' => array()),
);
$result['reference']['detail']['list'][0] = array(0 => array('param' => '')); // 头像列表
$result['reference']['detail']['list'][1] = array(0 => array('param' => '模特')); // 模特名字列表
$result['reference']['detail']['list'][2] = array(0 => array('param' => '身高')); // 身高列表
$result['reference']['detail']['list'][3] = array(0 => array('param' => '体重')); // 体重列表
$result['reference']['detail']['list'][4] = array(0 => array('param' => '三围')); // 三围列表
$result['reference']['detail']['list'][5] = array(0 => array('param' => '吊牌尺码')); // 吊牌尺码
$result['reference']['detail']['list'][6] = array(0 => array('param' => '试穿描述')); // 试穿描述
foreach ($sizeInfo['modelBos'] as $value) {
$result['reference']['detail']['list'][0][] = array('param' => $value['avatar']);
$result['reference']['detail']['list'][1][] = array('param' => $value['modelName']);
$result['reference']['detail']['list'][2][] = array('param' => $value['height']);
$result['reference']['detail']['list'][3][] = array('param' => $value['weight']);
$result['reference']['detail']['list'][4][] = array('param' => $value['vitalStatistics']);
$result['reference']['detail']['list'][5][] = array('param' => $value['fitModelBo']['fit_size']);
$result['reference']['detail']['list'][6][] = array('param' => $value['fitModelBo']['feel']);
}
}
// 商品材质
if (!empty($sizeInfo['productMaterialList'])) {
foreach ($sizeInfo['productMaterialList'] as $value) {
}
}
}
return $result;
'materials' : {
'title' : '商品材质',
'enTitle' : '',
'list''
'img' : '',
'desc' : '用各种洗涤剂',//remark
'materialType' : ''
},
'washTips' : {
'list' : [
{
"caption":"不可干洗",
"img":"http://static.yohobuy.com/images/wash_5.png"
}
]
}
'productDetail' : {
'title' : '商品详情',
'enTitle' : '',
'desc' : 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计',
'img' : ''
},
'cartInfo' : {
'numInCart' : 3,
'goodsInstore' : 0
}
}
}
... ...