如何让购物车空着 [英] how to make cart empty intially

查看:55
本文介绍了如何让购物车空着的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我试图将产品添加到我成功完成的购物车中,但下次在Visual Studio中运行我的项目后,早期的产品已经在购物车中。但我希望当新用户访问网站并将产品添加到购物车应该是空的。这里是在购物车中添加价值的代码可以任何正文plz告诉我如何笔:

as i m trying to add product into the cart which i have done successfully but next time after run my project in visual studio that earlier product already there in the cart.but i want when new user visit the website and add the product into the cart that cart should be an empty. here is the code for to add value in the cart can any body plz tell me how i can pen:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
<input type="hidden" name="item_name" value="pen" />

<input type="hidden" name="amount" value="1.00" />
 <input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
    height="1" />
</form>
pencil
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="2" />
<input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
<input type="hidden" name="item_name" value="Pencil" />
<input type="hidden" name="amount" value="2.00" />
<input type="hidden" name="shipping" value="1.00" />
 <input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
    height="1" />
</form>
Car
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="3" />
<input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
<input type="hidden" name="item_name" value="Car" />
<input type="hidden" name="amount" value="10.00" />
<input type="hidden" name="shipping" value="1.00" />
 <input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
<input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
    height="1" />
</form>
View Cart:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="display" value="1" />
<input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
<input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/view_cart_02.gif" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!" />
</form>

推荐答案

BUT how can i reset it plz tell me?
BUT how can i reset it plz tell me?


Clear the session after your use.

Clear the session after your use.
Session["yourcartsession"] = null;





Hope this helps.



Hope this helps.


这篇关于如何让购物车空着的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆