简体   繁体   English

如何使用桌面Java程序连接到Prestashop数据库

[英]How to connect to prestashop database with desktop java program

I am a beginner with java and I can't find anything on my problem (wich is not a good sign...) 我是Java的初学者,但我的问题找不到任何东西(这不是一个好兆头...)

My objective would be to : 我的目标是:

  • Create a prestashop website 创建一个prestashop网站
  • Create a desktop java program that a customer of the prestashop website will be able to download 创建一个桌面Java程序,prestashop网站的客户可以下载该程序
  • In this program, ask the user to enter his email and password that he used to order on the prestashop website 在此程序中,要求用户在prestashop网站上输入用于订购的电子邮件和密码。
  • Check if the user exists (with his password) and look for the list of products that he bought. 检查用户是否存在(使用密码),并查找他购买的产品列表。

Is it possible to do so ? 有可能这样做吗? If yes, how can I do it ? 如果是,我该怎么办? I was thinking of maybe using the Prestashop API, but I don't know how... 我当时在考虑使用Prestashop API,但我不知道如何...

Thank you very much for your help 非常感谢您的帮助

You can do that by creating a web-service. 您可以通过创建Web服务来做到这一点。 This web-service will be a simple PHP file existing inside your PrestaShop directory. 该Web服务将是PrestaShop目录中存在的简单PHP文件。

You need to communicate with this file to perform desired actions. 您需要与此文件进行通信才能执行所需的操作。 You can send and fetch data in JSON format (ie supported by both Java and PHP). 您可以发送和获取JSON格式的数据(即Java和PHP都支持)。

Yes you can do what you want, but you will require a Prestashop API Key to connect your java app with Prestashop webservices. 是的,您可以做您想做的事,但是您需要使用Prestashop API密钥才能将Java应用程序与Prestashop Web服务连接。

Find more info here: Prestashop Webservices 在此处查找更多信息: Prestashop Web服务

Anyway, you dont need that user enter his password to know what product did he bought. 无论如何,您不需要该用户输入密码即可知道他购买了什么产品。 Just with registered email address you can identify customer properly in Prestashop. 仅使用注册的电子邮件地址,您就可以在Prestashop中正确识别客户。

Good luck. 祝好运。

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

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