Merge pull request #3673 from devansh-webkul/comparison_notification_on_velocity

Message Added In Velocity And Velocity Guest #3505
This commit is contained in:
Jitendra Singh 2020-08-06 15:36:10 +05:30 committed by GitHub
commit c5573951c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View File

@ -17,7 +17,7 @@ class ComparisonController extends Controller
{
if (request()->get('data')) {
$productSlugs = null;
$productCollection = [];
if (auth()->guard('customer')->user()) {
@ -88,7 +88,7 @@ class ComparisonController extends Controller
if ($productFlat) {
$productId = $productFlat->id;
$this->compareProductsRepository->create([
'customer_id' => $customerId,
'product_flat_id' => $productId,
@ -123,17 +123,19 @@ class ComparisonController extends Controller
$this->compareProductsRepository->deleteWhere([
'customer_id' => auth()->guard('customer')->user()->id,
]);
$message = trans('velocity::app.customer.compare.removed-all');
} else {
// delete individual
$this->compareProductsRepository->deleteWhere([
'product_flat_id' => request()->get('productId'),
'customer_id' => auth()->guard('customer')->user()->id,
]);
$message = trans('velocity::app.customer.compare.removed');
}
return [
'status' => 'success',
'message' => trans('velocity::app.customer.compare.removed'),
'message' => $message,
'label' => trans('velocity::app.shop.general.alert.success'),
];
}

View File

@ -218,18 +218,22 @@
if (productId == "all") {
updatedItems = [];
this.$set(this, 'products', []);
window.showAlert(
`alert-success`,
this.__('shop.general.alert.success'),
`${this.__('customer.compare.removed-all')}`
);
} else {
updatedItems = existingItems.filter(item => item != productId);
this.$set(this, 'products', this.products.filter(product => product.id != productId));
window.showAlert(
`alert-success`,
this.__('shop.general.alert.success'),
`${this.__('customer.compare.removed')}`
);
}
this.setStorageValue('compared_product', updatedItems);
window.showAlert(
`alert-success`,
this.__('shop.general.alert.success'),
`${this.__('customer.compare.removed')}`
);
}
this.$root.headerItemsCount++;