To build any stuff like ecommerce, you have to make a plan first
Step1: always make note what you have done,
Step2: make user validation and stuff, store users in database && also make sure the username or email is unique from eachother
Step3: create a database and create a table for products values of table like name, image, desc, price.... And render it in home page
Step4: then validating the buttons like for example on click of add to cart it should add to the cart of that particular item you can use the product_id here for that so each product have different id numbers so onclick add the product_id & particular username to another table in the database,
Ex with PHP:
$query="SELECT * FROM products";$results=mysqli_query($db,$query);Foreach($resultsas$result){<Formtype="POST"><Inputtype="hidden"value="<?php echo $result['id']; ?>">// I am taking the I'd bcz each and every product will have its own I'd bcz it's auto incremented on upload<Buttontype="submit">Addtocart</Form>$user=$_SESSION['username'];$product_id=$_POST['id'];$query="INSERT INTO cart (id, product_id, username) VALUES ('$product_id', '$user')";Step5:checkwetherthosevaluesuploadedtothetable,iftheyareuploadedthengoforthecartpage,Step6:cartpagefirstgatherthedatausingthosevalueslikeinPHP$query="SELECT * FROM cart WHERE `username`='$_SESSION['username']'";$results=mysqli_query($db,$query);Foreach($resultsas$result){$id=$result['product_id'];$query2="SELECT * FROM products WHERE `id`='$id'";$products=mysqli_query($db,$query);Foreach($productsas$product){echo"<h1>$product['name']</h1>";echo"<img src='$product['image']'>";echo"<p>$product['price']</p>";}}
This will render all the items which were present in the cart,
Step7: add options to increase or decrease the items in the cart if less than one remove the column from the table if it's more than 1 add column and make sure only the count and price must be doubled insted of displaying it as another item on screen,
Step8: now it's a checkout page where all the selected products price will be displayed and Have a payment options like card or cash on delivery ..., Then address part it can be saved to a new table in the database or no, but once after the checkout button is clicked then all the products_ids in cart page where it links to username or email must be deleted so that he doesn't see old items in the cart
To build any stuff like ecommerce, you have to make a plan first
Step1: always make note what you have done,
Step2: make user validation and stuff, store users in database && also make sure the username or email is unique from eachother
Step3: create a database and create a table for products values of table like name, image, desc, price.... And render it in home page
Step4: then validating the buttons like for example on click of add to cart it should add to the cart of that particular item you can use the product_id here for that so each product have different id numbers so onclick add the product_id & particular username to another table in the database,
Ex with PHP:
This will render all the items which were present in the cart,
Step7: add options to increase or decrease the items in the cart if less than one remove the column from the table if it's more than 1 add column and make sure only the count and price must be doubled insted of displaying it as another item on screen,
Step8: now it's a checkout page where all the selected products price will be displayed and Have a payment options like card or cash on delivery ..., Then address part it can be saved to a new table in the database or no, but once after the checkout button is clicked then all the products_ids in cart page where it links to username or email must be deleted so that he doesn't see old items in the cart
Hello that's awesome 😊 to be honest i don't have any skills about web development, i like the system, i followed u on Instagram 😊 thank u!