소스 검색

商品详情-增加单规格商品填充detail的功能

xupuyuan 4 달 전
부모
커밋
3f29d25e8d
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      app/common/repositories/store/product/ProductRepository.php

+ 5 - 1
app/common/repositories/store/product/ProductRepository.php

@@ -418,8 +418,12 @@ class ProductRepository extends BaseRepository
418 418
                 $value['plate_mer_profit'] = $value['gong_mer_profit'];
419 419
 
420 420
                 $sku = '';
421
-                if (isset($value['detail']) && is_array($value['detail'])) {
421
+                if (isset($value['detail']) && is_array($value['detail']) && count($value['detail']) > 0) {
422 422
                     $sku = implode(',', $value['detail']);
423
+                } else {
424
+                    // 单规格情况,detail填充默认内容
425
+                    $value['detail'] = ['默认'];
426
+                    $sku = '默认';
423 427
                 }
424 428
                 $product_data = Db::name('store_product')->where('product_id', $id)->value('spu_id');
425 429
                 if ($product_data) {