在 WordPress 中创建一个简单的购物车?

发布于 2024-10-01 08:07:05 字数 603 浏览 3 评论 0原文

我有一个 WordPress 网站,我想创建一个简单的网络商务。当我的意思是简单时,它真的很简单:一些帖子/页面将有一个名为“价格”的自定义字段。这些页面上将有一个链接,单击它,用户将被发送到一个简单的购物车。我将在购物车中创建一个结帐页面,该页面主要是一个连接到支付网关的 php 页面,显示信用卡等。我将创建 php 文件,在网关响应后验证有关这些付款的信息。

我不会出售“产品”。我不需要邮局,不需要地址来递送东西,什么都不需要。这只是一个价格和一个从支付网关接收确认的 php。考虑出售“课程”或类似的东西。购买收据将保存在数据库中,以便客户稍后可以参考。

所以,我想我需要创建:

  • 一个购物车页面。该购物车可以使用cookies或数据库来制作。哪种方法是最好的?
  • 结账页面;
  • 一堆脚本来验证来自支付网关的响应;
  • 一个简单的表,存储所有付款响应,包含价格、user_id 等。

我是不是忘记了什么?尝试创建此插件时我还应该注意什么?我听说 WordPress 不使用会话,所以我需要在 WordPress 中为购物车创建一个会话。有人知道这个问题吗?

(我不想使用现有的这些完整的电子商务插件,因为我不需要它们的所有功能。)

I have a wordpress website, and I want to create a simple web commerce. When I mean simple, it's really simple: Some posts/pages are going to have a custom field named "price". These pages are going to have a link on it, and clicking on it, the user is going to be sent to a simple shopping cart. From the shopping cart, I'm going to create a checkout page, which is mainly a php page that connects to a payment gateway, showing credit cards and such. I'm going to create php files that validates info about these payments after the response from the gateway.

I'm not going to sell "products". I don't need postal offices, no address to deliver something, nothing. It's just a price and a php that receives confirmation from the payment gateway. Think of selling "courses" or something like that. A receipt of the buy is going to be in the database, so the client can reference it later.

So, I think I need to create:

  • A shopping cart page. This shopping cart can be made using cookies or the database. Which is the best approach?;
  • A checkout page;
  • A bunch of scripts to validate a response from the payment gateway;
  • A simple table that stores all the payments responses, containig price, user_id and such.

Am I forgetting something? What else should I be aware of when trying to create this plugin? I heard that wordpress don't use sessions, so I would need to create one in wordpress just for the carts. Does anyone knows about this issue?

(I don't want to use these complete e-commerce plugins that exist since I don't need all their features.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

耀眼的星火 2024-10-08 08:07:05

我决定使用 $_COOKIE 来使用 cookie 方法。该 cookie 中的值是一个包含产品信息的 json_encoded 关联数组,通过一些验证在服务器中进行检查。这样我就不必搞乱我读到的 WordPress 中的 $_SESSION 是有问题的,并且即使用户关闭浏览器,也可以拥有相同的购物车。

简单电子商务应用程序的一个很好的例子是真正简单的电子商务

I decided to use a cookie approach using $_COOKIE. The values in that cookie are a json_encoded associative array with product information, that is checked in the server with some validation. That way I don't have to mess up with $_SESSION in wordpress that I read is problematic, and the user can have the same shopping cart even if (s)he closes the browser.

One good example of simple e-commerce application is really simple e-commerce.

醉殇 2024-10-08 08:07:05

只是一个选择,如果您想要一个简单的购物车(与 PayPal 集成)并且不想重新发明轮子,请查看 Simplecart JS 。一个 javascript 持久性购物车,允许您的用户收集商品,然后前往 PayPal 门户完成购买。

Just an option, if you are wanting a simple shopping cart (with PayPal integration) and are not wanting to reinvent the wheel, check out Simplecart JS. A javascript, persistent, shopping cart which allows your users to collect items and then proceed to the PayPal portal to complete the purchase.

莫多说 2024-10-08 08:07:05

设置在线商店的一种简单方法是使用市场主题。

Market是Wordpress的主题模板,包含内置的购物车系统和用于轻松添加和编辑产品的产品管理工具。

它与您的 Paypal 帐户连接以处理您的客户付款。

如果您愿意,可以在此处尝试在线演示:

http://www.markettheme.com/

这样你就可以在做出任何决定之前先尝试一下。

An easy way to setup an online store is by using the Market theme.

Market is a theme template for Wordpress, that contains a built-in shopping cart system, and product administration tool for easily adding and editing products.

It connects with your Paypal account for processing your customer payments.

If you want to, you can play around with an online demo here:

http://www.markettheme.com/

That way you can try it out before you commit to anything.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文