dongnaota6386 2015-06-06 21:46
浏览 13
已采纳

如何存储客人结账?

Ok, so my site is just like "Post Your Order" rather than the usual online payment method since I will be shipping the item first then the cash which is the Cash On Delivery offered by Shipping services here.

I have a users table which have user_id, email, password, first and last name, etc.

an user_order table which have order_id, user_id_fk, order_status, order_placed, address_id_fk

an order_items table which have order_item_id, order_id_fk, product_id, quantity, size_id_fk

address table address_id, user_id_fk, street, city, province, etc

So, if the user is registered it's easy to do this since i would just link their user_id to the user_order table and the address from their address_book

My problem is, how do i do that with guest checkouts? I'm trying to avoid them to be forced to register even though it's easy.

What on my mind right now is to just insert them to the users table too, but with their password as NULL and just make a guest group and put them to that group.

But that may cause a problem, email in my users table must be unique, guest checkouts may happen more than once from the same email soo... now what?

should i just add column to the orders table? another, name, email, address? so it's not tied to the users? that's possible but there's a feature i would like the registered user to have... to track their Order History.

Help please... Thanks :D ;)

  • 写回答

4条回答 默认 最新

  • doutanghuan9595 2015-06-06 22:18
    关注

    I agree with "Drew Pierce" but from other side to give you another option

    first you should read about eCommerce platform (for example OpenCart), how they drive this stuff.

    second you don't need to add the each guest to the user table for the following:

    1- guest does not have any right to see the history of orders or ... etc

    2- email field must be mandatory in checkout and there is notification email will send to him also (maybe you add confirmation email.. up to you).

    3- all what you need to save in your DB is the order details in the order table

    4- all the process between you and the guest will be via his email

    5- he do not have right to track any order or see his activities till he become a real user

    6- order details must always has the all detail about the user even if he is real user (it will be duplicated data for real user but the user can change his email or phone number in any time, where he can not do it for the old order ,, so you always know the real history of the orders)

    7- in the user table, there is only one guest user but in the order table there are many orders and each order has its details, email, phone number ,,, etc

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值