Create a Dynamic E-Commerce Shopping Cart in Javascript

Sdílet
Vložit
  • čas přidán 12. 09. 2024

Komentáře • 20

  • @sainsolution751
    @sainsolution751 Před 8 měsíci +1

    Good Work 👍🏻

  • @IskeenX
    @IskeenX Před 5 měsíci

    Hey. Nice work. Quick question. How can I import items from my own database instead of API? Let's say SQL or PostgreSQL. I am importing to database through Excel CSV and then i have to connect the database to the website.

    • @refinedguides
      @refinedguides  Před 5 měsíci

      Hi, the database is on the backend, it's insecure to directly access from the frontend as it exposes your DB credentials. You need to create a server side script (like NodeJS or PHP) that query the database and send the result to your frontend (usually via API endpoints in a JSON format). If your frontend is rendered from the server, then no need for API.

  • @zikas-dev
    @zikas-dev Před 8 měsíci

    Great

  • @sab8977
    @sab8977 Před 2 měsíci

    Can I use the same structure, but declaring the itens in php or js with an array?

    • @refinedguides
      @refinedguides  Před 2 měsíci

      If you prefer php, you can convert json to array and display the products using php syntax. But you still need JS for page interaction like open/close cart, etc

  • @jojofirdaus
    @jojofirdaus Před 8 měsíci +1

    i want to change image where sir?

    • @refinedguides
      @refinedguides  Před 8 měsíci +3

      Greetings! With Fakestore API you can' t but you can copy the result of the API and save to a JSON file. From there, you can change the image path then update the initStore() code like this:
      loadProducts('./path/to/file.json').then(renderProducts);
      Hope that helps! 😉

  • @chukwunweikeodue3736
    @chukwunweikeodue3736 Před měsícem

    please , i want to the user to be able to add an item to the cart the second time if when he clicks on "addToCart"

    • @refinedguides
      @refinedguides  Před měsícem +1

      Sure! You can check this and replace the scripts.js file: gist.github.com/refinedguides/4cd12f5d5e51ccf249621ba4816ce7ba

  • @RyouX_Flow33
    @RyouX_Flow33 Před 3 měsíci

    how do you change the image?

    • @refinedguides
      @refinedguides  Před 3 měsíci

      I have replied to another user the answer to the same question before. Pls check other comments.

  • @zikas-dev
    @zikas-dev Před 8 měsíci +1

    what is your vs code theme / font?

  • @ok_e3w
    @ok_e3w Před 7 měsíci +1

    does this video cover the front and back end of the cart

    • @refinedguides
      @refinedguides  Před 7 měsíci

      Just the front end side

    • @savitrik3596
      @savitrik3596 Před 2 měsíci

      @@refinedguides what would be the backend for this ? what will it do

    • @refinedguides
      @refinedguides  Před 2 měsíci

      ​@@savitrik3596 The backend can be made with nodejs, php, or any server side language. It's the bridge between the frontend and your database.

    • @savitrik3596
      @savitrik3596 Před 2 měsíci

      @@refinedguides will it be storing the cart details instead of the local storage? in this context.

    • @refinedguides
      @refinedguides  Před 2 měsíci

      ​@@savitrik3596 If you want to shop across devices, pause/continue later, get analytics, then you can save the cart in the db.