In Part-206 of the Laravel E-commerce series, we will work on Cancel Order functionality like Amazon.
How to Cancel Order on Amazon?
First, we will practically know the process of cancelling orders on Amazon so that we can replicate the same in our Laravel E-commerce Website.
To cancel orders on Amazon that aren't dispatched yet:
- Go to Your Orders
- Select the item you want to cancel and click Cancel items
- Provide reasons for Cancellation
- Click on Cancel Checked Items
For more details on Amazon Cancel process, please check:- https://www.amazon.in/gp/help/customer/display.html?nodeId=GSL37WQTJZUYA9QE
So, we will try to replicate and will create a "Cancel Order" button on the user order detail page from where the user can easily cancel his new order that is not shipped or delivered.
Steps to create Cancel Order Process like Amazon in Laravel E-commerce website:-
1) Update order_details.blade.php:-
First of all, create a "Cancel Order" button at order_details.blade.php file with class btnCancelOrder.
2) Update front_script.js file:-
Add jQuery script to confirm to cancel the order at front_script.js file.
3) Update Order Model:-
Create getOrderStatus function at Order model to get the order status
4) Update order_details.blade.php:-
Include Order model and call getOrderStatus function to get the current order status and add a condition to show "Cancer Order" button if the order status is "New".
5) Create Route:-
Create GET route in web.php file with order id as parameter.
// User Order Cancel
Route::get('/orders/{id}/cancel','OrdersController@orderCancel');
6) Create orderCancel function:-
Now create orderCancel function to cancel the order and the logs table with "Cancelled" status.
To be continued...
Follow the below playlist to make a Laravel E-commerce Website like Amazon:-
https://studio.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/playlists
Join this channel to get complete code/support:
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join
How to Cancel Order on Amazon?
First, we will practically know the process of cancelling orders on Amazon so that we can replicate the same in our Laravel E-commerce Website.
To cancel orders on Amazon that aren't dispatched yet:
- Go to Your Orders
- Select the item you want to cancel and click Cancel items
- Provide reasons for Cancellation
- Click on Cancel Checked Items
For more details on Amazon Cancel process, please check:- https://www.amazon.in/gp/help/customer/display.html?nodeId=GSL37WQTJZUYA9QE
So, we will try to replicate and will create a "Cancel Order" button on the user order detail page from where the user can easily cancel his new order that is not shipped or delivered.
Steps to create Cancel Order Process like Amazon in Laravel E-commerce website:-
1) Update order_details.blade.php:-
First of all, create a "Cancel Order" button at order_details.blade.php file with class btnCancelOrder.
2) Update front_script.js file:-
Add jQuery script to confirm to cancel the order at front_script.js file.
3) Update Order Model:-
Create getOrderStatus function at Order model to get the order status
4) Update order_details.blade.php:-
Include Order model and call getOrderStatus function to get the current order status and add a condition to show "Cancer Order" button if the order status is "New".
5) Create Route:-
Create GET route in web.php file with order id as parameter.
// User Order Cancel
Route::get('/orders/{id}/cancel','OrdersController@orderCancel');
6) Create orderCancel function:-
Now create orderCancel function to cancel the order and the logs table with "Cancelled" status.
To be continued...
Follow the below playlist to make a Laravel E-commerce Website like Amazon:-
https://studio.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/playlists
Join this channel to get complete code/support:
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join
- Catégories
- E commerce Amazon
Commentaires