Login Cart Persistence - Django Wednesdays ECommerce 28

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024

Комментарии • 38

  • @Codemycom
    @Codemycom  7 месяцев назад

    ▶ Watch Django Wednesdays Ecommerce Playlist ✅ Subscribe To My RUclips Channel:
    bit.ly/3OBQJfN bit.ly/2IGzvOR
    ▶ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take 50% off with coupon code: youtube50 bit.ly/2VC9WUN
    ▶ Get The Code
    bit.ly/47xAhWJ

  • @fantasyworld1087
    @fantasyworld1087 7 месяцев назад +6

    Waiting for Checkout and payment gateway.

  • @fantasyworld1087
    @fantasyworld1087 7 месяцев назад +1

    Hey John, I have been following you for two years. Firstly I have learnt your blog playlist. Then I started learning ecommerce from other source and also developed a project but my thirst was not satisfied. When I found your ecommerce playlist I started learning it. It's also awesome as blog playlist. I am thankful to you. I am actually a college teacher. I started learning programming just for fun but now it's my hobby and coding gives me pleaser. I think your teaching method makes it easy for us. Thank you very much. Keep teaching us as always in your style.

    • @Codemycom
      @Codemycom  7 месяцев назад +1

      Thanks! I appreciate it!

  • @namdarcs
    @namdarcs 6 месяцев назад

    Hey John, Sorry just catching up here from a couple weeks off! I think I may have noticed a bug with the persistent shopping cart... With the code we have implemented thus far it appears when we update the quantity from the view cart function and than log out and log back in... the quantity is not saved, it only shows last quantity item selected from adding to the cart function.... I went back between tutorials 15 and 19 to see if I perhaps made a mistake but I cant see any.... Do we want the cart quantity to retain if the user logouts after updating from there? Let me know I can clarify further if required :) Thanks for all the hard work here !

  • @SabbirHMukul
    @SabbirHMukul 7 месяцев назад

    how many video do you publish to complete ecommerce Django projects?

    • @Codemycom
      @Codemycom  7 месяцев назад

      No clue, it'll go as long as I find interesting things to talk about.

  • @SalamiEdwin
    @SalamiEdwin 3 месяца назад

    Hi John,
    Still in the past a bit (based on how many videos I still need to complete to get to your most recent video). I however made an observation about this video. When I logout and add things to the cart, the things I add show in the cart when I log back in. Is that how you planned it to be or are we missing something?

    • @Codemycom
      @Codemycom  3 месяца назад

      We deal with that later in the playlist

    • @SalamiEdwin
      @SalamiEdwin 3 месяца назад

      @@Codemycom Alright, thanks🙏

  • @nishantkhorwal7078
    @nishantkhorwal7078 7 месяцев назад

    Can we get a checkout and payment gateway fast pleaseee

    • @Codemycom
      @Codemycom  7 месяцев назад

      It'll come when it comes lol

  • @poslepepper
    @poslepepper 7 месяцев назад

    Hi!
    Could you please show how to view others users profiles and same time be logged in for another user.
    Like: Iam Bob and want to see Johns and Marks profile, with their stuff.

    • @Codemycom
      @Codemycom  7 месяцев назад

      No, that wouldn't be appropriate for an ecommerce app. People's shopping information is private. I have other Django playlists where we do that sort of thing.

    • @poslepepper
      @poslepepper 7 месяцев назад

      Agree with you!
      I saw all the videos from the “Meeps”, can’t find it there too. Could you please send the link or tell in which playlists I can find it?

    • @Codemycom
      @Codemycom  7 месяцев назад

      I have a half dozen django playlists here, I have no clue, look around@@poslepepper

  • @joselucianocastro2836
    @joselucianocastro2836 Месяц назад

    Hello, first of all, thank you for this great project, I don't know if what I'm suggesting is logical, but right now at this point I don't see it contemplated, the situation is, an anonymous user who registers 1 or more products logs in. the system and does not buy more products and logs out, what I observe is that the cart is not persisted in the database, of course I do not know if this should be corrected or is it the normal behavior of ecommerce. Greetings

    • @Codemycom
      @Codemycom  Месяц назад +1

      No, an anonymous user can't log in. Logging in requires that you register. Your thing can't happen. If they aren't registered or logged in, then of course we don't want to save that to the database.

    • @joselucianocastro2836
      @joselucianocastro2836 Месяц назад

      I haven't explained myself well, I'm sorry. What I mean is that a user adds 1 or more products to the cart, he logs into the system, and if within the system he does not add more products and then logs out, then we have a case in which, having added a product, he does not We have persisted in the database, of course the question was whether this operation would be logical? I have implemented this, an else to the if saved_cart:
      # Convert database string to python dicctionary
      if saved_cart:
      # Convert to dicctionary using JSON, para esto se importa libreria JSON
      #para que este json.loads() funciona se necesita tener este tipo de diccionario {"2":3, "5":1}
      converted_cart = json.loads(saved_cart)
      # Add the loaded cart dictionary to our session
      # Get the Cart
      cart = Cart(request)
      # Loop thru the cart and add items from the database {"3": 5, "1": 1}

      for key, value in converted_cart.items():
      #aqui se llama al metodo add de la clase Cart, pasando el product.id y quantity
      # cart.add(product=key, product_qty=value)
      # pero a ultima hora decide hacer otro metodo en la clase Cart
      cart.db_add(product=key, product_qty=value)
      """
      else:
      print("Me logo tengo productos siendo anonimo, este es el carro de la sesion", request.session.get('session_key'))
      # Get the Cart
      cart = request.session.get('session_key')

      # get the Current user Profile
      current_user = ProfileUser.objects.get(user=request.user)
      # Convert {'3':1, '2':3} to {"3":1, "2":3}
      carty = str(cart)
      carty = carty.replace("\'", "\"")
      print("carty es. ", carty)
      #Save the carty to the ProfileUser Model
      #current_user.update(old_cart=str(carty)) asi lo hace el
      current_user.old_cart = carty
      current_user.save()
      """

    • @joselucianocastro2836
      @joselucianocastro2836 Месяц назад

      ​@@Codemycom I haven't explained myself well, I'm sorry. What I mean is, if a user adds one or more products to the cart, he logs into the system, within the system he does not add more products and immediately logs out, because we have a case in which, having added some product, he does not We have persisted it in the database, of course the question was whether this operation would be logical? I have implemented this, an else in case the old_cart field is empty:
      # Convert database string to python dicctionary
      if saved_cart:
      # Convert to dicctionary using JSON, para esto se importa libreria JSON
      #para que este json.loads() funciona se necesita tener este tipo de diccionario {"2":3, "5":1}
      converted_cart = json.loads(saved_cart)
      # Add the loaded cart dictionary to our session
      # Get the Cart
      cart = Cart(request)
      # Loop thru the cart and add items from the database {"3": 5, "1": 1}

      for key, value in converted_cart.items():
      #aqui se llama al metodo add de la clase Cart, pasando el product.id y quantity
      # cart.add(product=key, product_qty=value)
      # pero a ultima hora decide hacer otro metodo en la clase Cart
      cart.db_add(product=key, product_qty=value)
      """
      else:

      # Get the Cart
      cart = request.session.get('session_key')

      # get the Current user Profile
      current_user = ProfileUser.objects.get(user=request.user)
      # Convert {'3':1, '2':3} to {"3":1, "2":3}
      carty = str(cart)
      carty = carty.replace("\'", "\"")
      print("carty es. ", carty)
      #Save the carty to the ProfileUser Model
      #current_user.update(old_cart=str(carty))
      current_user.old_cart = carty
      current_user.save()
      """

    • @joselucianocastro2836
      @joselucianocastro2836 Месяц назад

      I haven't explained myself well, I'm sorry. What I mean is, if a user adds one or more products to the cart, he logs into the system, within the system he does not add more products and immediately logs out, because we have a case in which, having added some product, he does not We have persisted it in the database, of course the question was whether this operation would be logical? I have implemented this, an else in case the old_cart field is empty:
      if saved_cart:
      # Convert to dicctionary using JSON, para esto se importa libreria JSON
      #para que este json.loads() funciona se necesita tener este tipo de diccionario {"2":3, "5":1}
      converted_cart = json.loads(saved_cart)
      # Add the loaded cart dictionary to our session
      # Get the Cart
      cart = Cart(request)
      # Loop thru the cart and add items from the database {"3": 5, "1": 1}

      for key, value in converted_cart.items():
      #aqui se llama al metodo add de la clase Cart, pasando el product.id y quantity
      # cart.add(product=key, product_qty=value)
      # pero a ultima hora decide hacer otro metodo en la clase Cart
      cart.db_add(product=key, product_qty=value)

      else:
      # Get the Cart
      cart = Cart(request).cart
      #cart = request.session.get('session_key')

      # get the Current user Profile
      current_user = ProfileUser.objects.get(user=request.user)
      # Convert {'3':1, '2':3} to {"3":1, "2":3}
      carty = str(cart)
      carty = carty.replace("\'", "\"")
      print("carty es. ", carty)
      #Save the carty to the ProfileUser Model
      #current_user.update(old_cart=str(carty)) asi lo hace el
      current_user.old_cart = carty
      current_user.save()

  • @alexallcool
    @alexallcool 7 месяцев назад

    Hi @Codemycom and thank you so much for this detailed course! Will you make a video about how to customise/change CSS styles for this shopping project?

    • @Codemycom
      @Codemycom  7 месяцев назад

      No, I'm not a design guy...we're learning the functionality of the thing, not how to make it look pretty.

  • @vahid-m8b
    @vahid-m8b 7 месяцев назад

    Do you have plans for online chat ؟For this course!

    • @Codemycom
      @Codemycom  7 месяцев назад +1

      No, that's not really a core function of an ecommerce site.

    • @vahid-m8b
      @vahid-m8b 7 месяцев назад

      @@Codemycom Thank you for your efforts, and i meant to talk between admin and buyers !

    • @Codemycom
      @Codemycom  7 месяцев назад +1

      yes I understood what you meant, my answer doesn't change@@vahid-m8b

  • @БогданСокольников-т1н
    @БогданСокольников-т1н 7 месяцев назад

    Two brilliant video's bro, waited for them!

    • @Codemycom
      @Codemycom  7 месяцев назад

      Glad you liked them!

  • @horror3378
    @horror3378 7 месяцев назад

    Good👍

  • @deleos3744
    @deleos3744 7 месяцев назад

    Very clear explanation

  • @rxz7834
    @rxz7834 7 месяцев назад

    Last.. 🙃

    • @Codemycom
      @Codemycom  7 месяцев назад

      huh?

    • @rxz7834
      @rxz7834 7 месяцев назад

      Younglings always try to be "First", so i decided to be last...

    • @Codemycom
      @Codemycom  7 месяцев назад +1

      @@rxz7834 lol

  • @sma1gdz
    @sma1gdz 7 месяцев назад

    💙💙💙💚💚💚