作者 lyh
@@ -252,6 +252,9 @@ class ProjectUpdate extends Command @@ -252,6 +252,9 @@ class ProjectUpdate extends Command
252 } 252 }
253 //分类 253 //分类
254 $category_id = ''; 254 $category_id = '';
  255 + //产品类型,2Featured Products,3Hot Products
  256 + $product_type = '';
  257 +
255 if ($item['category'] ?? []) { 258 if ($item['category'] ?? []) {
256 $category_arr = []; 259 $category_arr = [];
257 260
@@ -268,6 +271,18 @@ class ProjectUpdate extends Command @@ -268,6 +271,18 @@ class ProjectUpdate extends Command
268 $categoryLogic = new CategoryLogic(); 271 $categoryLogic = new CategoryLogic();
269 $category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr)); 272 $category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr));
270 } 273 }
  274 +
  275 + $type_arr = [];
  276 + foreach ($item['category'] as $cate) {
  277 + if ($cate['parent'] == 0 && $cate['name'] == 'Featured Products') {
  278 + $type_arr[] = 2;
  279 + } elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') {
  280 + $type_arr[] = 3;
  281 + }
  282 + }
  283 + if ($type_arr) {
  284 + $product_type = ',' . implode(',', $type_arr);
  285 + }
271 } 286 }
272 try { 287 try {
273 $item['ttile'] = $this->special2str($item['ttile'] ?? ''); 288 $item['ttile'] = $this->special2str($item['ttile'] ?? '');
@@ -279,6 +294,7 @@ class ProjectUpdate extends Command @@ -279,6 +294,7 @@ class ProjectUpdate extends Command
279 'category_id' => $category_id, 294 'category_id' => $category_id,
280 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '', 295 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
281 'gallery' => Arr::a2s($gallery), 296 'gallery' => Arr::a2s($gallery),
  297 + 'product_type' => $product_type,
282 'seo_mate' => Arr::a2s([ 298 'seo_mate' => Arr::a2s([
283 'title' => $item['ttile'], 299 'title' => $item['ttile'],
284 'keyword' => $item['keywords'] ?? '', 300 'keyword' => $item['keywords'] ?? '',