Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
T
test-webshop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem
test-webshop
Commits
4ce9c4d3
Commit
4ce9c4d3
authored
May 15, 2020
by
Artem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "add notification for deleting product in card"
This reverts commit
326b63f0
parent
326b63f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
16 deletions
+6
-16
CartController.php
app/Http/Controllers/CartController.php
+1
-8
cart.js
public/js/cart.js
+4
-7
cart.blade.php
resources/views/cart.blade.php
+1
-1
No files found.
app/Http/Controllers/CartController.php
View file @
4ce9c4d3
...
...
@@ -57,17 +57,10 @@ class CartController extends Controller
$cart
->
removeItem
(
$product
->
id
);
$response
=
[];
if
(
!
$cart
->
total_qty
)
{
Session
::
forget
(
'cart'
);
$response
[
'redirectLink'
]
=
route
(
'homepage'
);
return
json_encode
(
$response
);
return
route
(
'homepage'
);
}
$response
[
'totalQty'
]
=
$cart
->
total_qty
;
return
json_encode
(
$response
);
}
public
function
clearCart
()
...
...
public/js/cart.js
View file @
4ce9c4d3
...
...
@@ -36,14 +36,11 @@ function setRemoveItemEventListener() {
axios
.
post
(
actionUrl
)
.
then
(
function
(
response
)
{
const
data
=
response
.
data
;
if
(
'totalQty'
in
data
)
{
document
.
querySelector
(
'.amount-in-cart'
).
textContent
=
data
.
totalQty
;
e
.
target
.
closest
(
'.js-product-row'
).
remove
();
toastr
.
success
(
'Product deleted'
);
const
redirectLinkWhenCartIsEmpty
=
response
.
data
;
if
(
redirectLinkWhenCartIsEmpty
)
{
window
.
location
.
replace
(
redirectLinkWhenCartIsEmpty
);
}
else
{
window
.
location
.
replace
(
data
.
redirectLink
);
document
.
location
.
reload
(
true
);
}
})
.
catch
(
function
(
error
)
{
...
...
resources/views/cart.blade.php
View file @
4ce9c4d3
...
...
@@ -63,7 +63,7 @@
<
tbody
class
="
js
-
products
-
in
-
cart
">
@foreach(
$products
as
$product
)
<tr
class="
js
-
product
-
row
"
>
<tr>
<td>
<div class="
row
">
<div class="
col
-
sm
-
3
hidden
-
xs
"><img src="
/
img
/
{{
$product
[
'item'
]
->
type
}}
.
jpg
" width="
100
" height="
100
" alt="
{{
$product
[
'item'
]
->
reference
}}
" class="
img
-
responsive
"/></div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment