Webshop API
Product API
getProducts
Retrieve filtered, paginated and ordered products list
Return: array of productItem?
Arguments:
pages - object with information about the paging navigation (pager)
filter - object with information about the filter for product list. Optional. (filter)
order - object with information about the ordering. Optional. (structure)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $pager = new stdClass(); $pager->page = 1; $pager->onPage = 15; $filter = new stdClass(); $filter->category = 2; $filter->name = "auto"; $filter->price = array(0, 20000); $sort = new stdClass(); $sort->field = 'name'; $sort->order = 'asc'; $productsData = $client->getProducts($pager, $filter, $sort); $pagerData = $productsData->pager; $productsList = $productsData->data; ?>
getProductInfo
Retrieve full info about product by product id.
Return: object (productInfo)
Arguments:
id - product id. (int)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $productInfo = $client->getProductInfo(1); ?>
getProductFromMetacategory
Retrieve product id from metacategory by metacategory id and attribute filter.
Return: object (productInfo)
Arguments:
metacategoryId - metacategory id. (int)
filter - object with information about the attribute filter. (filter)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $filter = new stdClass(); $filter->attribute_4 = 2; $filter->attribute_19 = 'S'; $productId = $client->getProductFromMetacat egory(1, $filter); ?>
Category API
getCategoryList
Retrieve product categories list
Return: array of categoryItem?
Arguments:
id - id of parent category. If the id is not set, it will return a list of root categories. Optional. (int)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $result = $client->getCategoryList(); ?>
getCategoryInfo
Retrieve category info by category id.
Return: object (categoryItem)
Arguments:
id - category id. (int)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $result = $client->getCategoryInfo(1); ?>
getCategoryPath
Retrieve path to given category starting from root category.
Return: object (categoryPath)
Arguments:
id - category id. (int)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $currentCategoryId = 15; $path = $client->getCategoryPath($ currentCategoryId); ?>
User API
getUserFields
Retrieve fields available in user profile, including login and personal information fields, address fields.
Return: object (userFieldList)
Arguments:
none
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $availableFields = $client->getUserFields(); ?>
registration
Register new client in system using given client data.
To get list of fields, that are available for registration, use getUserFields() method.
User will be autoapproved if $autoApprove is set to true.
Return: object (registrationResult)
Arguments:
data - client data (userInfo)
autoApprove - user will be autoapproved if autoApprove is set to true
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $result = $client->registration(array( 'cpr' => '9999', 'name' => 'John', 'address1' => ... ... )); ?>
updateProfile
Update user profile in system using given client data.
The user must be logged in, before update profile.
To get list of fields, that are available for update, use getUserFields() method.
Return: object (updateProfileResult)
Arguments:
data - client data (userInfo)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $result = $client->updateProfile(array( 'cpr' => '9999', 'name' => 'John', 'address1' => ... ... )); ?>
login
Perform user login using given login and password.
This method will set client_id variable in current session object if operation successed
Return: object (loginResult)
Arguments:
login - user login (string)
password - user password (string)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $loginResult = $client->login('john', 'pass123'); ?>
logout
Perform currently loggedin user logout.
This method will unset client_id variable in current session object if operation successed
Return: object (logoutResult)
Arguments:
none
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $logoutresult = $client->logout(); ?>
Basket API
addToBasket
Add product to basket using product id and quantity.
Return: object (basketResult)
Arguments:
productId - product id (int)
qty - quantity. default value is 1 (float)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $basketResult = $client->addToBasket(2, 3); ?>
removeFromBasket
Add product to basket using product id.
Return: object (basketResult)
Arguments:
productId - product id for remove (int)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $basketResult = $client->removeFromBasket(2); ?>
updateBasket
Add product to basket using product id.
Return: object (updateBasketResult)
Arguments:
products - basket info with product id and new quantity (basket)
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $basketResult = $client->updateBasket(array( array('id' => 2, 'qty' => 4) )); ?>
Invoice API
saveOffer
Save offer in accounting system. based data from client basket.
Return: object (saveOfferResult)
Arguments:
none
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $offerResult = $client->saveOffer(); ?>
makeInvoice
make invoice based offer data. Should be call when client has paid.
Return: object (makeInvoiceResult)
Arguments:
$offerId - id of paid offer
Example:
<?php $client = new SoapClient('http://host/webshop/?WSDL'); $makeInvoiceResult = $client->makeInvoice(1); ?>