Constants

HTTP_GET

HTTP_GET

HTTP_POST

HTTP_POST

HTTP_PUT

HTTP_PUT

Properties

$errors

$errors : array

Errors triggered at execution

Type

array

$wsUrl

$wsUrl : string

Base PrestaShop webservice URL

Type

string

$method

$method : string

HTTP Method to support

Type

string

$urlSegment

$urlSegment : array

The segment of the URL

Type

array

$urlFragments

$urlFragments : array

The segment list of the URL after the "api" segment

Type

array

$resourceList

$resourceList : array

The list of each resources manageable via web service

Type

array

$resourceConfiguration

$resourceConfiguration : array

The configuration parameters of the current resource

Type

array

$keyPermissions

$keyPermissions : array

The permissions for the current key

Type

array

$objects

$objects : array

The list of objects to display

Type

array

$schemaToDisplay

$schemaToDisplay : string

The schema to display.

If null, no schema have to be displayed and normal management has to be performed

Type

string

$fieldsToDisplay

$fieldsToDisplay : string

The fields to display. These fields will be displayed when retrieving objects

Type

string

$depth

$depth : integer

This is used to have a deeper tree diagram.

Type

integer

$ws_current_classname

$ws_current_classname : \ws_current_classname

Save the class name for override used in getInstance()

Type

\ws_current_classname

$shopIDs

$shopIDs : 

Type

$_available_languages

$_available_languages : 

Type

$_outputEnabled

$_outputEnabled : boolean

Set if return should display content or not

Type

boolean

$objectSpecificManagement

$objectSpecificManagement : boolean

Set if the management is specific or if it is classic (entity management)

Type

boolean

$_docUrl

$_docUrl : string

PrestaShop Webservice Documentation URL

Type

string

$_authenticated

$_authenticated : boolean

Set if the authentication key was checked

Type

boolean

$_startTime

$_startTime : integer

The time in microseconds of the start of the execution of the web service request

Type

integer

$specificOutput

$specificOutput : string

The XML string to display if web service call succeed

Type

string

$_object

$_object : \ObjectModel

The current object to support, it extends the PrestaShop ObjectModel

Type

\ObjectModel

$_inputXml

$_inputXml : string

If we are in PUT or POST case, we use this attribute to store the xml string value during process

Type

string

$_instance

$_instance : \WebserviceRequest

Object instance for singleton

Type

\WebserviceRequest

$_key

$_key : string

Key used for authentication

Type

string

$outputFormat

$outputFormat : string

Name of the output format

Type

string

$objOutput

$objOutput : \WebserviceOutputBuilder

The object to build the output.

Type

\WebserviceOutputBuilder

Methods

getOutputEnabled()

getOutputEnabled() 

setOutputEnabled()

setOutputEnabled(  $bool) 

Parameters

$bool

getInstance()

getInstance() : object

Get WebserviceRequest object instance (Singleton)

Returns

object —

WebserviceRequest instance

getResources()

getResources() 

getPriceForProduct()

getPriceForProduct(  $field,   $entity_object,   $ws_params) : array

This method is used for calculate the price for products on the output details

Parameters

$field
$entity_object
$ws_params

Returns

array —

field parameters.

specificPriceForProduct()

specificPriceForProduct(  $entity_object, array  $parameters) : array

This method is used for calculate the price for products on a virtual fields

Parameters

$entity_object
array $parameters

Returns

array

specificPriceCalculation()

specificPriceCalculation(  $parameters) 

Parameters

$parameters

specificPriceForCombination()

specificPriceForCombination(  $entity_object, array  $parameters) : array

This method is used for calculate the price for products on a virtual fields

Parameters

$entity_object
array $parameters

Returns

array

fetch()

fetch(string  $key, string  $method, string  $url, string  $params,   $bad_class_name, string  $inputXml = NULL) : array

Start Webservice request Check webservice activation Check autentication Check resource Check HTTP Method Execute the action Display the result

Parameters

string $key
string $method
string $url
string $params
$bad_class_name
string $inputXml

Returns

array —

Returns an array of results (headers, content, type of resource...)

setError()

setError(integer  $status, string  $label, integer  $code) : void

Set a webservice error

Parameters

integer $status
string $label
integer $code

setErrorDidYouMean()

setErrorDidYouMean(integer  $num, string  $label, array  $value,   $available_values, integer  $code) : void

Set a webservice error and propose a new value near from the available values

Parameters

integer $num
string $label
array $value
$available_values
integer $code

webserviceErrorHandler()

webserviceErrorHandler(string  $errno, array  $errstr, array  $errfile, array  $errline) : boolean

Used to replace the default PHP error handler, in order to display PHP errors in a XML format

Parameters

string $errno

contains the level of the error raised, as an integer

array $errstr

contains the error message, as a string

array $errfile

errfile, which contains the filename that the error was raised in, as a string

array $errline

errline, which contains the line number the error was raised at, as an integer

Returns

boolean —

Always return true to avoid the default PHP error handler

setFieldsToDisplay()

setFieldsToDisplay() 

getFilteredObjectList()

getFilteredObjectList() 

getFilteredObjectDetails()

getFilteredObjectDetails() 

executeEntityGetAndHead()

executeEntityGetAndHead() : boolean

Execute GET and HEAD requests

Build filter Build fields display Build sort Build limit

Returns

boolean

filterLanguage()

filterLanguage() 

getallheaders()

getallheaders() 

getOutputObject()

getOutputObject(  $type) 

Parameters

$type

webserviceChecks()

webserviceChecks() 

getClosest()

getClosest(string  $input, array  $words) : string

Return the nearest value picked in the values list

Parameters

string $input
array $words

Returns

string

hasErrors()

hasErrors() : boolean

Check if there is one or more error

Returns

boolean

authenticate()

authenticate() : boolean

Check request authentication

Returns

boolean

isActivated()

isActivated() : boolean

Check webservice activation

Returns

boolean

shopHasRight()

shopHasRight(  $key) 

Parameters

$key

shopExists()

shopExists(  $params) 

Parameters

$params

groupShopExists()

groupShopExists(  $params) 

Parameters

$params

checkHTTPMethod()

checkHTTPMethod() : boolean

Check HTTP method

Returns

boolean

checkResource()

checkResource() : boolean

Check resource validity

Returns

boolean

setObjects()

setObjects() 

parseDisplayFields()

parseDisplayFields(  $str) 

Parameters

$str

manageFilters()

manageFilters() 

executeEntityPost()

executeEntityPost() : boolean

Execute POST method on a PrestaShop entity

Returns

boolean

executeEntityPut()

executeEntityPut() : boolean

Execute PUT method on a PrestaShop entity

Returns

boolean

executeEntityDelete()

executeEntityDelete() : boolean

Execute DELETE method on a PrestaShop entity

Returns

boolean

saveEntityFromXml()

saveEntityFromXml(integer  $successReturnCode) : boolean

save Entity Object from XML

Parameters

integer $successReturnCode

Returns

boolean

getSQLRetrieveFilter()

getSQLRetrieveFilter(string  $sqlId, string  $filterValue, string  $tableAlias = 'main.') : string

get SQL retrieve Filter

Parameters

string $sqlId
string $filterValue
string $tableAlias

= 'main.'

Returns

string

returnOutput()

returnOutput() : array

Thanks to the (WebserviceOutputBuilder) WebserviceKey::objOutput Method build the output depend on the WebserviceRequest::outputFormat and set HTTP header parameters.

Returns

array —

with displaying informations (used in the dispatcher).