If we are getting the cart from the session, meaning that if after a user has added to the cart, there for adding to the cart session, if the admin update the price due to change in price, the new price will not be update in the session and the customer is going to pay for the old price .
Yes, but you can always rewrite the code to check, if the product price in session does not match as the product price in database, then clear the session and show a message that says, product price has been changed.
But shouldn't there be a way to go back to the website? and if you go back to the website again the items are still in cart. shouldn't the cart be empty after buying the items? how to achieve that?
Recently I found out a way, firstly you need to write your PayPal function in a way that, when the payment is completed it'll redirect to a successful page and display the product from the database based on Product ID that's appended to the url, and not from the session. You can also delete the session when payment is successful to clear the cart. I'll make a tutorial soon, explaining in detail; how to solve this issue.
@@desphixs Actually I did something else. idk how to show you but, I removed the download button, and added a Shop more! button which calls a URL called "payment/success" which uses a view that deletes currents item in the cart. Though I'm not sure if it's the right way but take a look at the following code: def payment_success_redirect_home(request): cart_total_amount = 0 if 'cart_data_obj' in request.session: del request.session['cart_data_obj']
also the reason I removed the download button and didn't just add another button to achieve what I did achieve was because the download button wasn't functioning properly it does download a pdf file but the file is blank with some random images. So also see if it's the same for you and if it is then please let us know how to fix it.
Why did you ignore the billing details I'll appreciate a tutorial on that. I'm currently creating a project that allows only pay on delivery and I think working with the billing details will be very essential for order placement. Thanks in advance
If we are getting the cart from the session, meaning that if after a user has added to the cart, there for adding to the cart session, if the admin update the price due to change in price, the new price will not be update in the session and the customer is going to pay for the old price .
Yes, but you can always rewrite the code to check, if the product price in session does not match as the product price in database, then clear the session and show a message that says, product price has been changed.
Very excellent sir
Thank you, sir. Please, You do mind explaining how you added those live data on the invoice?
I grabbed them from the cart session, just like the way it's was on the cart and the checkout page
But shouldn't there be a way to go back to the website? and if you go back to the website again the items are still in cart. shouldn't the cart be empty after buying the items? how to achieve that?
Recently I found out a way, firstly you need to write your PayPal function in a way that, when the payment is completed it'll redirect to a successful page and display the product from the database based on Product ID that's appended to the url, and not from the session. You can also delete the session when payment is successful to clear the cart.
I'll make a tutorial soon, explaining in detail; how to solve this issue.
@@desphixs Actually I did something else. idk how to show you but, I removed the download button, and added a Shop more! button which calls a URL called "payment/success" which uses a view that deletes currents item in the cart.
Though I'm not sure if it's the right way but take a look at the following code:
def payment_success_redirect_home(request):
cart_total_amount = 0
if 'cart_data_obj' in request.session:
del request.session['cart_data_obj']
return redirect('core:index')
also the reason I removed the download button and didn't just add another button to achieve what I did achieve was because the download button wasn't functioning properly it does download a pdf file but the file is blank with some random images. So also see if it's the same for you and if it is then please let us know how to fix it.
why not just at the page 'payment-completed/' delete everything from 'cart_data_obj' session?
Why did you ignore the billing details I'll appreciate a tutorial on that. I'm currently creating a project that allows only pay on delivery and I think working with the billing details will be very essential for order placement. Thanks in advance
Sure, I'll try to make a video on that
Pure art
thank you for taking the time to share your thoughts, I really appreciate it.
Thank you sir