简体   繁体   English

jquery / php / mysql购买订购系统需要帮助

[英]jquery/php/mysql purchase ordering system help needed

i'm attempting to make a purchase ordering system for work in php, mysql and jquery. 我正在尝试制作用于php,mysql和jquery的采购订购系统。 I've got a "running total" working great but i've come to the point where if the user is happy and wants to proceed to order the products they've selected i want to take the items at the bottom of the screen (attached picture to see what i mean) and send the values to a php script which will insert them into a db called "orders". 我的“运行总计”效果很好,但是我想说的是,如果用户满意并且想要继续订购他们选择的产品,我希望将这些商品放在屏幕底部(所附图片,看看我的意思),并将值发送到php脚本,该脚本会将它们插入到名为“ orders”的数据库中。 what i imagined happening was they press "save" and jquery grabs all the values from the rows in the table at the bottom and sends them via "GET" to the waiting PHP, the php would insert all data it receives into the db, all with a unique "id" so people can pull back orders at a later date...I know what i want to do but i'm struggling to plan out the specific mysql querys/jquery stuff! 我想像的是,他们按下“保存”,jQuery从底部表中的行中获取所有值,并通过“ GET”将其发送到等待的PHP,PHP将接收到的所有数据插入数据库,所有具有唯一的“ id”,以便人们可以在以后的日期撤回订单...我知道我想做什么,但是我正在努力计划特定的mysql查询/ jquery内容! Any help appreciated! 任何帮助表示赞赏! 当前进度的屏幕截图

I wouldn't trust the data in the table enough to pull the running total or list prices back from it. 我不会足够信任表中的数据来提取运行总额或从中列出价格。 A user with firebug for example could easily lower the price of their order. 例如,使用萤火虫的用户可以轻松降低其订单价格。

You really want to store the cart in the users session so you can maintain an accurate account of the total on the server side with prices you can trust because the user cannot change them. 您确实希望将购物车存储在用户会话中,以便您可以在服务器端维护一个准确的帐户总数,并且可以信任价格,因为用户无法更改它们。 Never trust data coming back from the front end. 永远不要相信从前端返回的数据。 When the user adds an item to the cart ask the server for the price by product_id rather than using jQuery to grab it from the DOM. 当用户将商品添加到购物车时,通过product_id向服务器询问价格,而不是使用jQuery从DOM中获取价格。

When the user submits an order you don't pass anything using jQuery you just trigger a PHP script that will use the cart stored in the session to process the order. 当用户提交订单时,您不会使用jQuery传递任何内容,您只需触发一个PHP脚本即可使用会话中存储的购物车来处理订单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM