Merge pull request #3101 from shubhwebkul/patch-2

Issue #3096 resolved
This commit is contained in:
Jitendra Singh 2020-05-20 14:53:46 +05:30 committed by GitHub
commit 4842eb4de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -76,10 +76,22 @@ class ComparisonController extends Controller
if (! $compareProduct) {
// insert new row
$this->compareProductsRepository->create([
'customer_id' => $customerId,
'product_flat_id' => $productId,
]);
$productFlatRepository = app('\Webkul\Product\Models\ProductFlat');
$productFlat = $productFlatRepository
->where('product_id', $productId)
->get()
->first();
if ($productFlat) {
$productId = $productFlat->id;
$this->compareProductsRepository->create([
'customer_id' => $customerId,
'product_flat_id' => $productId,
]);
}
return response()->json([
'status' => 'success',