作者 lyh
... ... @@ -252,6 +252,9 @@ class ProjectUpdate extends Command
}
//分类
$category_id = '';
//产品类型,2Featured Products,3Hot Products
$product_type = '';
if ($item['category'] ?? []) {
$category_arr = [];
... ... @@ -268,6 +271,18 @@ class ProjectUpdate extends Command
$categoryLogic = new CategoryLogic();
$category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr));
}
$type_arr = [];
foreach ($item['category'] as $cate) {
if ($cate['parent'] == 0 && $cate['name'] == 'Featured Products') {
$type_arr[] = 2;
} elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') {
$type_arr[] = 3;
}
}
if ($type_arr) {
$product_type = ',' . implode(',', $type_arr);
}
}
try {
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
... ... @@ -279,6 +294,7 @@ class ProjectUpdate extends Command
'category_id' => $category_id,
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
'gallery' => Arr::a2s($gallery),
'product_type' => $product_type,
'seo_mate' => Arr::a2s([
'title' => $item['ttile'],
'keyword' => $item['keywords'] ?? '',
... ...