BizBox Functions

Functions are used to get particular data you need to work with. This can typically be information about a particular product, navigation tree or latest articles.

Messages Parameter Functions

Messages are used to provide information from the system, widgets or components. This can typically be some error in case there is something wrong with a form a user tries to send, information about an order which has been successfully placed or about a products which has been inserted into the cart.

Messages are generated by the system according to a particular user’s action. All existing messages are stored in the Translation Center in the System Translations application.

All user messages are stored in the object messages. Every message has this structure:

  • text - the message text

  • type - the particular message type:

    • success - confirmation of a successful action (The password has been changed.)

    • info - Informative messages (The cart has been recalculated.)

    • warning (Please check your password strength.)

    • error (Product cannot be added into cart.)

  • widget - the internal name of a widget which generated the message

  • field - the name of an input field which is connected with the message

  • code - unique message code

  • params - optional parameters for the message (depends on the specific message)

Tip

If the product does not have a sufficient quantity in stock, a message will come with the code cart.productOutOfStock and the items of the cart will be in the parameters (params.items).

Get all messages generated from a particular widget:

messages.getByWidget('internal-name')

Instead of internal-name use the name of a particular widget which messages you want to display.

Get all messages by its type:

messages.getByType('type')

Instead of type use the type of a messages you want to display:

  • success - confirmation of a successful action (The password has been changed.)

  • info - Informative messages (The cart has been recalculated.)

  • warning (Please check your password strength.)

  • error (Product cannot be added into cart.)

Note

See the messages data structure.

Use this code for get messages for a particular widget:

{% for message in messages.getByWidget('user.login') %}
        <div>
                {{ message.field }} {{ message.text }}
        </div>
{% endfor %}

This code displays all messages for the widget user.login.

You are also able to display messages according to their type using this code:

{% for message in messages.getByType('error') %}
        <div>
                {{ message.field }} {{ message.text }}
        </div>
{% endfor %}

This code displays all error messages generated by the system. Apart from error the success, info and warning types can be used.

CMS Parameter Functions

Articles

For more information about displaying articles please see the Articles Component documentation.

Note

Articles (its content and perex) are not automatically rendered. If you want to use the advantages of Twig in it, you have to insert the article in a template using the template_from_string function.

These functions are used to access data about a particular articles.

Get data about all articles bounded to a particular page:

cms.articles.get('internal-name')

Instead of the internal-name insert the real internal name of the articles component. It returns the object article.

Get data about a particular article:

cms.articles.get('internal-name').get('article-name')

Instead of the internal-name insert the real internal name of the articles component, instead of the article-name insert the internal name of a particular article.

Get data about the latest articles:

cms.articles.get('internal-name').getLatest(3)

Instead of the internal-name insert the real internal name of the articles component. The number 3 defines how many latest articles will be available.

Get all article categories:

cms.articles.getAllCategories()

Article categories are sorted according to the order in the Categories application (Author Tools module).

Search Articles:

cms.articles.search( 'text', { limit: 15}  )

Instead of text use the search query. The number in limit defines the count of returned results. An array with items (returned items - objects) and totalCount (the number of returned objects) is returned.

Get articles by tag:

getByTag()

This method has to be used in combination with the cms.articles.get(‘internal-name’) method. The following construction returns all articles tagged with “new” for the page with internal name blog:

cms.articles.get('blog').getByTag('new')

Get tags by articles:

cms.articles.get( 'internal-name' ).getTags()

Returns all tags used for articles from the defined articles component. Instead of the internal-name insert the real internal name of the articles component.

Limit articles:

setLimit( count, beginning )

This method has to be used in combination with the cms.articles.get(‘internal-name’) method. It returns only defined number of articles defined by the total count. The beginning parameter is optional and defines how many articles will be ignored (if this parameter is not defined, no articles will be ignored). Reusing of this method will rewrite set values. Example:

cms.articles.get('blog').setLimit(5, 0)

Order of articles:

setOrder('sorting', 'direction')

This method has to be used in combination with the cms.articles.get(‘internal-name’) method. It orders particular articles according to the parameters. Reusing of this method will rewrite set values. Sorting values are:

  • sysid - article’s internal name

  • name - article’s name

  • published - published date

  • priority - article’s priority

Direction values are:

  • asc - articles will be in ascending order

  • desc - articles will be in descending order

Example:

cms.articles.get('blog').setOrder('published', 'asc')

Authors

Access data about a particular author:

cms.authors.get('e-mail')

Where the e-mail is the e-mail address connected to the author whose information you want to work with.

Data Lists

Access data about a particular data list:

cms.dataLists.get('internal-name')

Where the internal-name has to be replaced with the current internal name of a Data List you want to work with.

To display datalist items’ names, use this code:

{% for item in cms.dataLists.get('internal-name').items %}

        {{ item.name }}

{% endfor %}

Note

See the item parameters.

Display first item on the list:

cms.dataLists.get( 'internal-name' ).firstItem

The property firstItem works for all Data Lists (it is an equivalent to items|first, but it is more effective because not all records from the database are selected).

You are able to display (work with) only the records which are active (the period of publication is not set or is and the date is current).

Display a specific item from the list:

cms.dataLists.get( 'internal-name' ).get('item-internal-name')

Instead of the internal-name insert the real internal name of the datalist you want to work with. Instead if the item-internal-name insert the real internal name of a item from the list you want to work with (you must fill out the internal name of the item on the first tab).

Pages

Access a particular page:

cms.pages.get('internal-name')

Instead of the internal-name use the internal name of a page which data you want to work with.

Access a particular page by its ID:

cms.pages.getById('id')

Instead of the id use the ID of a page which data you want to work with.

Fulltext search in pages:

cms.pages.search('text',{ limit: 15})

Instead of ‘text’ should be the searched text, the number in limit defines the number of results that will be returned (the second parameter is optional). The result is an array with keys items (search result - the list of matching pages) and totalCount (search result - the count of matching pages).

Ecommerce Parameter Functions

getByProperty

The getByProperty method allows you to select entities of ecommerce directly according to the criteria you specify in the hash (the key matches the property name; values are particular property values). It can be used for following entities:

  • Brands

  • Manufacturers

  • Categories

  • Products

Supported properties: * ID * Code * Custom Properties * Product Group (available for ecommerce.products.getByProperty). Second parameters are: limit - limits the number of returned products (implicitly 10); groupVariants - turns on product grouping (implicitly on) - used for master products; onlyBuyable - returns only buyable products (implicitly on)

Examples:

ecommerce.manufacturers.getByProperty( { 'active': true, 'customProperties':{'new':true, 'main-page':true} } )
ecommerce.brands.getByProperty( { 'active': true } )
ecommerce.categories.getByProperty( { 'sysid': 'category-internal-name' } )
ecommerce.products.getByProperty( {'code':'9669/50G4', 'customProperties': { 'weight':'50' } } )

Branches

ecommerce.branches is an object with all branches from your account.

Brands

ecommerce.brands is an object with all brands from your product catalog.

To display particular brands names, use this code:

{% for brand in ecommerce.brands %}

        {{ brand.name }}

{% endfor %}

For more Brands parameters please visit related help-site.

Get data about particular brand:

ecommerce.brands.get('internal-name')

nstead of internal-name use the internal name of a particular brand you want to work with. For Brands, the getByProperty method can be used.

Get data about top sellers for particular brand:

component.brand.getTopSellers( options )
ecommerce.brands.get('internal-name').getTopSellers( options )

Available options (parameters):

  • limit - limit is used to restrict the number of returned products (the number is set to 10 as a default).

  • groupVariants - sets grouping of variants under master products, enabled by default.

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

Contains best selling products from your catalog (the total number of sold products during the last 90 days). The result can contain only buyable products; they are returned according to the product catalog component settings (for the component.category particular master product variants are counted together). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Note

For more information about products displaying please see the Product Catalog Component help-site.

Cart

Information about a Product in the Cart:

ecommerce.cart.getItemsByProductCode('product-code')

{% set cartQuantity = ecommerce.cart.getItemsByProductCode('product-code')|first.quantity %}

Instead of the product-code use the product code of a particular product. This function is used to find out, if a particular product has been already inserted into cart, together with the quantity.

This function is used to find out, if a particular product has been already inserted into cart, together with the quantity. Instead of the product-code use the product code of a particular product.

The total price of the products without applied discounts:

ecommerce.cart.items.getTotalAmountWithoutDiscounts()

Catalog Categories

Get data about a particular category:

ecommerce.categories.get('internal-name')

Instead of internal-name use the internal name of a particular category you want to work with. For categories, the getByProperty method can be used.

Get data about products in particular category:

ecommerce.categories.getProducts( options )

Available options are:

  • includeSubcategories - also returns products from subcategories, disabled by default

  • groupVariants - sets grouping of variants under master products, enabled by default

  • limit - limit to the selected number of products, default value is 10

  • offset - returns the selection from the n-th product, default value is 0

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

  • order - sorts products according to the required order, by default they are sorted by product name

Get data about top sellers in particular category:

component.category.getTopSellers( options )
ecommerce.categories.get('internal-name').getTopSellers( options )

Available options (parameters):

  • limit - limit is used to restrict the number of returned products (the number is set to 10 as a default).

  • includeSubcategories - the result also includes products that are included in the subcategories of the given category (by default it is set to FALSE).

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

Contains best selling products from your catalog (the total number of sold products during the last 90 days). The result can contain only buyable products; they are returned according to the product catalog component settings (for the component.category particular master product variants are counted together). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Comparator

Comparator is used to compare two or more products. Customers will add products to it (typically on the product detail or in the product category view) and display it (comparator is a separated page). Here should be displayed (compared) particular product information (custom properties most likely).

If a guest (anonymous user) puts products in the comparator and logs in, the products will be saved to his/her account. After logout the comparator will be cleared; After logging in, the saved products reappear.

Information about a Product in the Comparator:

ecommerce.comparator.hasProduct('product-code')

Instead of the product-code use the product code of a particular product for which you want to get the information if it is currently inserted in the comparator (true/false).

For more information about comparator please visit related help-site.

Extra Entities

ecommerce.extraEntities is an object with all extra entities from your product catalog.

To display particular manufacturers names, use this code:

{% for extraEntity in ecommerce.extraEntities %}

        {{ extraEntity.name }}

{% endfor %}

For more extra entities parameters please visit related help-site.

Get data about particular extra entity:

ecommerce.extraEntities.get('internal-name')

nstead of internal-name use the internal name of a particular extra entity you want to work with. For extra entities, the getByProperty method can be used.

Get data about top sellers for particular extra entity:

component.extraEntity.getTopSellers( options )
ecommerce.extraEntities.get('internal-name').getTopSellers( options )

Available options (parameters):

  • limit - limit is used to restrict the number of returned products (the number is set to 10 as a default).

  • groupVariants - sets grouping of variants under master products, enabled by default.

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

Contains best selling products from your catalog (the total number of sold products during the last 90 days). The result can contain only buyable products; they are returned according to the product catalog component settings (for the component.category particular master product variants are counted together). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Note

For more information about products displaying please see the Product Catalog Component help-site.

Invoice

  • invoice.orderCurrencyTaxSummaries.getForTaxRate( 20 ) – Gets the CMS model “Tax summary” - the sum of all values for a given tax rate (in the example: 20 %)

Manufacturers

ecommerce.manufacturers is an object with all manufacturers from your product catalog.

To display particular manufacturers names, use this code:

{% for manufacturer in ecommerce.manufacturers %}

        {{ manufacturer.name }}

{% endfor %}

For more manufacturer parameters please visit related help-site.

Get data about particular manufacturer:

ecommerce.manufacturers.get('internal-name')

nstead of internal-name use the internal name of a particular manufacturer you want to work with. For Manufacturers, the getByProperty method can be used.

Get data about top sellers for particular manufacturer:

component.manufacturer.getTopSellers( options )
ecommerce.manufacturers.get('internal-name').getTopSellers( options )

Available options (parameters):

  • limit - limit is used to restrict the number of returned products (the number is set to 10 as a default).

  • groupVariants - sets grouping of variants under master products, enabled by default.

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

Contains best selling products from your catalog (the total number of sold products during the last 90 days). The result can contain only buyable products; they are returned according to the product catalog component settings (for the component.category particular master product variants are counted together). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Note

For more information about products displaying please see the Product Catalog Component help-site.

Order

  • order.getPaymentUrl( <part>, <options> ) - returns the URL to the system page doPayment or redoPayment, if it is enabled for the order, otherwise returns NULL. Available parameters are:
    • part [string]: the value is overridden as a URL parameter ‘payPart’ for the doPayment / redoPayment system page. Currently only supports “advance”.

    • options [array]: if there is ‘full’: true, full URL will be generated.

    • embeded: if this parameter is filled in (anything except an empty string), the parameter “embeded = true” is passed to the payment gateway to create a payment with an iframe instead of a redirect. This parameter is currently available only for the ComGate payment gateway.

  • order.orderCurrencyTaxSummaries.getForTaxRate( 20 ) – Gets the CMS model “Tax summary” - the sum of all values for a given tax rate (in the example: 20 %)

  • order.getSPayD() - this method is used on invoices and proforma invoices. It generates the SPD (SPAYD): IBAN, amount due and currency according to the particular order. Optional parameter is an array of values, which can extend the payment parameters:

    • dueDate - the payment due date,

    • message - the message for the recipient,

    • variableSymbol - the order variable symbol.

    • format - used to set the format. Available values are cz (Czech payments), sk (Slovak payments), eu (Austria, Germany, Netherlands, Finland), hu (Hungary) pl (Poland) and none (an empty string is always returned). If this parameter is not set, the format is detected according to the billing address of the order (state). If an unsupported format is specified or the state is not supported in detection, the “none” format is always used.

    Example (invoice template):

    {% set spd = order.getSPayD({'message':'Payment of '~invoice.number}) %}
    <barcode code="{{ spd }}" type="QR" error="M" />
    

Placed Order

  • ecommerce.placedOrder.getSPayD()() - this method is used on the website for placed orders. It generates the SPD (SPAYD): IBAN, amount due and currency according to the particular order. Optional parameter is an array of values, which can extend the payment parameters:

    • dueDate - the payment due date,

    • message - the message for the recipient,

    • variableSymbol - the order variable symbol.

    • format - used to set the format. Available values are cz (Czech payments), sk (Slovak payments) and none (an empty string is always returned). If this parameter is not set, the format is detected according to the billing address of the order (state). If an unsupported format is specified or the state is not supported in detection, the “none” format is always used.

Example:

{% set spd = ecommerce.placedOrder.getSPayD( { 'message': 'Payment of '~order.orderNumber, 'variableSymbol':order.variableSymbol } ) %}
<img src="{{ qrCode( spd, { 'error': 'M', 'width': 200 } ) }}" />

Products

Products are mostly used in the Product Catalog Component. You can use these methods:

  • ecommerce.products - contains all products from the product catalog (Products).

  • ecommerce.products.countAll() - Total count of all buyable products (regardless of their stock condition). Optional parameter is groupVariants (as a default, the true option is used).

  • ecommerce.products.countAvailable() - Total count of all products (currently in stock). Optional parameter is groupVariants (as a default, the true option is used).

  • ecommerce.products.get(‘product-code’) - contains data about a particular product defined by the code (product-code). Only buyable products are returned (set the second parameter onlyBuyable to false and all active or archived products will be returned).

  • ecommerce.products.getAll() - contains all products according to selected parameters (see below).

  • ecommerce.products.getBrands() - list of all brands that are connected to products. The onlyBuyable parameter is supported (it is set to TRUE as default).

  • ecommerce.products.getById(‘productId’) - contains data about a particular product defined by the ID. Only buyable products are returned (set the second parameter onlyBuyable to false and all active or archived products will be returned).

  • ecommerce.products.getByProperty() - contains data about products according to defined properties. For more info please see the getByProperty section or available parameters below.

  • ecommerce.products.getByTag(‘tag-name’) - contains data about all products with a particular tag defined by its name (tag-name). Products are returned according to the product catalog component settings. The second groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used. Please see all available parameters below.

  • ecommerce.products.getPriceForPartnerTier(‘partner-tier-internal-name’) – source of product price for a given partner tier.

  • ecommerce.products.getNew({ ‘groupVariants’: true, ‘limit’: 24 }) - displays all new products ordered from the newest, where the optional parameter field with these keys: lastDays - limit the list of products created in the last X days (implicitly 60 days); limit - limit the list to a specified number of products (implicitly 10); groupVariants - turns on / off product variants grouping (by default, it is turned on). Please see all available parameters below.

  • ecommerce.products.getNewInStock() - the method allows you to get newly received products. Supported parameters are: lastDays - the number of days to the past when the products should be received on the stock (if not specified, the website settings Product Offerings will be used); groupVariants - explicit determination of grouping / non-grouping variants; limit - set the number of returned products. Please see all available parameters below.

  • ecommerce.products.getSimilarTo(‘product-code, { ‘onlyInCategories’: [‘category-internal-name’],’limit’: 15, ‘maxPriceDifference’: 20}’) - contains data about similar products to a product defined by a code (product-code), the limit is a number defining the count of products that will be returned.

  • ecommerce.products.getSubset() - contains products according to set filters and sorting. The field names in the filter and for sorting are the same as the filters and sorting used in the Product Catalog component. You can also use the includeSubcategories filter, which includes products that are included in the subcategory of the given category (by default it is set to FALSE). The groupVariants option is also available – turns on product grouping for variants (implicitly on).

  • ecommerce.products.getTags() - contains all tags used connected to products in the product catalog (Products).

  • ecommerce.products.getTopSellers() - contains best selling products from your catalog (the total number of sold products during the last 90 days). Products are returned according to the product catalog component settings (for the component.category). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used. Another parameter is includeSubcategories, which includes products that are included in the subcategory of the given category (by default it is set to FALSE) and onlyBuyable (returns only purchaseable products, by default according to the e-shop settings).

  • ecommerce.products.getWithScheduledDelivery( { ‘limit’:3, ‘groupVariants’:true } ) - gets products that are included in a confirmed scheduled delivery. The returned products are sorted by relevance and ID. The optional parameter is option field with supported keys limit and groupVariants. Please see all available parameters below.

  • ecommerce.products.search( ‘text’, { limit: 15} ) - product search; instead of ‘text’ should be the searched text, the number in limit defines the number of results that will be returned (the second parameter is optional). The result is an array with keys items (search result - the list of matching products) and totalCount (search result - the count of matching products). Products are returned according to the product catalog component settings. The parameter groupVariants is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

  • For products, the getByProperty method can be used.

Available Parameters

For ecommerce.products.getByProperty(), ecommerce.products.getByTag(), ecommerce.products.getNew(), ecommerce.products.getNewInStock() and ecommerce.products.getWithScheduledDelivery() methods, following parameters are available:

  • limit - limits the number of returned products (implicitly 10)

  • offset - index of the first returned element, calculated from 0

  • groupVariants- - turns on product grouping (implicitly **on*) - used for master products

  • onlyBuyable - returns only buyable products (implicitly on)

  • order - specify a product sort as a property array (eg [‘code’]) or hash, where the key is the property name and the value of the sort order (eg {‘code’: ‘desc’}. The list of supported properties is the same as sorting in the Product Catalog component.

  • onlyBuyable - restricts products by their buyability. If not used (defined), the products’ display settings are taken from the ref:E-shop Settings<app-e-shop-settings> are used instead. Set to TRUE, only buyable products are returned; set to FALSE, only non-buyable products are returned. This parameter is available for following methods: getAll(), getByProperty(), getByTag(), getNew(), getNewInStock(), getWithScheduledDelivery() and getSimilarTo().

Get information about a particular product:

ecommerce.products.get('product-code')

Instead of the product-code use the product code of a particular product which data you want to access. Only buyable products are returned (set the second parameter onlyBuyable to false and all active products will be returned).

Get information about all products connected to a particular tag:

ecommerce.products.getByTag('tag-name')

Instead of the tag-name insert the name of a particular tag. The parameter limit is used to define how many products will be returned (default value is set to 10). Returned products are sorted according to its relevance (higher relevance means higher priority).

Products are returned according to the product catalog component settings. The second groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Get information about silimar products to a product:

ecommerce.products.getSimilarTo('product-code', {'onlyInCategories':['category-internal-name'], 'limit': 20, 'maxPriceDifference': 20} )

Instead of the product-code use the product code of a particular product which similar products you want to display. The onlyInCategories parameter allows you to restrict the categories from which products will be selected (its value is an array of internal names of allowed categories). The limit is a number defining the count of products that will be returned. The maxPriceDifference is used to define the price difference range for returned products.

Similar Products Function allows you to display products that are similar for a particular product selected as an attribute of this widget (product-code). Similar products are automatically selected according to the attribute’s product category and price.

Example: If the product price is 10 EUR, limit is 5 and maxPriceDifference is 2, 5 products will be returned and their price range will be from 9-11 EUR.

Every product from your product catalog can have the relations defined. These relations allows you to assign alternative products to the main product manually. The getSimilarTo function can make your work faster and easier because you don’t need to define similar (alternative) products manually for all products in your catalog. This function will select them automatically.

Get all tags used in your product catalog:

ecommerce.products.getTags()

Get best selling products from your product catalog:

ecommerce.products.getTopSellers()

The top selling products are calculated during the last 90 days. The result is the array of objects Aggregate Product Sales; parameters are product (particular product), quantity (the total number of sold products during the last 90 days). The getTopSellers() method can be also used for a products category (only products from particular category will be returned).

Available parameters:
  • limit - limit is used to restrict the number of returned products (the number is set to 10 as a default).

  • includeSubcategories - the result also includes products that are included in the subcategories of the given category (by default it is set to FALSE).

  • onlyBuyable - returns only purchaseable products, by default according to the e-shop settings

The result can contain only buyable products; they are returned according to the product catalog component settings (for the component.category particular master product variants are counted together). If you use this method on the ecommerce.products the groupVariants parameter is available. You can use it to group particular variants together (true) or display them separated (false). As a default, the true option is used.

Search all products:

ecommerce.products.search( 'text', { limit: 15} )

Instead of ‘text’ should be the searched text, the number in limit defines the number of results that will be returned (the second parameter is optional). The result is an array with keys items (search result - the list of matching products) and totalCount (search result - the count of matching products). Products are returned according to the product catalog component settings.

Information about a Product in the Wishlist:

ecommerce.wishlist.hasProduct('product-code')

Instead of the product-code use the product code of a particular product for which you want to get the information if it is currently inserted in the wishlist (true/false).

Generate a link for the payment:

ecommerce.checkout.getOrderPaymentLink( orderId , null, { 'full': true } )

First parameter (required) should be the order ID - it is the ID of a particular order for which you want to generate the payment link. Second parameter (optional) defines the amount to pay. If the parameter is not defined (null) the whole order amount will be paid (if there exists an advance payment, only the rest will be paid). Third parameter’s value (optional) is an array. BizBox currently supports only full, which enables generating of full links (ie including the protocol and hostname).

This is mostly used in the user profile in the order list/order detail/e-mails. It allows the customer to connect with the selected online payment gateway and make the payment.

Get information about particular product variants:

getProductVariantsByCustomProperty()

This can be used only for master products. Method is available for every product (object). This method is used to get particular variants of this product according to defined custom properties values.

Example: getProductVariantsByCustomProperty( { ‘color’: [ ‘black’, ‘red’ ], ‘size’: [‘large’] } ) - this example will filter all variants in black or red color in the ‘large’ size.

Get All Product Ratings from Heureka:

ecommerce.products.getExternalRatings().heurekaCz

For more info see the Order Rating section in the E-shop Settings. Information about the External Product Rating object are available in the Data Structures section.

Get Particular Product Ratings from Heureka:

ecommerce.products.get('9316').externalRatings.heurekaCz

Instead of the productCode insert a real code of a product for which you want to display the rating.

For more info see the Order Rating section in the E-shop Settings. Information about the External Product Rating object are available in the Data Structures section.

Custom Properties Filtering:

component.productList.getCustomPropertyForFilter()

The parameter is the internal name of a custom property for which the filter is created. This method is available in the product list od the product catalog component.

Prices

Free Delivery Limit function returns the free delivery limit (minimal order amount) for the current zone and currency.

The delivery limit is calculated according to delivery prices in pricelists (its minimal order amounts). The lowest minimal order amount from valid delivery methods is returned. Valid method are without personal pickups and pickup points as default:

ecommerce.prices.getFreeDeliveryMethod()

Optional parameters are:

  • personalPickup - adds personal pickup to the free delivery calculation (turned off by default).

  • pickup - adds pickup points to the free delivery calculation (turned off by default).

Purchase Prices

Obtaining the purchase price of the product. The data source product.inventory.purchasePriceSource can be used in the template.

  • product.inventory.purchasePriceSource.getPriceForCurrency( string currencyIso )

  • product.getPurchasePriceForCurrency( string currencyIso )

  • receiptItem.getPurchasePriceForCurrency( string currencyIso )

The data source order for product.inventory.purchasePriceSource:

  • Receipt item that will be issued first - has a batch with the oldest expiration date or has the oldest receipt by date.

  • Receipt item that was last picked - the latest receipt by date.

  • The product itself (the value set directly on the product on the General tab).

  • Product’s master product (the value set directly on the product on the General tab).

Wishlist

Wishlist is used by your customers to mark their favorite products.

Wishlist of a logged user is used as a priority. If the wishlist is empty, favorite products will be copied from the guest (anonymous) user after he/she loggs in.

Information about a Product in the Wishlist:

ecommerce.wishlist.hasProduct('product-code')

Instead of the product-code use the product code of a particular product for which you want to get the information if it is currently inserted in the wishlist (true/false).

For more information about wishlist please visit related help-site.

Ecommerce Voucher

Following 3 methods are used to determine if a voucher sale is applied on a particular product.

  • isDiscountedProduct(‘product-code’) - use for product defined as the product itself

  • isDiscountedProductInProducts(‘product-code’) - used for products defined as a part of a product category

  • isDiscountedProductInCategories(‘product-code’) - used for products defined as a part of a price category

Instead of the product-code use the product code of a particular product for which you want to get the information.

Example of Usage:

{% for orderDiscount in order.discounts if order.discount.voucher != null %}
        {% for item in invoice.allItems if item.type == 'product' %}
                {{dump(orderDiscount.voucher.isDiscountedProduct(item.code))}}
        {% endfor %}
{% endfor %}

Subscriptions

This function is awailable for accounts with the :ref:’Order Subscription Addon<lab-order-subscription-addon>’ enabled only.

Generate a link to restart a subscription:

ecommerce.checkout.getSubscriptionRestartLink( orderId, options )

orderID is the ID of the subscription order on which the payment failed (ie the one from which to restart); options is an array od options. If it contains TRUE under the full key, it will generate a link including hostname.

Restart of subscription means: * cancellation of the original subscription, * removing a subscription from the order queue to be paid again, * a copy of the order with a subscription, with the preservation od all data.

Before restart, it is verified that the placed order is in the payment failed state.

CRM Parameter Functions

Newsletter Info and Unsubscribe

Get detailed information about a newsletter:

crm.newsletters.get('internal/name')

Instead of internal-name provide the Internal name of a particular newsletter you want to work with.

It is then possible to call the getUnsubscribeLink (<e-mail>) method above the newsletter object, which will generate the link needed to unsubscribe from the newsletter for the specified mail. The landing page is determined using the special “Newsletter Unsubscribe Confirmation” page.

Parameters are inserted into the link

  • “newsletter” - the value is the newsletter sysid

  • “email” - the value is unsubscribed e-mail

  • “token” - the value is the authentication token

Example:

crm.newsletters.get('newsletter').getUnsubscribeLink('support@bizboxlive.com')

The code above generates a link to unsubscribe the email “support@bizboxlive.com” from the newsletter with the internal name “newsletter”.

Supplier Order Detail

Get detailed information about a supplier order:

crm.supplier.orders.getDetail('orderID')

Instead of orderID provide the ID of a particular order you want to work with.

To work with data about suppliers (supplier portal), use these data sources:

  • crm.supplier contains base information about logged in supplier (the user account has to be connected with a supplier)

  • crm.supplier.orders contains all orders that ale connected to the logged supplier (user)

Note

There is the supplier.order.setDispatch widget which allows your suppliers to change a particular order state directly in their supplier portal.

For a supplier order (get by the :ref:supplier order detail function`<lab-supplier-order-detail>` or crm.supplier.orders.items parameter) is available the supplierDispatchState parameter which carries the lowest dispatch state that is available on a product from the order.

For a single product from a particular order are available parameters used to download images if there are some available:

* *products[0].isDownloadable* - boolean; defines if there exist some downloadable image.
* *products[0].imageDownloadLink* - link for image download (if there is a downloadable image for the product.
* *products[0].collectionDownloadLinks* - link for download of a ZIP image. It is used in case there are more images available for the product. The value is an array that contains link for particular ZIP archive download (one archive can contain 50 images).

Partner Manager

Access a detail of a particular manager:

crm.partner.managers.getDetail('managerId')

Instead of the ‘managerId’ use the ID of a particular manager you want to work with.

User Parameter Functions

Order Detail

Get detailed information about a user order:

user.orders.getDetail('orderID')

Instead of orderID use the ID of a particular order you want to work with.

user.orders.getById( orderId )

Returns the CMS model of the order. Instead of orderID use the ID of a particular order you want to work with.

Company Orders

Get information about company orders:

user.profile.company.orders.getById('')
user.profile.company.orders.getSubset('')

It is possible to iterate directly above the source, so there is no need to access objects or items. The object also directly returns the number of orders.

Order Claims

Get information about all claims connected to an order:

user.claims.getByOrder('orderID')

Instead of orderID provide the ID of a particular order you want to work with.

Claim Detail

Get detailed information about a user’s claim:

user.claims.getDetail('claimID')

Instead of claimID provide the ID of a particular claim you want to work with.

Claim Attachments

Get information about claim attachments:

user.claims.getDetail('claimID').getAttachments()

Instead of claimID provide the ID of a particular claim you want to work with.

Claim Notes

Get (visible) notes connected to a claim:

user.claims.getDetail('claimID').getNotes()

Instead of claimID provide the ID of a particular claim you want to work with.

Comment Votes

Defines if the user can make a vote for a comment:

user.canVoteForComment('commentID')

Instead of commentID provide the ID of a comment for which you want to know if the user can make a vote.

Shopping Lists

Obtains information about a specific shopping list:

user.shoppingLists.getById('shoppingListID')

You can get a list of products from the list by calling the getProducts() method for the shopping list object. All products are always returned regardless of whether they can be purchased; only active products are included.

An optional parameters are the options that affect the returned products:

  • limit - limitation of returned products (default 10).

  • offset - skips the specified number of products.

  • order - specifies product sorting (same as for other product lists).

Person Parameter Functions

These functions are used in the Contact Export template, where the contacts object is available. It unites all contacts selected in the Contact application for export.

Addresses

  • contact.shipping - array of all shipping addresses connected to the contact

  • contact.billing - array of all shipping addresses connected to the contact

Use getDefault to get the default address. If there is no default address set, the first address will be returned.

Examples:

    {%- set defaultShipping = contact.addresses.shipping.getDefault() -%}
{%- for address in contact.addresses.shipping -%}
    {{dump(address)}}
{%- endfor -%}

{%- set defaultBilling = contact.addresses.shipping.getDefault() -%}
{%- for address in contact.addresses.billing -%}
    {{dump(address)}}
{%- endfor -%}

Note

For non-registered users the first existing address will be returned.

Channels

  • contact.channels.icq

  • contact.channels.email

  • contact.channels.phone

  • contact.channels.jabber

  • contact.channels.skype

Use getDefault to get the default channel. If there is no default channel set, the first channel will be retured.

Examples:

    {%- set defaultIcq = contact.channels.icq.getDefault() -%}
{%- for channel in contact.channels.icq -%}
    {{dump(channel)}}
{%- endfor -%}

    {%- set defaultEmail = contact.channels.email.getDefault() -%}
{%- for channel in contact.channels.email -%}
    {{dump(channel)}}
{%- endfor -%}

    {%- set defaultPhone = contact.channels.phone.getDefault() -%}
{%- for channel in contact.channels.phone -%}
    {{dump(channel)}}
{%- endfor -%}

    {%- set defaultJabber = contact.channels.jabber.getDefault() -%}
{%- for channel in contact.channels.jabber -%}
    {{dump(channel)}}
{%- endfor -%}

    {%- set defaultSkype = contact.channels.skype.getDefault() -%}
{%- for channel in contact.channels.skype -%}
    {{dump(channel)}}
{%- endfor -%}

Request Parameter Functions

Currency Switcher

Generate a link used to change the currency:

request.url.getCurrencySetLink( ISO )

Instead of the ISO use the ISO of the currency to which you want to switch the website.

Example:

{% for currency in ecommerce.zoneCurrencies %}
        {% set link = request.url.getCurrencySetLink( currency.iso ) %}
        {% if currency.id == request.currency.id %}
        <option selected="selected" value="{{ link }}" id="{{ currency.id }}">{{ currency.iso }}</option>
    {% else %}
        <option value="{{ link }}" id="{{ currency.id }}">{{ currency.iso }}</option>
    {% endif %}
{% endfor %}

Album Functions

Enums

Enums is an object which unites various enumerations you can use on your website.

See particular parameters.

addressTypes

enums.addressTypes contains the enumeration of available address types. You can allow your customers to define different billing or shipping addresses. If an address can be used for both, the common type should be used. You can use these data in the checkout (a customer can select address according to its purpose) and customer’s profile (a customer can define various addresses).

Access data about user addresses:

user.profile.addresses.getbyType('address-type')

Instead of the address-type insert the real internal name of the address type (common, billing or shipping). It returns all addresses of the selected type.

For more information about user addresses please visit related help-site.

See particular parameters.