修复
This commit is contained in:
parent
4a57b4e344
commit
2f8dc934d5
@ -2519,6 +2519,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$attr_two = explode('|', $datum['value']['attr_two']);
|
$attr_two = explode('|', $datum['value']['attr_two']);
|
||||||
$attr = [];
|
$attr = [];
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
foreach ($attr_one as $key => $value) {
|
foreach ($attr_one as $key => $value) {
|
||||||
$attr[$value] = $attr_two[$key];
|
$attr[$value] = $attr_two[$key];
|
||||||
$arr[] = [
|
$arr[] = [
|
||||||
@ -2528,10 +2529,16 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
$array_values = array_values($attr);
|
$array_values = array_values($attr);
|
||||||
|
$attr_implode= implode(',', $array_values);
|
||||||
if ($find) {
|
if ($find) {
|
||||||
$store_product_attr_value = Db::name('store_product_attr_value')->where('product_id', $find['product_id'])->where('bar_code', $datum['value']['bar_code'])->find();
|
$store_product_attr_value_where['product_id']=$find['product_id'];
|
||||||
|
if($datum['value']['bar_code']!=''){
|
||||||
|
$store_product_attr_value_where['bar_code']=$datum['value']['bar_code'];
|
||||||
|
}else{
|
||||||
|
$store_product_attr_value_where['sku']=$attr_implode;
|
||||||
|
}
|
||||||
|
$store_product_attr_value = Db::name('store_product_attr_value')->where($store_product_attr_value_where)->find();
|
||||||
if ($store_product_attr_value) {
|
if ($store_product_attr_value) {
|
||||||
|
|
||||||
$datas['product_id'] = $find['product_id'];
|
$datas['product_id'] = $find['product_id'];
|
||||||
$datas['mer_id'] = $merId;
|
$datas['mer_id'] = $merId;
|
||||||
$datas['store_name'] = $datum['value']['store_name'];
|
$datas['store_name'] = $datum['value']['store_name'];
|
||||||
@ -2539,10 +2546,11 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$this->create_product_import_log($datas,0);
|
$this->create_product_import_log($datas,0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_update = false;
|
$is_update = false;
|
||||||
foreach ($attr as $kk => $vv) {
|
foreach ($attr as $kk => $vv) {
|
||||||
|
|
||||||
/**查询当前规格是否存在 */
|
/**查询当前规格属性是否存在 */
|
||||||
$attr_values_find = Db::name('store_product_attr')->where('product_id', $find['product_id'])->where('attr_name', $kk)
|
$attr_values_find = Db::name('store_product_attr')->where('product_id', $find['product_id'])->where('attr_name', $kk)
|
||||||
->find();
|
->find();
|
||||||
if ($attr_values_find) {
|
if ($attr_values_find) {
|
||||||
@ -2551,20 +2559,21 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
if (!in_array($vv, $attr_values)) {
|
if (!in_array($vv, $attr_values)) {
|
||||||
$attr_values[] = $vv;
|
$attr_values[] = $vv;
|
||||||
$attr_values = implode('-!-', $attr_values);
|
$attr_values = implode('-!-', $attr_values);
|
||||||
|
//更新规格属性
|
||||||
Db::name('store_product_attr')->where('product_id', $find['product_id'])->where('attr_name', $kk)->update(['attr_values' => $attr_values]);
|
Db::name('store_product_attr')->where('product_id', $find['product_id'])->where('attr_name', $kk)->update(['attr_values' => $attr_values]);
|
||||||
$this->create_product_attr_value($find, $datum, $product_type, $attr, $merId, implode(',', $array_values));
|
|
||||||
}
|
|
||||||
$is_update = true;
|
$is_update = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$datas = [
|
$datas = [
|
||||||
'product_id' => $find['product_id'],
|
'product_id' => $find['product_id'],
|
||||||
'attr_name' => $kk, 'attr_values' => $vv,
|
'attr_name' => $kk, 'attr_values' => $vv,
|
||||||
];
|
];
|
||||||
Db::name('store_product_attr')->insert($datas);
|
Db::name('store_product_attr')->insert($datas);
|
||||||
|
$is_update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($is_update == false) {
|
if ($is_update == false) {
|
||||||
$this->create_product_attr_value($find, $datum, $product_type, $attr, $merId, implode(',', $array_values));
|
$this->create_product_attr_value($find, $datum, $product_type, $attr, $merId, $attr_implode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//默认其他分类
|
//默认其他分类
|
||||||
|
Loading…
x
Reference in New Issue
Block a user