如何将 prestashop 与 android 集成? [英] How to integrate prestashop with android?

查看:31
本文介绍了如何将 prestashop 与 android 集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我使用 prestashop 创建了一个 eshop 网站

Recently I have created a eshop website using prestashop

https://www.prestashop.com/en/

因为我要为它构建安卓应用程序.应用中包含的只是一些基本功能

And since I am going to build the android app for it. What includes in apps are only some basic function

例如创建客户账户/列出产品/订购产品/支付/查看订单等..常见的eshop功能...

e.g. create customer account / list product / order product / pay / view order etc..common eshop functions...

问题是周围的资源似乎很少.是否已经有任何库/官方库/或者我需要从stratch开始创建API?

阅读http://doc.prestashop.com/display/PS16/Developer+Guide有一段时间但不知道我需要从什么开始.

read http://doc.prestashop.com/display/PS16/Developer+Guide for a while but no clue what I need to start with so far.

这是一个相当抽象的问题,但由于社区不是那么受欢迎并且资源有限,我希望这可以从其他人的经验中学习并帮助其他有相同要求的人.

This is quite abstract problem but since the community is not so popular and the resource is limit I hope this can learn from the other's experience and help any others with the same request.

非常感谢您的帮助

推荐答案

问题是周围的资源似乎很少.是否已经有任何库/官方库/或者我需要从stratch开始创建API?

The problem is it seems there are few resources around. Is there any library already there/ offical one / or I need to start create the API from stratch?

与对您的问题的评论之一相反,Prestashop 确实实际上提供了 REST 服务.在文档中它被称为网络服务".

In contrast to one of the comments on your question, Prestashop does actually offer a REST service. In the documentation is it referred to by "web service".

快速链接:

有一些 开源 API 实现可用,但没有专门针对 Android/Java.不过,您可能会发现它们作为指南很有用.

There are a few open source API implementations available, but none specifically for Android/Java. You may find them useful as a guideline though.

需要注意的几点:

Web 服务功能似乎默认处于禁用状态.因此,为了使用它,您必须先在后台启用它.从文档中复制:

The web service feature appears to be disabled by default. So in order to use it, you'll have to enable it first in the back-office. Copied from the docs:

启用网络服务功能

进入 PrestaShop 后台,打开Webservice"页面高级参数"菜单,然后为启用"选择是"PrestaShop 的网络服务".保存您的更改:大功告成!

Go in the PrestaShop back-office, open the "Webservice" page under the "Advanced Parameters" menu, and then choose "Yes" for the "Enable PrestaShop's webservice". Save your change: you're done!

与网络服务通信需要 API 密钥.您必须再次使用后台为您的 Android 应用生成一个:

Communicating with the web service requires an API key. You'll have to generate one for your Android app, again using the back-office:

创建访问密钥

打开Advanced"下的Webservice"页面参数"菜单,然后单击添加新"按钮访问帐户配置部分.出现一个长表格:

Open the "Webservice" page under the "Advanced Parameters" menu, and then click the "Add New" button to access the account configuration section. A long form appears:

  • .API 密钥作为您所在的网络服务帐户的主要标识符创造.单击生成"按钮以获取唯一身份验证钥匙.您也可以创建自己的(长度必须为 32 个字符),但是使用生成的密钥可以防止不法分子猜测您的密钥太容易了.使用此密钥,您和其他选定的用户将能够访问网络服务.
  • 关键描述.帮助你记住你是谁创建该密钥的目的是什么,分配给它的访问权限是什么等.描述不是公开的,但一定要把所有的关键字与用户相关,以便您可以更快地找到他们的密钥.

  • Key. The API key serves as the main identifier for the webservice account you are creating. Click the "Generate" button to get an unique authentication key. You can also create your own (which must be 32 characters long), but using a generated key prevents wrong-doers from guessing your key too easily. Using this key, you and other selected users will be able to access the webservice.
  • Key description. Helps you remember who you created that key for, what are the access rights assigned to it, etc. The description is not public, but make sure to put all the keywords pertaining to the user, so that you can find their key more quickly.

状态.您可以随时禁用任何键.

Status. You can disable any key at any time.

如果您选择使用自定义密码而不是生成的密码,请制作确保它非常安全并且它的权利是有限的——并且它长度为 32 个字符!

If you choose to use a custom passkey instead of a generated one, make sure it is very secure and that its rights are limited – and that it is 32characters long!

最后,了解一下 API 方法:

Finally, to get an overview of the API methods:

从浏览器访问网络服务

您商店的端点webservice 位于您的根目录下的 /api/ 文件夹中Prestashop 的安装:

The endpoint to your store's webservice is located in the /api/ folder at the root of your installation of Prestashop:

要访问它,您需要在请求时提供您的 API 密钥.没有密码,提供您的 API 密钥就足够了——因此密钥应该是由用户保密!您可以键入 API 端点地址直接然后输入您的 API 密钥,或在地址.这是一个示例,使用 UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX作为 API 密钥.

To access it, you need to provide your API key when request. There is no password, providing your API key is enough – and therefore the key should be kept secret by the user! You can either type the API endpoint address directly then enter your API key, or indicate your API key in the address. Here is an example, with UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX being the API key.

您可以使用任何支持 XML 的浏览器对此进行测试.如果没有权限已为密钥设置,然后浏览器会不断要求您无限期输入密钥.

You can test this with any browser that supports XML. If no permission has been set for the key, then the browser will keep asking you to enter the key indefinitely.

结果应该看起来像这样(对于 PrestaShop 1.5.4.1 版):

The result should look somewhat like this (for version 1.5.4.1 of PrestaShop):

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
  <api shop_name="MYSHOP">
    <addresses>...</addresses>
    <carriers>...</carriers>
    <cart_rules>...</cart_rules>
    <carts>...</carts>
    <categories>...</categories>
    <combinations>...</combinations>
    <configurations>...</configurations>
    <contacts>...</contacts>
    <content_management_system>...</content_management_system>
    <countries>...</countries>
    <currencies>...</currencies>
    <customer_messages>...</customer_messages>
    <customer_threads>...</customer_threads>
    <customers>...</customers>
    <deliveries>...</deliveries>
    <employees>...</employees>
    <groups>...</groups>
    <guests>...</guests>
    <image_types>...</image_types>
    <images>...</images>
    <languages>...</languages>
    <manufacturers>...</manufacturers>
    <order_carriers>...</order_carriers>
    <order_details>...</order_details>
    <order_discounts>...</order_discounts>
    <order_histories>...</order_histories>
    <order_invoices>...</order_invoices>
    <order_payments>...</order_payments>
    <order_states>...</order_states>
    <orders>...</orders>
    <price_ranges>...</price_ranges>
    <product_feature_values>...</product_feature_values>
    <product_features>...</product_features>
    <product_option_values>...</product_option_values>
    <product_options>...</product_options>
    <product_suppliers>...</product_suppliers>
    <products>...</products>
    <search >...</search>
    <shop_groups>...</shop_groups>
    <shops>...</shops>
    <specific_price_rules>...</specific_price_rules>
    <specific_prices>...</specific_prices>
    <states>...</states>
    <stock_availables>...</stock_availables>
    <stock_movement_reasons>...</stock_movement_reasons>
    <stock_movements>...</stock_movements>
    <stocks>...</stocks>
    <stores>...</stores>
    <suppliers>...</suppliers>
    <supply_order_details>...</supply_order_details>
    <supply_order_histories>...</supply_order_histories>
    <supply_order_receipt_histories>...</supply_order_receipt_histories>
    <supply_order_states>...</supply_order_states>
    <supply_orders>...</supply_orders>
    <tags>...</tags>
    <tax_rule_groups>...</tax_rule_groups>
    <tax_rules>...</tax_rules>
    <taxes>...</taxes>
    <translated_configurations>...</translated_configurations>
    <warehouse_product_locations>...</warehouse_product_locations>
    <warehouses>...</warehouses>
    <weight_ranges>...</weight_ranges>
    <zones>...</zones>
  </api>
  <api shop_name="MYOTHERSHOP">...</api>
  <api shop_name="YETANOTHERSHOP">...</api>
</prestashop>

既然您提到您主要对支持 Android 应用中的基本/核心功能感兴趣,我倾向于说这可能符合您的需求.:)

Since you mention you're mainly interested in supporting basic/core functionality in the Android app, I'm inclined to say this probably fits your needs. :)

这篇关于如何将 prestashop 与 android 集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆