Whalegistic是一个电子商务平台,此包是Whalegistic平台API与用户网站之间的连接

v0.0.9 2024-09-11 19:11 UTC

This package is auto-updated.

Last update: 2024-09-11 19:24:31 UTC


README

这是一个帮助电子商务企业、批发商、分销商和开发者尽可能快地开始销售产品并管理他们的产品、促销、库存以及与电子商务商店相关的一切的平台。 Whalegistic目前正在发展中,为想要开设在线商店的人提供更好的体验。

考虑到这一点,我们创建了一种让开发者能够连接到我们的平台并快速获取构建在线商店所需的所有信息的方法。获取产品,按颜色或大小分组,搜索促销活动,向客户展示可用库存,获取所有产品系列,创建订单并搜索特定客户的现有订单。

快速入门

为了能够使用此工具,您需要在Whalegistic上创建一个账户。为此,请访问我们的网站 Whalegistic网站 并在以下URL中创建账户 Whalegistic注册(注意:如果您被要求发送注册请求,是因为我们仍处于测试阶段,我们需要审查您的申请)。

在您有了账户之后,请创建一个商店 > 然后转到设置 > 导航到API > 并创建您第一个API密钥。您将需要这些密钥才能通过API访问您的账户。不要将这些密钥告诉任何您不信任的人!

要安装Whalegistic API工具,只需运行以下命令

composer require whalegistic/api

之后,您可以使用Whalegistic API库和您的API密钥连接到您的账户。在以下部分将解释如何做到这一点!

连接到Whalegistic

为了连接到Whalegistic,您需要密钥和公开密钥。这是您登录Whalegistic的方法。从那时起,您将能够使用whale变量连接到Whalegistic。

use Whalegistic\API\Whalegistic;

$whale = new Whalegistic($WHALEGISTIC_SECRET_KEY, $WHALEGISTIC_PUBLIC_KEY)

您只需做一次,以便接收用于与Whalegistic API一起使用的必要凭证。

请求


获取品牌

获取在您的Whalegistic商店上创建的所有品牌。

这是请求参数的样子

Parameters:
	$request_parameters = array() // no parameters

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		brands => // array of all brands objects
	)

发送请求代码

$response = $whale->getBrands($request_parameters)

获取类别

获取在您的Whalegistic商店上创建的所有产品的类别。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		categories => // array of all categories objects
	)

发送请求代码

$response = $whale->getCategories($request_parameters)

获取系列

获取在您的Whalegistic商店上创建的所有产品系列。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		collections => // array of all collections objects
	)

发送请求代码

$response = $whale->getCollections($request_parameters)

获取商店

获取显示在您的在线商店上的所有必要信息。通常这是开始显示所有不同过滤器(如不同品牌、类别、系列和产品)的基石。这是多个函数的组合。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		min_price => // lowest price for the searched products
		max_price => // highest price for the searched products
		offset => // offset of products ex: 20 will skip the first 20 products
		limit => // limit of products ex: 40 will send back 40 products
		promotions => //
		search_by_names: array(
			Products => // name of products searching for
			Brands => // brand name of products searching for
			Categories => // categories name of products searching for
			Collections => // collections name of products searching for
		)
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		products => // array of products objects
		max_product_price => // the highest product price
		number_products => // total number of products
		brands => // array of all the brands objects
		categories => // array of all the categories objects
		collections => // array of all the collections objects
	)

发送请求代码

$response = $whale->getStore($request_parameters)

获取产品

获取在您的Whalegistic商店上创建的所有产品,并通过请求参数进行筛选。返回一个产品数组,最高价格的产品价格和您拥有的产品总数。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		min_price => // lowest price for the searched products
		max_price => // highest price for the searched products
		offset => // offset of products ex: 2 will skip the first 2 products
		limit => // limit of products ex: 4 will send back 4 products
		promotions => //
		search_obj: array(
			Products_IDs => // array of products ids ex: [1, 2, 3, ...]
			Name => // name of products searching for
			SKU => // SKU of product searching for
			Models_IDs => // array of models ids of products searching for ex: [1, 2, 3, ...]
			Brands => // array of brands ids of products searching for ex: [1, 2, 3, ...]
			Categories => // array of categories ids of products searching for ex: [1, 2, 3, ...]
		)
		search_by_names: array(
			Products => // name of products searching for
			Brands => // brand name of products searching for
			Categories => // categories name of products searching for
			Collections => // collections name of products searching for
		)
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		products => // array of products objects
		max_product_price => // the highest product price
		number_products => // total number of products
	)

发送请求代码

$response = $whale->getProducts($request_parameters)

获取型号

获取您在Whalegistic Store上创建的所有模型。模型是父级产品,可以存储您所有产品的信息、照片和视频,以便更容易创建与特定模型关联的新产品。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		offset => // offset of products ex: 2 will skip the first 2 products
		limit => // limit of products ex: 4 will send back 4 products
		search_obj: array(
			model_name => // name of models searching for
			model_mid => // MID of models searching for
			brand_name => // brand name of models searching for
			category_name => // categories of models searching for
		)
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		models => // array of all models objects
	)

发送请求代码

$response = $whale->getModels($request_parameters)

获取收藏夹中的产品

获取您在Whalegistic Store上创建的收藏夹中的所有产品。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		collections => // array of collections id's ex: [1, 2, 3, ...]
		offset => // offset of products ex: 2 will skip the first 2 products
		limit => // limit of products ex: 4 will send back 4 products
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		products => // array of all products objects
		total_products_count => // total number of products on that collection
		max_price => // highest price of a product on that collection
	)

发送请求代码

$response = $whale->getCollectionProducts($request_parameters)

获取相关产品

获取作为请求参数发送的特定产品的相关产品。这些相关产品基于与目标产品一起购买的数量进行选择。如果没有与目标产品一起购买的产品,则将填充随机产品,直到有特定的相关产品模式。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		product_id => // desired product id
		offset => // offset of products ex: 2 will skip the first 2 products
		limit => // limit of products ex: 4 will send back 4 products
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		products => // array of all products objects
	)

发送请求代码

$response = $whale->getRelatedProducts($request_parameters)

按Slug获取产品

根据其定制的URL Slug获取特定的产品,这是Webstore希望在其网站URL上使用所需产品名称以获得更好的SEO的理想选择。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		product_slug => // desired product's url slug
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		product => // product's object
	)

发送请求代码

$response = $whale->getProductBySlug($request_parameters)

获取客户

获取在Whalegistic Store上创建的特定客户对象或通过API创建的客户对象。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		client_id => // id of the desired client
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		client => // client's object
	)

发送请求代码

$response = $whale->getClient($request_parameters)

创建新客户

在Whalegistic Store上创建新的客户对象。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		name => // client's name
		email => // client's email
		phone => // client's phone
		del_address => // client's delivery address
		del_city => // client's delivery city
		del_country => // client's delivery country
		del_zip => // client's delivery zip code
		vat_num => // client's delivery VAT number
		inv_name => // client's invoice name
		inv_address => // client's invoice address
		inv_city => // client's invoice city
		inv_country => // client's invoice country
		inv_zip_code => // client's invoice zip code
		inv_vat_number => // client's invoice VAT number
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		obj_insert => // object that was inserted with its ID
	)

发送请求代码

$response = $whale->createClient($request_parameters)

更新客户

在Whalegistic Store上更新新的客户对象。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		client_id => // id of the desired client
		client_name => // client's name
		client_email => // client's email
		client_phone => // client's phone contact
		client_vat_number => // client's VAT number
		delivery_address => // client's delivery address
		delivery_city => // client's delivery city
		delivery_country => // client's delivery country
		delivery_zip_code => // client's delivery zip code
		invoice_address => // client's invoice address
		invoice_city => // client's invoice city
		invoice_country => // client's invoice country
		invoice_zip_code => // client's invoice zip code
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
	)

发送请求代码

$response = $whale->updateClient($request_parameters)

获取客户的订单

获取在Whalegistic Store上创建的特定客户订单对象或通过API创建的订单对象。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		client_id => // id of the desired client
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		orders => // array of all orders objects
	)

发送请求代码

$response = $whale->getClientOrders($request_parameters)

获取客户资料

获取特定客户的订单对象及其资料,这些订单和资料都是在Whalegistic Store上创建或通过API创建的。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		client_id => // id of the desired client
	)

这是返回对象的样子

Return:
	array(
		client => // the client's object
		client_orders => // an array of the client's orders objects
	)

发送请求代码

$response = $whale->getClientProfile($request_parameters)

创建新联系人

从您的Whalegistic Store上的客户创建新的联系人。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		name => // contact name
		email => // valid contact email
		about => // what the contact is about
		message => // the contact message
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		obj_insert => // object that was inserted with its ID
	)

发送请求代码

$response = $whale->createContact($request_parameters)

创建新通讯录

从您的Whalegistic Store上的客户提交新的通讯录订阅。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		email => // desired email to add to the newsletter list
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		obj_insert => // object that was inserted with its ID
	)

发送请求代码

$response = $whale->createNewsletter($request_parameters)

获取运费率

获取您的Whalegistic Store上可用的所有运费成本率。

这是请求参数的样子

Parameters:
	$request_parameters = array() // no parameters

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		shipping_costs => // array of all shipping costs objects
	)

发送请求代码

$response = $whale->getShippingRates($request_parameters)

获取特定运费率

获取特定的运费成本率及其税额转换,这些都是在您的Whalegistic Store上可用的。

这是请求参数的样子

Parameters:
	$request_parameters = array( // it's necessary to choose one of the two
		country_name => // value of the country name
		country_code => // 2 digit country indentifier ex: "US", "GB", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		shipping => // shipping cost object
		conversion_taxes => // array of all tax conversions objects
	)

发送请求代码

$response = $whale->getShippingRate($request_parameters)

获取促销代码

在您的Whalegistic Store上获取特定的促销代码。基本上,这可以用来验证促销代码是否存在。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		promo_code => // target promo code value
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		promo_code => // promo code object
	)

发送请求代码

$response = $whale->getPromoCode($request_parameters)

获取订单

获取在您的Whalegistic Store上创建的特定订单,无论是由平台创建还是通过API创建。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		order_id => // id of the desired order
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		order => // order object
	)

发送请求代码

$response = $whale->getOrder($request_parameters)

获取订单总额

此功能简单地根据发送的不同参数计算总价、税费、运费和促销。它还会返回所有必要的产品及其信息,以便从特定产品及其特征创建该订单。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		products: array( // array of products ID's as an object
			array(
				id => // id of the product
				quantity => // quantity of the product
			), 
			array(...) // other object
		)
		shipping_country => // shipping country name to where this order will be sent
		shipping => // default shipping cost if there is no shipping country
		language => // 2 digit language code for translation ex: "EN", "FR", ...
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		total_value => // total price for this order
		vat_value => // total VAT value for this order
		shipping => // shipping price for this order
		currency => // currency of this order
		products => // array of products objects on this order
		promo_code => // promo code this order
	)

发送请求代码

$response = $whale->getTotal($request_parameters)

创建新订单

根据发送的参数创建新订单。如果系统中的Whalegistic Store没有客户信息,这将创建新的客户。客户通过电子邮件地址创建并连接到该订单。

这是请求参数的样子

Parameters:
	$request_parameters = array(
		products: array( // array of products ID's as an object
			array(
				id => // id of the product
				quantity => // quantity of the product
			), 
			array(...) // other object
		)
		del_name => // delivery client's name
		del_email => // delivery client's email
		del_phone => // delivery client's phone contact
		del_address => // delivery client's address
		del_city => // delivery client's city
		del_country => // delivery client's country
		del_zip_code => // delivery client's zip code
		inv_name => // invoice client's name
		inv_address => // invoice client's address
		inv_city => // invoice client's city
		inv_country => // invoice client's country
		inv_zip_code => // invoice client's zip code
		inv_vat_number => // invoice client's VAT number
		payment_status => // "paid" or "not paid"
		shipping => // default shipping cost if the country is not found
		promo_code_id // order promo code id value (don't need to send both promo_code_id and promo_code together)
		promo_code // order promo code value
		is_pvp => // True for an PVP priced or False for a reseller priced order
	)

这是返回对象的样子

Return:
	array(
		succ => // true or false if request was successfull. If false it sends the Error
		new_order => // order object
		order_products => // array of products objects on the new order
		promo_code => // promo code object
	)

发送请求代码

$response = $whale->createOrder($request_parameters)

报告错误

如果在使用Whalegistic App期间发现任何错误,请告诉我们!我们依赖于测试人员和开发人员来帮助我们开发和完善我们的平台和库。

您可以通过电子邮件或通过Whalegistic网站上专门用于报告错误的联系表单与我们联系 - 错误报告

您也可以通过我们的正常联系表单与Whalegistic联系,以提出您可能对我们平台有建议 - 联系表单

结语

Whalegistic仍然是一个年轻的项目,有大的项目和计划。如果您喜欢我们所开发的内容,并希望帮助我们开发和改进Whalegistic,请随时提出任何建议和解决方案。

我们还有一个Slack站点,如果有人想加入我们的团队并进一步讨论Whalegistic应用以及它如何发展成为更好的电子商务平台,请加入我们。

任何帮助都受欢迎且必要!

代表鲸物流团队全体,非常感谢您的支持!