introduce ability to make original and copy be linked to each other
This commit is contained in:
parent
96e6c56375
commit
3670a6210b
|
|
@ -8,4 +8,7 @@ return [
|
|||
'skipAttributesOnCopy' => [
|
||||
|
||||
],
|
||||
|
||||
// Make the original and source product 'related' via the 'product_relations' table
|
||||
'linkProductsOnCopy' => true,
|
||||
];
|
||||
|
|
@ -703,5 +703,12 @@ class ProductRepository extends Repository
|
|||
$variant->save();
|
||||
}
|
||||
}
|
||||
|
||||
if (config('products.linkProductsOnCopy')) {
|
||||
DB::table('product_relations')->insert([
|
||||
'parent_id' => $originalProduct->id,
|
||||
'child_id' => $copiedProduct->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,6 +74,11 @@ class ProductCopyCest
|
|||
'qty' => 10,
|
||||
]);
|
||||
|
||||
$I->seeRecord('product_relations', [
|
||||
'parent_id' => $original->id,
|
||||
'child_id' => $copiedProduct->id,
|
||||
]);
|
||||
|
||||
$flat = $I->grabRecord(ProductFlat::class, [
|
||||
'product_id' => $copiedProduct->id,
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue