Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The easiest way to see what is a widget and how to include it in a page.


Introduction

This document presents the widget system of SecutixThe widget are small chunk of SecuTix that you can include in any website. Linked to an internet point of sales inside SecuTix, it allows to present products, section or catalog in an adaptive way.

Basic concepts

Each widget consist in a small The widgets are chunk of web application that can be included in a web container, a HTML tag.

To show a widget on a website, the following step are necessary:

  1. Include the widget library
  2. Create HTML containers with explicit ids
  3. Get all the information needed for the widget
  4. Create a widget instance through the library

code that generates visualization into a website.  The website developer should define a container where the widget should take place and call the generation of the widget.

Include the widget library

The widget library only contains a loader that will automatically load the widget definition when needed. You only have to include the following script inclusion to get theaccess to all widgets.

Code Block
languagexml
themeEclipse
titleInclude script
<script type="text/javascript" src="https://s3.eu-central-1.amazonaws.com/pub.tnwi.int1-s3.secutix.com/stx-widgets/Widgets.js"></scriptscript>

This Widget file generate the STX global object that contains the widget library. The library contains only the library loading system. The needed script will be loaded automatically following the widgets declaration, taking only the needed widgets.

...

Code Block
themeEclipse
titleExemple de code
<script type="text/javascript">
	STX.Widgets.start({ 
		// The hostname defined in the point of sales
		hostname: 'thecube-special-cube.int2-shop.secutix.com', 
		apiKey: '8bafa660-8bc1-4982-83da-f15fce01f4ec',
		widgets: [{
			widget: 'Product',			// the name of the widget
			root: '#product_1',			// the id of html tag above
			productId: '4654654',		// the id of the product
			occurrenceId: '87846578',	// the id of performance / match / slot
			showActions: true,			// parameters to show the actions
			aspectRatio: 'VERTICAL'		// how to display the picture
		},{
			widget: 'Product',
			root: '#product_2',
			productId: '465488',
			occurrenceId: '1129848',
			showDescription: true,
			showImage: false
		},{
			widget: 'Catalog',
			root: '#catalog_1'
		}]
	});

</script>

The parameters depends on the widget shown. You can refer to the widget documentation.

Each time you call the STX.Widgets.start(), you create a new group of widgets. The widgets inside a group must be of the same host