...
|
...
|
@@ -354,25 +354,50 @@ class ListModel |
|
|
*/
|
|
|
public static function categoryData($data, $shop_id)
|
|
|
{
|
|
|
$result = array();
|
|
|
$result['class'] = array();
|
|
|
$result['category'] = array();
|
|
|
foreach ($data as &$item) {
|
|
|
array_push($result['class'], array('name' => $item['category_name']));
|
|
|
foreach ($item['sub'] as &$item2) {
|
|
|
$item2['url'] = Helpers::url('/search/list', array(
|
|
|
$result = array(
|
|
|
'allproduct' => Helpers::url('/search/list', array(
|
|
|
'shop_id' => $shop_id,
|
|
|
)),
|
|
|
'class' => array(),
|
|
|
'category' => array()
|
|
|
);
|
|
|
|
|
|
if (empty($data)) {
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
foreach ($data as $categorys) {
|
|
|
|
|
|
if (empty($categorys['sub'])) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
array_push($result['class'], array('name' => $categorys['category_name']));
|
|
|
|
|
|
//判断是否有全部
|
|
|
$subcategory = array();
|
|
|
$item = array(
|
|
|
'category_name' => '全部' . $categorys['category_name'],
|
|
|
'url' => Helpers::url('/search/list', array(
|
|
|
'shop' => $shop_id,
|
|
|
'sort' => $categorys['relation_parameter']['sort'],
|
|
|
'title' => '全部' . $categorys['category_name']
|
|
|
)),
|
|
|
);
|
|
|
array_push($subcategory, $item);
|
|
|
|
|
|
foreach ($categorys['sub'] as &$sub) {
|
|
|
$sub['url'] = Helpers::url('/search/list', array(
|
|
|
'shop' => $shop_id,
|
|
|
'categoryId' => $item['category_id'],
|
|
|
'subCategoryId' => $item2['category_id'],
|
|
|
'title' => $item2['category_name'],
|
|
|
'query' => $item2['category_name'],
|
|
|
'sort' => $sub['relation_parameter']['sort'],
|
|
|
'title' => $sub['category_name']
|
|
|
));
|
|
|
array_push($subcategory, $sub);
|
|
|
}
|
|
|
array_push($result['category'], array('subcategory' => $item['sub']));
|
|
|
|
|
|
$result['category'][]['subcategory'] = $subcategory;
|
|
|
}
|
|
|
$result['allproduct'] = Helpers::url('/search/list', array(
|
|
|
'shop_id' => $shop_id,
|
|
|
));
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
...
|
...
|
|