In Part-119 of E-com series, we will start working on pincodes availability functionality for the products. We will display the "Check Pincode" field at detail page where user can enter his pincode to check whether his location is available for delivery or not.
1) Search Pincodes data :-
First search Google for indian pincodes in excel format or better if we will get MySql database otherwise we will import. You can also search pincodes for your country and I am sure you will also get some data.
2) Create pincodes table :-
Now create pincodes table with below columns :-
id (int, AI, primary)
pincode (varchar,20)
city (varchar,255)
state (varchar, 255)
created_at (datetime)
updated_at (timestamp)
3) Import CSV file :-
We will modify excel file with 6 columns of pincodes table and convert into CSV before importing them into pincodes table as shown in video.
Now our pincodes table is ready with pincodes that are available for shipping of the order. We will not allow the user to place the order with some other pincode.
4) Update detail.blade.php file :-
Now we will update detail.blade.php file with "Enter Delivery Pincode" field where customer can enter his pincode to check if the product is available to be delivered to his place or not.
5) Update main.js file :-
We will now create checkPincode jQuery function in main.js file where we will get the pincode and pass it to checkPincode Laravel function at ProductsController to verify and return with message to intimate the user whether the pincode is available or not. But first we will add condition to check if pincode entered by user or not. If not entered, then we will alert the user to enter and abort the process.
In next video, we will add ajax script to jquery function to check whether the pincode is available or not. And, will play with it by adding lot of stuff.
Thanks for watching :)
Watch video #119 online without registration, duration hours minute second in high quality. This video was added by user Stack Developers 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,787 once and liked it 20 people.