Technical documentation of the Documents widget
Description
On this page you will find the technical descriptions of the wholesale library. It also describes how you can integrate the library into your system. This allows you to, for example, call up documents and search the content within the document. Below you will find the table of contents for this page:
Contents
- 1 Description
- 2 Contents
- 2.1 Integration via “xs-loader” widget
- 2.2 Parameters “xs-documents“
- 2.2.1 Logic Search
- 2.2.2 Example image
- 2.2.3 Example parameters
- 2.2.4 Example integration
- 2.2.4.1 Widget-Loader V1.x.x
- 2.2.4.2 Widget-Loader V2.x.x
- 2.2.5 Example event “status”
- 2.3 Sample code (PHP)
Integration via “xs-loader” widget
All widgets are integrated via the “xs-loader”.
Parameters “xs-documents“
This widget starts a search with the passed parameters and displays the hits in sales documents as single pages. Only PDF documents are taken into account.
Input | |||
---|---|---|---|
Parameter | Mandatory | Description | Example value |
channelid | Yes | Channelid to be used as the basis for the search. | 2 |
searchRequest | No Either the searchRequest parameter or the combination of searchterm and manufacturerid must be transferred | Structure for transferring supplier-specific search terms.
|
{
"searchRequest": [{
"searchTerms": [
"Suchbegriff 1"
],
"manufacturerid": [
"Lieferant 1",
"Lieferant 2"
]
},
{
"searchTerms": [
"Suchbegriff 2",
"Suchbegriff 3"
],
"manufacturerid": [
"Lieferant 2"
]
}
]
} |
searchterm | No Either the searchRequest or searchterm parameter must be passed. | Search term used to search through the documents in the channel. | test |
manufacturerid | No If the searchRequest parameter is used, this parameter must not be used. | List of manufacturer IDs to limit the search. If no IDs are specified, all documents are searched for the “searchterm” within the channel. | [“COSMO”,”Oventrop”] |
manufactureridtype | No | The ID type that is used for a request. The field only needs to be set if the manufacturerid is to be used by another system. All manufacturerids must be of the same type. This functionality is only available if an IDHUB integration has been ordered. If this parameter is not transferred, the transferred manufacturerid is used by the requested system. The manufactureridtype refers both to the manufacturerid parameter and to the manufacturerid property in the object of the searchRequest parameter. | odc |
maxsize | No | Maximum number of individual pages to be displayed. | 100 |
maxpagesperdocument | No | Maximum number of individual pages that are returned per document. If not specified, 5 is used as the default value. | 5 |
style | No | JSON object for defining the primary and secondary color of the widget. The object has two fields:
| "style":{
"primarycolor": "#616161",
"secondarycolor": "#D3D3D3"
} |
pdfviewer | No | The object serves as a configuration object for the PDF viewer There is currently only one top category
All values are implemented as pixel values. A unit does not necessarily have to be specified. | "pdfviewer":{
"position":{
"top": "150px",
"right": "20px",
"bottom": "50px",
"left": "20px"
}
} |
downloadinnewtab | No | If the parameter is set to true, a new tab opens when the download button is clicked and the file is downloaded.en |
|
downloadinnewtabtarget | No | To be used in conjunction with “downloadinnewtab”. Only used if “downloadinnewtab” is set to true Specifies the target that the download URL should open By default or if no value is set, “_blank” is used |
|
showArchivedDocs | No | Depending on which string is passed, the parameter determines whether only archived or no archived items or all are displayed. The following values can be specified:
Note: The value “all“ is not mandatory, as this value is set by default if the parameter is not passed or is passed empty | |
widgetstate | No | All GET parameters of the XS-Documents widget as a Base64 string. This allows a specific view to be loaded immediately when the deep search is opened. Can be used in combination with the “pdflinkextended” event | |
disableMetaTag | No | The XS-Documents widget includes a meta tag. This meta tag is defined as follows: The tag is essential for displaying the widget on mobile devices. The tag can lead to problems when integrating the widget into apps. This parameter can be used to control whether the meta tag is created. The meta tag can then be provided by the embedded website, for example. Please note that if the tag is switched off, no guarantee can be given for correct display on mobile devices. The default value is false. | true |
Ausgang | |||
status | Yes | This event is always output during initialization.
|
|
shopsearch | No | This event is only output if this function has been switched on for the corresponding channel. The event contains the following two pieces of information.
| |
shopcart | No | This event is only output if this function has been switched on for the corresponding channel.
|
|
dialogstatus | No | This event is output when a dialog is opened and closed. Values:
|
|
pdflink | No | This event is displayed in a PDF document when you click on an external link. | Output of the value specified in the PDF document for the external link as a string |
pdflinkextended | No | This event is triggered in addition to the “pdflink” event and contains a callback attribute that can be used to return to the widget. The attributes in the callback event are:
| Sample output of the event: |
Eingangsevents | |||
closeAlldialogs |
| This event can be emitted to the widget. The widget catches the event and then closes all dialog windows that are currently open. | Example call: |
Logic Search
Case 1 only searchterm parameter specified:
The search term is split at spaces and merged using the or operator.
Documents found contain at least one of the partial search terms.
Case 2 Parameters searchterm and manufacturerid specified:
The search term is prepared as in case 1.
The manufacturerid field serves as an additional filter. The individual IDs are linked with an or.
manufacturerid and searchterm are linked using the and operator.
Documents found contain at least one of the partial search terms and come from one of the specified suppliers.
Case 3 Parameter searchRequest specified:
Preparation of the individual search terms in searchTerms as in case 1
The prepared search terms are linked using the or operator.
The manufacturerid field serves as an additional filter. The individual IDs are linked with an or.
manufacturerid and searchterm are linked using the and operator.
The search requests in the searchRequest array are linked with an or.
Documents found that match at least one of the search requests.
Example image
Example parameters
Example integration
Embed the following code snippet into the HTML DOM.
Widget-Loader V1.x.x
Widget-Loader V2.x.x
Example event “status”
Folgendes Codebeispiel wartet auf das Rückgabevent “status” von dem Documents Widget.
Sample code (PHP)
Widget-Loader V1.x.x
Widget-Loader V2.x.x