dongtan5555 2017-02-16 20:49
浏览 37
已采纳

使用php checkout情况的电子商务网站

I am developing an Ecommerce website and I have one doubt in my mind. Suppose user added a product in his cart and clicked on checkout and he is transfered to a payment gateway which arises some conditions

  1. At the same time another user 2 checking out the same product while the user 1 is in checkout process , so should i display the product quantity one less or should i display the same quantity until the user 1 successfully make the payment.
  2. What if user 1 clicked on checkout and never came back from a gateway like he has closed the browser or a tab and i have deducted the quantity when he clicked on checkout button so that user 2 can see the actuall quantity available.

  3. if i don't deduct the quantity when checkout button is clicked and user 2 has also checked out just after the user 1 and product is having limited quantity which have been bought by user 1.

How to handle this situation? I am using php and mysql.

  • 写回答

1条回答 默认 最新

  • dongyangzhi0687 2017-02-16 21:05
    关注

    I recommend you to deduct the quantity only when the checkout is finished.

    The user who finish the checkout last will receive an error explaining that the product isn't available anymore.

    Another approach used by e-commerces is JIT(Just-in-time), so the product is "always available" and this problem will not happens.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加