Skillnad mellan versioner av "Templating:Variables"
(→Functions) |
(→Filters) |
||
| Rad 5 619: | Rad 5 619: | ||
==Filters== | ==Filters== | ||
| + | |||
| + | ===bool=== | ||
| + | Casts value to boolean, if value is a scalar (i.e. string, int, float or bool). Otherwise returns null. | ||
| + | 1|bool | ||
| + | |||
| + | ===bool_filter=== | ||
| + | Casts value to boolean in an intelligent (but non-standard) way. See below for details: | ||
| + | |||
| + | * Returns true for "1", "true", "on" and "yes". | ||
| + | * Returns false for "0", "false", "off", "no", and "". | ||
| + | * Returns null for all non-boolean values. | ||
| + | |||
| + | "false"|bool | ||
| + | |||
===chain(array)=== | ===chain(array)=== | ||
Chain two iterable values. | Chain two iterable values. | ||
| Rad 5 633: | Rad 5 647: | ||
Calculates raw number with store currency. | Calculates raw number with store currency. | ||
float|currency_calculate | float|currency_calculate | ||
| + | |||
| + | ===float=== | ||
| + | Casts value to float, if value is numeric (using php's is_numeric function). Otherwise returns null. | ||
| + | "123,456"|float | ||
===image_button_url=== | ===image_button_url=== | ||
Looks up an image button image for the current language. | Looks up an image button image for the current language. | ||
"filename.jpg"|image_button_url | "filename.jpg"|image_button_url | ||
| + | |||
| + | ===int=== | ||
| + | Casts value to integer, if value is either numeric (using php's is_numeric function) or a boolean. Otherwise returns null. | ||
| + | "123"|int | ||
| + | |||
===link(query_string)=== | ===link(query_string)=== | ||
Create a link. | Create a link. | ||
| Rad 5 649: | Rad 5 672: | ||
{% for object in array_of_objects|sort_by_property('name', 'DESC') %} | {% for object in array_of_objects|sort_by_property('name', 'DESC') %} | ||
| + | |||
| + | ===string=== | ||
| + | Casts value to string, if value is a scalar (i.e. string, int, float or bool) or if value is an object that can be stringified (has a __toString method). Otherwise returns null. | ||
| + | 123|string | ||
===strip=== | ===strip=== | ||
| Rad 5 666: | Rad 5 693: | ||
Truncate string to given limit and append string after stripping HTML and expanding HTML entities. | Truncate string to given limit and append string after stripping HTML and expanding HTML entities. | ||
string|truncate(limit[, append = "..."]) | string|truncate(limit[, append = "..."]) | ||
| + | |||
| + | ===type=== | ||
| + | Returns the type of the value/variable (uses php's function gettype). | ||
| + | "text"|type | ||
===unique(array)=== | ===unique(array)=== | ||
Versionen från 21 september 2021 kl. 10.28
See also Templating:Emails.
Innehåll
- 1 Variables
- 1.1 Types
- 1.2 Globals
- 1.3 Boxes
- 1.3.1 Category menu
- 1.3.2 Category full menu
- 1.3.3 Best selling products
- 1.3.4 Manufacturer select
- 1.3.5 Country selection
- 1.3.6 Market selection
- 1.3.7 Search box
- 1.3.8 Information page list
- 1.3.9 Language list
- 1.3.10 Login box
- 1.3.11 New products list
- 1.3.12 News list
- 1.3.13 Hierarchical news list
- 1.3.14 Review
- 1.3.15 Shopping cart
- 1.3.16 Random special offer
- 1.3.17 VAT select box
- 1.3.18 Custom boxes
- 1.4 Modules
- 1.5 Page specific
- 1.5.1 Account edit page (account_edit.html)
- 1.5.2 Account history page (account_history.html)
- 1.5.3 Order info page (account_history_info.html)
- 1.5.4 Account page (account.html)
- 1.5.5 Account newsletter subscription page (account_newsletters.html)
- 1.5.6 Account notifications page (account_notifications.html)
- 1.5.7 Change account password page (account_password.html)
- 1.5.8 Address book page (address_book.html)
- 1.5.9 Address book modification page (address_book_process.html)
- 1.5.10 Advanced search page (advanced_search.html)
- 1.5.11 Search results page (advanced_search_result.html)
- 1.5.12 Campaign page (campaign.html)
- 1.5.13 Product list (categories_listing.html)
- 1.5.14 Checkout success (checkout_success.html)
- 1.5.15 Contact us page (contact.html)
- 1.5.16 Cookie usage page (cookie_usage.html)
- 1.5.17 Gallery pages (gallery.html, galleries/)
- 1.5.18 Index page (index.html)
- 1.5.19 Kolli page (kolli.html)
- 1.5.20 Login page (create_account.html, login.html, password_forgotten.html)
- 1.5.21 Log off page (logoff.html)
- 1.5.22 Manufacturers page (manufacturers.html)
- 1.5.23 News archive page (news_archive.html)
- 1.5.24 News article page (news.html)
- 1.5.25 Newsletter page (newsletter.html)
- 1.5.26 Product page (product.html)
- 1.5.27 Product added to shopping cart page (product_added.html)
- 1.5.28 New products page (products_new.html)
- 1.5.29 Product reviews page (product_reviews.html)
- 1.5.30 Review page (product_reviews_info.html)
- 1.5.31 Write review page (product_reviews_write.html)
- 1.5.32 Question about product page (question_about_product.html)
- 1.5.33 Product reviews page (reviews.html)
- 1.5.34 Shopping cart page (shopping_cart.html)
- 1.5.35 Specials page (specials.html)
- 1.5.36 Tell a friend page (tell_a_friend.html)
- 2 Extensions
- 2.1 Functions
- 2.1.1 build(string, array, array)
- 2.1.2 check_customer_exists(value, field)
- 2.1.3 file_exists(file)
- 2.1.4 product_has_associated_products(products_id [, associations_type = 0])
- 2.1.5 get_associated_products(products_id [, associations_type = 0 [, order_by = 'association_priority' [, replace_variants = false]]])
- 2.1.6 get_associated_product_types()
- 2.1.7 get_categories(products_id)
- 2.1.8 get_category_tree(categories_id, [options])
- 2.1.9 get_coupon_codes_by_category(category_input)
- 2.1.10 get_coupon_codes_by_manufacturer(manufacturer_input)
- 2.1.11 get_customer_address_book()
- 2.1.12 get_customer_country_by_ip()
- 2.1.13 get_customer_logins()
- 2.1.14 get_customer_order(order_id)
- 2.1.15 get_customer_orders()
- 2.1.16 get_customer_subscription_info()
- 2.1.17 get_delivery_status()
- 2.1.18 get_discounts()
- 2.1.19 get_discounted_product_discount(product_id, [customers_group_id])
- 2.1.20 get_information_page_tree(page_id, [options])
- 2.1.21 get_manufacturer(manufacturers_id)
- 2.1.22 get_manufacturer_category_tree(manufacturer_id)
- 2.1.23 get_markets_for_countries([countries_id])
- 2.1.24 get_unit(unit_id)
- 2.1.25 get_page_content_block_history([filterByLanguageId = 0 [, groupByDate = true [, pageId = 0]]])
- 2.1.26 get_partners([options])
- 2.1.27 get_partners_stock(product_id)
- 2.1.28 get_product(search, mode, [options])
- 2.1.29 get_product_attributes(product_id)
- 2.1.30 get_product_files(product_id)
- 2.1.31 get_product_units(product_id, [load_unit])
- 2.1.32 get_product_customer_group_prices(product_id)
- 2.1.33 get_product_variants(id)
- 2.1.34 get_products(limit, [search], order_by, mode, [options])
- 2.1.35 get_specification_values_by_id(specification_id)
- 2.1.36 get_specifications(product_id)
- 2.1.37 get_store_design_button_class
- 2.1.38 get_tag_tree(tag_id)
- 2.1.39 get_package_per_unique_product_details(product_id)
- 2.1.40 get_product_with_package_info(product_id)
- 2.1.41 langimg(image, width, height)
- 2.1.42 langstr(name)
- 2.1.43 search_information_pages(keywords, [options])
- 2.2 Plugins
- 2.3 Filters
- 2.3.1 bool
- 2.3.2 bool_filter
- 2.3.3 chain(array)
- 2.3.4 choose(number)
- 2.3.5 currency_format
- 2.3.6 currency_calculate
- 2.3.7 float
- 2.3.8 image_button_url
- 2.3.9 int
- 2.3.10 link(query_string)
- 2.3.11 query_string
- 2.3.12 sort_by_property(sort_key [, sort_order = 'ASC'])
- 2.3.13 string
- 2.3.14 strip
- 2.3.15 strip_tags(allowed_tags)
- 2.3.16 thumbnail(width, height)
- 2.3.17 truncate(limit, append)
- 2.3.18 truncate_html(limit, append)
- 2.3.19 type
- 2.3.20 unique(array)
- 2.1 Functions
Variables
Templates get variables containing all necessary data passed from the back end. This is a complete reference of all available variables.
Types
string
URL
HTML
The raw filter should be applied when displaying these variables.
integer
decimal
boolean
list
dictionary
manufacturer
| Key | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| id | integer | ||||||||||
| name | string | ||||||||||
| image | URL | ||||||||||
| address | string | ||||||||||
| postcode | string | ||||||||||
| postal_address | string | ||||||||||
| visitational_address | string | ||||||||||
| country | string | ||||||||||
| telephone1 | string | ||||||||||
| telephone2 | string | ||||||||||
| fax | string | ||||||||||
| email_address | string | ||||||||||
| orgno | string | ||||||||||
| vat | string | ||||||||||
| note | string | ||||||||||
| postgiro | string | ||||||||||
| plusgiro | string | ||||||||||
| bankgiro | string | ||||||||||
| contact | string | ||||||||||
| payment_conditions | string | ||||||||||
| customers_no | string | ||||||||||
| video_1 | string | ||||||||||
| video_2 | string | ||||||||||
| extra1 | string | ||||||||||
| extra2 | string | ||||||||||
| extra3 | string | ||||||||||
| href | URL | ||||||||||
| url | URL | ||||||||||
| description | string | ||||||||||
| meta_title | string | ||||||||||
| meta_keywords | string | ||||||||||
| meta_description | string | ||||||||||
| extra4 | string | ||||||||||
| extra5 | string | ||||||||||
| images | list of URLs | ||||||||||
| pdfs | list |
|
pagination
| Key | Type | Description |
|---|---|---|
| page | integer | The current page. |
| prev | integer | The previous page. |
| next | integer | The next page. |
| pages | list of integers | The pages in the current set. |
| set_prev | integer | The last page in the previous set of pages. |
| set_next | integer | The first page in the next set of pages. |
| from_row | integer | The first row displayed. |
| to_row | integer | The last row displayed. |
| row_count | integer | The number of rows paginated. |
product
| Key | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | string | Products internal ID | ||||||||||||
| delivery_time | string | |||||||||||||
| description | HTML | |||||||||||||
| description_short | HTML | |||||||||||||
| href_buy | URL | |||||||||||||
| href | URL | |||||||||||||
| image | URL | |||||||||||||
| images | dictionary | Additional product images.
| ||||||||||||
| is_package | boolean | True when the product has packaged products. | ||||||||||||
| has_attributes | boolean | True when the product has any attributes. | ||||||||||||
| manufacturer_image | URL | |||||||||||||
| manufacturer_name | string | |||||||||||||
| model | string | |||||||||||||
| name | string | |||||||||||||
| price_discount_percentage | HTML | |||||||||||||
| price | HTML | |||||||||||||
| price_raw | HTML | |||||||||||||
| price_recommended | HTML | |||||||||||||
| price_recommended_raw | HTML | |||||||||||||
| price_special | HTML | |||||||||||||
| price_special_raw | HTML | |||||||||||||
| price_special_expires | date | |||||||||||||
| quantity | integer | |||||||||||||
| replacement_product | string | |||||||||||||
| seo_link | string | |||||||||||||
| tax | decimal | Product tax rate. | ||||||||||||
| tax_class_id | integer | |||||||||||||
| type | string | |||||||||||||
| parent_id | integer | The products parent | ||||||||||||
| child_count | integer | Counts amount of child products | ||||||||||||
| rating | decimal | Average review rating in increments of 0.5. | ||||||||||||
| price_per_unit | decimal | Product price per unit | ||||||||||||
| unit | string | Product unit. ex. st/cm/m | ||||||||||||
| price_per_unit_recommended | decimal | Recommended price in unit | ||||||||||||
| price_per_unit_special | decimal | Special price in unit | ||||||||||||
| price_klarna_account | decimal | Klarna account price | ||||||||||||
| tags | list of tags | |||||||||||||
| extra1 | HTML | Custom product field. | ||||||||||||
| extra2 | HTML | Custom product field. | ||||||||||||
| extra3 | HTML | Custom product field. | ||||||||||||
| extra4 | HTML | Custom product field. | ||||||||||||
| extra5 | HTML | Custom product field. | ||||||||||||
| weight | string | Product weight. |
tag
| Key | Type | Description |
|---|---|---|
| id | integer | ID. |
| parent_id | integer | Parent ID, 0 when there is no parent tag. |
| name | string | Name. |
| description | HTML | Description. |
| image | URL | Image URL. |
| meta_title | HTML | Meta title. |
| meta_keywords | HTML | Meta keywords. |
| meta_description | HTML | Meta description. |
| children | list of tags | Child tags. |
| used | boolean | Indicates if the tag is used by any product in a category listing. |
| color | string | Tag color (HEX). |
custom field
| Key | Type | Description |
|---|---|---|
| fields_id | integer | ID. |
| require_in_checkout | boolean | Is the field required in the checkout? |
| type | string | What was entered in the administration. |
| name | string | Field label. |
| value | string | Entered value (not always available). |
discount
| Key | Type | Description |
|---|---|---|
| id | integer | The unique ID generated for the discount. |
| name | string | The name selected for the discount. |
Depending on the type field, there are additional fields:
| Key | Type | Description |
|---|---|---|
| type | string | "bogo", for buy one get one free discounts. |
| required | integer | If at least required products are in the shopping cart, |
| free | integer | free of the products will have their prices set to 0 when added to the shopping cart. |
| products | list of products | Products which count for this discount. |
| manufacturers | list of manufacturers | Manufacturers for which products count for this discount. |
| categories | list of categories | Categories for which products count for this discount. |
| cart_matches | integer | Total count of products in the shopping cart that matches the products, manufacturers, or categories. |
| current_matches | integer | Set to 1 on the product page if the current product matches one of the products, manufacturers, or categories; otherwise 0. |
| Key | Type | Description |
|---|---|---|
| type | string | "total", for discounts based on the total cost of the shopping cart. |
| product | product | The product to which this discount is applied. |
| price | decimal | The new price for the selected product. |
| total_required | decimal | The required cost of the shopping cart, not including tax. |
| total_current | decimal | The current cost of the shopping cart, not including tax. |
| current_matches | integer | Set to 1 on the product page for the selected product, otherwise 0. |
partner
| Key | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| partners_id | integer | ID. | ||||||||||||
| company_name | string | Official company name. | ||||||||||||
| working_title | string | Used name. | ||||||||||||
| cin | string | Registered company number. | ||||||||||||
| address | string | Address. | ||||||||||||
| zip | string | Zip code. | ||||||||||||
| city | string | City. | ||||||||||||
| countries_id | integer | Country ID. | ||||||||||||
| phone | string | Phone number. | ||||||||||||
| fax | string | Fax number. | ||||||||||||
| string | Email address. | |||||||||||||
| comments | string | Internal comments. | ||||||||||||
| status | boolean | Enabled or disabled. | ||||||||||||
| pickup | boolean | Pickup of products. | ||||||||||||
| reseller | boolean | Is a reseller. | ||||||||||||
| display | boolean | Is displayed. | ||||||||||||
| preferred | boolean | The distance in distance calculations will be decreased by a configurable amount, see Inställningar - Leverans/Packning. | ||||||||||||
| description | string | Description. | ||||||||||||
| contacts | list of dictionaries |
| ||||||||||||
| images | list of strings | Images. | ||||||||||||
| open_hours | dictionary of days to dictionaries |
|
date
| Method | Type | Description |
|---|---|---|
| (treat object as string) | string | A string representation of the date, most of the time this is date_long(), otherwise date_short(). |
| timestamp() | integer | Returns the timestamp represented by this date. |
| date_short() | string | A string representation of the date, formatted using the language string DATE_FORMAT. |
| date_long() | string | A string representation of the date, formatted using the language string DATE_FORMAT_LONG. |
Globals
Globals are accessible anywhere in the templates, including macros.
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| template | string | Path to active template directory | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_page | string | Contains URL after domain name and before ?, for example storedomain.com/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html?vat_disp=0 returns /p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_script | string | Contains filename of current page | index.php | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| request | dictionary | A dictionary of recieved GET and POST data |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_customer_id | integer | Returns customer ID if customer is logged in, else None | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| customer | dictionary | Contains information about the logged in customer, or null. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_agent | string | The client's user agent string. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta | dictionary | Header meta information for current page. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| session | dictionary | Configurable session variables. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings | dictionary | Contains some of the settings defined in the administration |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shoppingcart_amount | string | Amount of products in shopping cart | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shoppingcart_total | string | Total sum of the content in shopping cart | N/A |
Boxes
Boxes are variables used for the side boxes. They are all prefixed with boxes.
Category menu
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.categories.tree | list of dictionaries | Contains a tree of displayed categories in menu |
|
Category full menu
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.categories_full.tree | list of dictionaries | Contains a full tree of all available categories in menu |
|
Best selling products
Lists the most sold products.
| Variable name | Type | Description |
|---|---|---|
| boxes.bestsellers.list | list of product | The most sold products, the most sold first. |
Manufacturer select
| Variable name | Type | Description | Format | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.manufacturers.list | list of dictionaries | Lists all available manufacturers |
|
Country selection
| Variable name | Type | Description | Format | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.countries.list | list of dictionaries | Lists all available countries |
|
Market selection
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.markets.list | list of dictionaries | Lists all available markets |
|
Search box
| Variable name | Type | Description | Format |
|---|---|---|---|
| boxes.search.advanced_href | string | URL to advanced search page | N/A |
| boxes.search.advanced_result_href | string | Action URL for search form | N/A |
Information page list
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.information_pages.list | list of dictionaries | Lists all active information pages |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| boxes.information_pages.tree | dictionaries | A tree of *all* information pages. |
This field consists of an entry with the same format as the entries in the information page list, with the addition of two fields:
|
Language list
| Variable name | Type | Description | Format | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.languages.list | list of dictionaries | Lists all languages |
|
Login box
| Variable name | Type | Description | Format |
|---|---|---|---|
| boxes.login.form_href | string | Action link for login form | N/A |
| boxes.login.password_forgotten_href | string | Link to retrieve forgotten password page | N/A |
| boxes.login.account_history_href | string | Link to current customer's account history page. Contains orders and such | N/A |
| boxes.login.account_href | string | Link to current customer's account page | N/A |
| boxes.login.account_password_href | string | Unknown | N/A |
| boxes.login.logoff_href | string | Link to log off current customer | N/A |
| boxes.login.customer_first_name | string | Current customer's first name | N/A |
| boxes.login.customer_last_name | string | Current customer's last name | N/A |
New products list
Lists the most recently added products.
| Variable name | Type | Description |
|---|---|---|
| boxes.products_new.list | list of product | The most recently added products, the most recent first. |
News list
| Variable name | Type | Description | Format | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.news.list | list of dictionaries | Lists recent news. Limit set in administration |
|
Hierarchical news list
| Variable name | Type | Description | Format | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.news_archive.year_min | integer | Year with first news post. | N/A | ||||||||||||||||||
| boxes.news_archive.year_max | integer | Year with last news post. | N/A | ||||||||||||||||||
| boxes.news_archive.month_min | integer | Month of first news post. | N/A | ||||||||||||||||||
| boxes.news_archive.month_max | integer | Month of last news post. | N/A | ||||||||||||||||||
| boxes.news_archive.news | list of dictionaries | News grouped first by year and then by month, the final array keys have this format: |
|
Review
| Variable name | Type | Description | Format | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.reviews.write_review_href | string | Link to write review page. Only set if customer is viewing a product page | N/A | ||||||||||||||||||
| boxes.reviews.product | dictionary | Product and review data |
|
Shopping cart
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.shopping_cart.list | list of dictionaries | List of products in shopping cart |
| ||||||||||||||||||||||||||||||||||||||||||||||||
| boxes.shopping_cart.total | string | Total value of contents of shopping cart represented as a string with currency symbol | N/A | ||||||||||||||||||||||||||||||||||||||||||||||||
| boxes.shopping_cart.total_items | integer | Sum of product quantities. | N/A |
Random special offer
Contains a random special offer.
| Variable name | Type | Description | Format | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.special_offers.product | dictionary | True if prices are displayed including VAT, else false. |
|
VAT select box
| Variable name | Type | Description | Format |
|---|---|---|---|
| boxes.vat_select.display_with_vat | boolean | True if prices are displayed including VAT, else false. | N/A |
| boxes.vat_select.with_href | string | URL to page where VAT display is set to true. | N/A |
| boxes.vat_select.without_href | string | URL to page where VAT display is set to false. | N/A |
Custom boxes
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| boxes.custom.boxes | dictionary of lists | Dictionary of boxes, indexed by the box name. |
If type is 0:
If type is 1:
If type is 2:
|
Modules
last_viewed_products
| Variable name | Type | Description |
|---|---|---|
| modules.last_viewed_products.register | HTML | Contains either the empty string, or a script element with code for updating the cookie containing the list of the last viewed products. Should be included on product pages. |
| modules.last_viewed_products.products | list of products | The products the customer last viewed, the most recently viewed product first, the current product is excluded. Contains up to 30 products. |
product_parent
| Variable name | Type | Description | Format |
|---|---|---|---|
| modules.product_parent.name | string | Parent product name. | N/A |
| modules.product_parent.description | string | Parent product description. | N/A |
| modules.product_parent.image | string | Parent product image. | N/A |
| modules.product_parent.images | string | Parent product additional images. | N/A |
associated_products.html
| Variable name | Type | Description | Format |
|---|---|---|---|
| modules.associated_products.products | list of products | Associated products. | N/A |
random_products.html
| Variable name | Type | Description | Format |
|---|---|---|---|
| modules.random_products.products | list of products | Random products. | N/A |
product_attributes.html
| Variable name | Type | Description | Format | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| modules.product_attributes.attributes | list of dictionaries | Product attributes. |
|
product_specifications.html
| Variable name | Type | Description | Format | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| modules.product_specifications.grouped | list of categories | Specifications with multiple values per specification grouped into a values variable. | ||||||||||
| modules.product_specifications.hierarchy | list of categories | The hierarchy of specifications used for this product. | ||||||||||
| modules.product_specifications.specifications | list of dictionaries | Product specifications. |
|
products_in_package.html
| Variable name | Type | Description | Format |
|---|---|---|---|
| modules.products_in_package.products | list of products | Products in product package. | N/A |
products_reviews.html
| Variable name | Type | Description | Format | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| modules.products_reviews.captcha_href | URL | Link to the captcha image. | N/A | |||||||||||||||
| modules.products_reviews.error | string | Error message. | N/A | |||||||||||||||
| modules.products_reviews.customer | dictionary | Customer information. |
| |||||||||||||||
| modules.products_reviews.reviews | list of dictionaries | Product reviews. |
|
products_variants.html
| Variable name | Type | Description | Format | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| modules.products_variants.category | integer | Category index. | N/A | ||||||||||||
| modules.products_variants.variants | list of dictionaries | Variants. |
| ||||||||||||
| modules.products_variants.products | list of products | Variant products. | N/A | ||||||||||||
| modules.products_variants.combinations | list of lists of integers | Available combinations of options. | N/A | ||||||||||||
| modules.products_variants.combination | list of integers | Currently selected combination. | N/A | ||||||||||||
| modules.products_variants.combined | list of dictionaries | Variant choices associated with products. |
|
tell_a_friend.html
| Variable name | Type | Description | Format |
|---|---|---|---|
| modules.tell_a_friend.form_action | URL | Form handler. | N/A |
Page specific
Most variables are not available on a global scale. They are page specific variables. They are always prefixed with the same name as the included template. So contact.html variables are prefixed with contact.
Account edit page (account_edit.html)
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| account_edit.form_action | URL | A link to the page which handles the form | N/A | ||||||||||||||||||||||||||||||||||||
| account_edit.back_href | URL | A link back to the account page | N/A | ||||||||||||||||||||||||||||||||||||
| account_edit.account | dictionary | Account data |
|
Account history page (account_history.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| account_history.account_href | URL | A link back to the account page | N/A | |||||||||||||||||||||||||||
| account_history.pagination | pagination | Pagination info | N/A | |||||||||||||||||||||||||||
| account_history.page_href_format | URL | Pagination link format | N/A | |||||||||||||||||||||||||||
| account_history.order_history | list of dictionaries | Order history |
|
Order info page (account_history_info.html)
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| account_history_info.back_href | URL | Link back to the account order history | N/A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| account_history_info.order | dictionary | Order info |
|
Account page (account.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| account.account_history_href | URL | A link to the account history page | N/A | |||||||||||||||||||||
| account.account_edit_href | URL | A link to the edit account page | N/A | |||||||||||||||||||||
| account.address_book_href | URL | A link to the address book page | N/A | |||||||||||||||||||||
| account.account_password_href | URL | A link to the password change page | N/A | |||||||||||||||||||||
| account.logoff_href | URL | A link to the logoff page | N/A | |||||||||||||||||||||
| account.account_newsletters_href | URL | A link to the newsletters page | N/A | |||||||||||||||||||||
| account.account_notifications_href | URL | A link to the notifications page | N/A | |||||||||||||||||||||
| account.order_history_enabled | boolean | Is the order history enabled? | N/A | |||||||||||||||||||||
| account.order_history | list of dictionaries | Order history |
|
Account newsletter subscription page (account_newsletters.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| account_newsletters.form_action | URL | A link to the page which handles the form | N/A |
| account_newsletters.back_href | URL | Link back to the account page | N/A |
| account_newsletters.subscribed | boolean | Is the user subscribed to the newsletter | N/A |
Account notifications page (account_notifications.html)
| Variable name | Type | Description | Format | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| account_notifications.form_action | URL | A link to the page which handles the form | N/A | ||||||||||||
| account_notifications.account_href | URL | A link back to the account page | N/A | ||||||||||||
| account_notifications.products | list of dictionaries | The products subscribed to |
| ||||||||||||
| account_notifications.global_product_notifications | boolean | Has the user enabled the global product notification setting | N/A |
Change account password page (account_password.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| account_password.form_action | URL | A link to the page which handles the form | N/A |
| account_password.back_href | URL | Link back to the account page | N/A |
Address book page (address_book.html)
| Variable name | Type | Description | Format | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| address_book.back_href | URL | A link back to the account page | N/A | ||||||||||||||||||
| address_book.add_href | URL | A link to a form which adds a new entry to the address book | N/A | ||||||||||||||||||
| address_book.entries_count | integer | Number of entries | N/A | ||||||||||||||||||
| address_book.address_label | HTML | Address label | N/A | ||||||||||||||||||
| address_book.addresses | list of dictionaries | The addresses in the address book |
|
Address book modification page (address_book_process.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| address_book_process.editing | boolean | Is the page in the editing mode? | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.deleting | boolean | Is the page in the deletion mode? | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.edit_form_action | URL | A link to a page which handles the editing form | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.delete_form_action | URL | A link to a page which handles the deletion form | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.address_label | HTML | The address | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.back_href | URL | A back link | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.address_book_href | URL | A link to the address_book | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.process | boolean | Is the page in the processing mode? | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.default_address | boolean | Is this the default address? | N/A | |||||||||||||||||||||||||||||||||||||||
| address_book_process.entry | dictionary | The fields in the current entry |
|
Advanced search page (advanced_search.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| advanced_search.form_action | string | A link to the page which handles the form. | N/A |
| advanced_search.categories | association list | A list of category names mapped to their indices. | dictionary of string to integer mappings. |
| advanced_search.manufacturers | association list | A list of manufacturer names mapped to their indices. | dictionary of string to integer mappings. |
Search results page (advanced_search_result.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| advanced_search_result.results | list of products | The search results. | N/A |
| advanced_search_result.num_results | integer | The number of search results. | N/A |
| advanced_search_result.back_href | URL | A link for returning to the search page. | N/A |
| advanced_search_result.page_limit | integer | Maximum number of products per page | N/A |
| advanced_search_result.page_limits | list of integers | List of available page limits. 0 means all products on one page | N/A |
| advanced_search_result.page_index | integer | Current page number | N/A |
| advanced_search_result.page_count | integer | Number of pages | N/A |
| advanced_search_result.sort_by | string | Current sorting key. | N/A |
| advanced_search_result.sort_order | string | Current sorting order, "ASC" or "DESC". | N/A |
| index.featured_products | list of products | A list of featured products. | N/A |
Campaign page (campaign.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| campaign.campaign_name | HTML | Title of campaign. | N/A |
| campaign.campaign_description | HTML | Description of campaign. | N/A |
| campaign.campaign_image | URL | Selected campaign image. | N/A |
| campaign.products | list of products | Products included in campaign. | N/A |
Product list (categories_listing.html)
GET variables
| Variable name | Type | Description | Format |
|---|
Available data
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| categories_listing.header | dictionary | Attributes for the top of the page. It is either a manufacturer or a category |
| |||||||||||||||||||||||||||||||||||||||
| categories_listing.header | dictionary | Page header attributes: image, description and title | For manufacturer pages the dictionary is a manufacturer, it also has a parent key with another manufacturer dictionary, and a children key with a list of manufacturers. | |||||||||||||||||||||||||||||||||||||||
| categories_listing.cpath | list of integers | List of category IDs, where the last one is the current category, the second last the current category's parent and so on. The first element is the top level category. | N/A | |||||||||||||||||||||||||||||||||||||||
| categories_listing.product_list | list of dictionaries | All products for current page | Product list | |||||||||||||||||||||||||||||||||||||||
| categories_listing.product_count | integer | Total number of products using current filters | N/A | |||||||||||||||||||||||||||||||||||||||
| categories_listing.subcategory_list | list of dictionaries | Subcategories for the current category | N/A |
Display variables
| Variable name | Type | Description | Format |
|---|---|---|---|
| categories_listing.default_list_style | integer | By default this layout for the listing is selected | N/A |
| categories_listing.page_limit | integer | Maximum number of products per page | N/A |
| categories_listing.page_limits | list of integers | List of available page limits. 0 means all product on one page | N/A |
| categories_listing.page_index | integer | Current page number | N/A |
| categories_listing.page_count | integer | Number of pages | N/A |
| categories_listing.sort_by | string | Current sorting key. | N/A |
| categories_listing.sort_order | string | Current sorting order, "ASC" or "DESC". | N/A |
| categories_listing.sort_options | dictionary | Total number of products using current filters | Identifier (model, price, etc) as key and name (Model, Price, etc) as values |
| categories_listing.sort_form_href | string | Link to the same page. | N/A |
| categories_listing.sort_name_href | string | Link to the same page when sorting by name. If already sorting by name, this URL inverts the order | N/A |
| categories_listing.sort_model_href | string | Link to the same page when sorting by model. If already sorting by model, this URL inverts the order | N/A |
| categories_listing.sort_price_href | string | Link to the same page when sorting by price. If already sorting by price, this URL inverts the order | N/A |
| categories_listing.pagination_uri_format | string | Format string for pagination. It contains a %d that the pagination macro replaces by page number | N/A |
Filtering variables
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| categories_listing.tags | list of tags | Root tags for which at least one subtag is used by one of the listed products. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.used_tag_ids | list of integers | The tags used by at least one product in the filtered set of products. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.used_spec_values | dictionary of integers to lists of integers | The specification values used by the value specifications for the filtered products. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.used_spec_texts | dictionary of integers to lists of strings | The specification values used by the text specifications for the filtered products. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.used_manufacturers_ids | list of integers | The manufacturers used by at least one product in the filtered set of products. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.manufacturers | list of dictionaries | Manufacturers used by products in current category tree. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| categories_listing.filters | list of dictionaries | Configured filters for this category. |
For the price filter and value specifications:
For the manufacturers filter:
For the category, tag, and specification category filters:
For the text specification filters:
|
Checkout success (checkout_success.html)
| Variable name | Type | Description | Format | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| google_analytics_order.products | list of dictionaries |
| |||||||||||||||||||||||||
| checkout_success.update_action | URL | A link to the page which handles the form | N/A | ||||||||||||||||||||||||
| checkout_success.heading | string | Page heading | N/A | ||||||||||||||||||||||||
| checkout_success.text | HTML | Page content | N/A | ||||||||||||||||||||||||
| checkout_success.order_id | integer | Order ID | N/A | ||||||||||||||||||||||||
| checkout_success.survey_questions | list of dictionaries | Survey questions |
|
Contact us page (contact.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| contact.form_href | string | URL with target of form for handling user input data | N/A |
| contact.captcha | boolean | Determines whether Captcha should be used or not | N/A |
| contact.name | String | Contains customer name if customer is logged in or validation if validation of a field failed | N/A |
| contact.email | string | Contains customer e-mail if customer is logged in or validation if validation of a field failed | N/A |
| contact.heading | string | Contains heading text | N/A |
| contact.text | string | Contains a descriptive text of what the contact us page is. It most certainly contains HTML so the raw filter may be appropriate to use | N/A |
Cookie usage page (cookie_usage.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| cookie_usage.continue_href | string | A link to the next page (index.php) | N/A |
Gallery pages (gallery.html, galleries/)
| Variable name | Type | Description | Format | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gallery.id | integer | Gallery ID. | N/A | |||||||||||||||
| gallery.title | string | Gallery title. | N/A | |||||||||||||||
| gallery.description | string | Gallery description or content. | N/A | |||||||||||||||
| gallery.short_description | string | Gallery short description or content. | N/A | |||||||||||||||
| gallery.date | string | Last modification date. | N/A | |||||||||||||||
| gallery.publish_date_from | string | Publication start date. | N/A | |||||||||||||||
| gallery.publish_date_to | string | Publication end date. | N/A | |||||||||||||||
| gallery.type | string | Type of gallery. | N/A | |||||||||||||||
| gallery.upload_data_action | URL | Form action for uploading. | N/A | |||||||||||||||
| gallery.upload_data_check | boolean | True. | N/A | |||||||||||||||
| gallery.upload_data_type | HTML | Form field. | N/A | |||||||||||||||
| gallery.page_title | string | Edited page title. | N/A | |||||||||||||||
| gallery.page_description | HTML | Edited page description. | N/A | |||||||||||||||
| gallery.meta_title | N/A | |||||||||||||||||
| gallery.meta_description | N/A | |||||||||||||||||
| gallery.meta_keywords | N/A | |||||||||||||||||
| gallery.form_page_description | string | Edited page description, escaped. | N/A | |||||||||||||||
| gallery.gallery_owned | boolean | Set if the gallery is owned by the logged-in user. | N/A | |||||||||||||||
| gallery.edit_content_link | URL | Link for editing the gallery. | N/A | |||||||||||||||
| gallery.remove_content_link | URL | Link for removing the gallery. | N/A | |||||||||||||||
| gallery.edit_mode | boolean | Set when editing, otherwise adding. | N/A | |||||||||||||||
| gallery.gallery_fields | list of dictionaries | Gallery fields. |
| |||||||||||||||
| gallery.children | list of string to dictionary mappings | Child galleries indexed by gallery type. |
| |||||||||||||||
| gallery.siblings | list of string to dictionary mappings | Sibling galleries indexed by gallery type. | See gallery.children. | |||||||||||||||
| gallery.parents | list of dictionaries | Parent galleries with the bottommost first. |
| |||||||||||||||
| gallery.extra1 | string | Custom page field. | N/A | |||||||||||||||
| gallery.extra2 | string | Custom page field. | N/A | |||||||||||||||
| gallery.extra3 | string | Custom page field. | N/A | |||||||||||||||
| gallery.extra4 | string | Custom page field (language dependent). | N/A | |||||||||||||||
| gallery.extra5 | string | Custom page field (language dependent). | N/A | |||||||||||||||
| gallery.images | list of URLs | Images set for this page | N/A | |||||||||||||||
| categories | list of dictionaries | Categories set for this page (only shown if cright 141 is set). |
| |||||||||||||||
| tags | list of tags | Tags set for this page (only shown if cright 141 is set). | N/A |
Index page (index.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| index.text | HTML | Page text | N/A |
| index.header_products | products | A random selection of products. | list of products |
| index.featured_products | products | A list of featured products. | list of products |
| index.new_products | products | A list of recently added products. | list of products |
| index.specials_products | products | A list of products with special prices. | list of products |
Kolli page (kolli.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| kolli.heading | string | Page heading | N/A |
| kolli.text | HTML | Page text | N/A |
Login page (create_account.html, login.html, password_forgotten.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| create_account.form_action | URL | A link to the page which handles the form | N/A |
| create_account.heading | string | Page heading. | N/A |
| create_account.text | string | Page text. | N/A |
| create_account.generated_password | string | A randomly generated password suitable for the new account. | N/A |
| create_account.customers_personnummer | string | N/A | |
| create_account.countries | association list | A list of country indices mapped to their names. | dictionary of integer to string mappings. |
| Variable name | Type | Description | Format |
|---|---|---|---|
| login.form_action | URL | A link to the page which handles the form | N/A |
| login.heading | string | Page heading | N/A |
| login.page_name | string | N/A |
| Variable name | Type | Description | Format |
|---|---|---|---|
| password_forgotten.form_action | string | A link to the page which handles the form | N/A |
| password_forgotten.back_href | string | A link to the parent page (login.php) | N/A |
Create account box (containboxes/create_account.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| containboxes.create_account.form_action | URL | A link to the page which handles the form | N/A |
| containboxes.create_account.text | HTML | Box text | N/A |
| containboxes.create_account.generated_password | string | A randomly generated password suitable for the new account. | N/A |
| containboxes.create_account.customers_personnummer | string | The customer's personnummer | N/A |
| containboxes.create_account.countries | association list | A list of country indices mapped to their names. | dictionary of integer to string mappings. |
Login box (containboxes/login_box.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| containboxes.login_box.form_action | URL | A link to the page which handles the form | N/A |
Password forgotten box (containboxes/password_forgotten_box.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| containboxes.password_forgotten_box.form_action | URL | A link to the page which handles the form | N/A |
Log off page (logoff.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| logoff.continue_href | string | Link presented to the user after logging off. | N/A |
Manufacturers page (manufacturers.html)
manufacturers.list is a list of dictionaries with these fields:
| Variable name | Type | Description | Format |
|---|---|---|---|
| id | integer | N/A | N/A |
| name | string | N/A | N/A |
| image | URL | N/A | N/A |
| address | string | N/A | N/A |
| postcode | string | N/A | N/A |
| postal_address | string | N/A | N/A |
| visitational_address | string | N/A | N/A |
| country | string | N/A | N/A |
| telephone1 | string | N/A | N/A |
| telephone2 | string | N/A | N/A |
| fax | string | N/A | N/A |
| email_address | string | N/A | N/A |
| orgno | string | N/A | N/A |
| vat | string | N/A | N/A |
| note | string | N/A | N/A |
| plusgiro | string | N/A | N/A |
| bankgiro | string | N/A | N/A |
| postgiro | string | N/A | N/A |
| contact | string | N/A | N/A |
| payment_conditions | string | N/A | N/A |
| customers_no | string | N/A | N/A |
| video_1 | string | N/A | N/A |
| video_2 | string | N/A | N/A |
| extra1 | string | N/A | N/A |
| extra2 | string | N/A | N/A |
| extra3 | string | N/A | N/A |
| homepage | string | N/A | N/A |
| link | string | N/A | N/A |
| seo_link | string | N/A | N/A |
| url | string | N/A | N/A |
| description | string | N/A | N/A |
| meta_title | string | N/A | N/A |
| meta_keywords | string | N/A | N/A |
| meta_description | string | N/A | N/A |
| extra4 | string | N/A | N/A |
| extra5 | string | N/A | N/A |
| date_added | string | N/A | N/A |
| last_modified | string | N/A | N/A |
| number_of_products | integer | N/A | N/A |
| parent_id | integer | N/A | N/A |
| children | list of manufacturers |
News archive page (news_archive.html)
| Variable name | Type | Description | Format | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| news_archive.news | list of dictionaries | News articles |
|
News article page (news.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| image | URL | Assigned image | N/A |
| news.title | string | News article title | N/A |
| news.date | string | Date of publishing | N/A |
| news.content | string | News article content | N/A |
| news.short | string | News article content, short version | N/A |
Newsletter page (newsletter.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| newsletter.text | HTML | The newsletter. | N/A |
Product page (product.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product.form_href | URL | Add to cart handler. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.reviews_href | URL | Link to product reviews. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.invalid_name | string | Invalid product name page title. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.invalid_text | string | Invalid product name page text. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.inactive_name | string | Inactive product name page title. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.inactive_text | string | Inactive product name page text. | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.product_prev
product.product_next |
dictionary | Previous and next products in the current category. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.category_path | list of dictionaries | Information about the current category path. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.product | dictionary | Product information |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.manufacturer | manufacturer | Product brand information | The manufacturer dictionary has an additional key named 'model' containing the manufacturer model for the product. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| product.collection | manufacturer | Product collection information | The collection dictionary has an additional key named 'model' containing the manufacturer model for the product. |
Product added to shopping cart page (product_added.html)
| Variable name | Type | Description | Format | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product_added.checkout_href | URL | A link to the checkout page. | N/A | |||||||||
| product_added.product | product | The product added. | The product has two additional keys.
|
New products page (products_new.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| products_new.pagination | pagination | Pagination info | N/A |
| products_new.page_href_format | URL | Pagination link format | N/A |
| products_new.products | products | A list of recently added products. | list of products |
Product reviews page (product_reviews.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product_reviews.back_href | URL | Link to the product page. | N/A | |||||||||||||||||||||
| product_reviews.write_href | URL | Link to the write review page. | N/A | |||||||||||||||||||||
| product_reviews.product | product | The product. | N/A | |||||||||||||||||||||
| product_reviews.pagination | pagination | Pagination object for the reviews. | N/A | |||||||||||||||||||||
| product_reviews.page_href_format | URL | Page format for the pagination. | N/A | |||||||||||||||||||||
| product_reviews.reviews | list of dictionaries | The displayed reviews. |
|
Review page (product_reviews_info.html)
| Variable name | Type | Description | Format | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product_reviews_info.back_href | URL | Link to the product reviews page. | N/A | |||||||||||||||
| product_reviews_info.write_href | URL | Link to the write review page. | N/A | |||||||||||||||
| product_reviews_info.product | product | The product. | N/A | |||||||||||||||
| product_reviews_info.review | dictionary | The displayed review. |
|
Write review page (product_reviews_write.html)
| Variable name | Type | Description | Format | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product_reviews_write.form_href | URL | Form handler. | N/A | |||||||||
| product_reviews_write.back_href | URL | Link to the product reviews page. | N/A | |||||||||
| product_reviews_write.product | product | The product. | N/A | |||||||||
| product_reviews_write.customer | dictionary | Customer information. |
|
Question about product page (question_about_product.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| question_about_product.form_action | URL | A link to the page which handles the form | N/A |
| question_about_product.back_href | URL | Link back to the product page | N/A |
| question_about_product.product | product | Product information. | N/A |
Product reviews page (reviews.html)
| Variable name | Type | Description | Format | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| reviews.pagination | pagination | Pagination info | N/A | |||||||||||||||||||||||||||
| reviews.page_href_format | URL | Pagination link format | N/A | |||||||||||||||||||||||||||
| reviews.reviews | list of dictionaries | Product reviews |
|
Shopping cart page (shopping_cart.html)
These variables are available on shopping_cart.php only.
| Variable name | Type | Description |
|---|---|---|
| shopping_cart.title | ||
| shopping_cart.description | ||
| shopping_cart.update_products_href | ||
| shopping_cart.checkout_href | ||
| shopping_cart.referer_url | ||
| shopping_cart.cart_count | ||
| shopping_cart.cart_total |
These variables are available in pages/checkout/shopping_cart.html through ajax_include.php?page=loadcart, pages/checkout.html through checkout.php and pages/shopping_cart.html through shopping_cart.php:
| Variable name | Type | Description |
|---|---|---|
| shopping_cart.list | list of dictionaries | Products in the shopping cart. |
| shopping_cart.products | list of dictionaries | Same as shopping_cart.list. |
| shopping_cart.any_out_of_stock | integer | 1 if any product in the shopping cart is out of stock, 0 otherwise. |
| shopping_cart.total | string | The currency formatted total cost of the shopping cart, tax included unless tax display inactivated. |
| shopping_cart.discounts | list of discounts |
Each product has the following format:
| Variable name | Type | Description | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||||||||||||
| parent_id | |||||||||||||||||||||||||||||
| final_price | |||||||||||||||||||||||||||||
| final_price_raw | |||||||||||||||||||||||||||||
| image | |||||||||||||||||||||||||||||
| manufacturers_id | |||||||||||||||||||||||||||||
| collection_id | |||||||||||||||||||||||||||||
| model | |||||||||||||||||||||||||||||
| name | |||||||||||||||||||||||||||||
| package_content | |||||||||||||||||||||||||||||
| price | |||||||||||||||||||||||||||||
| price_raw | |||||||||||||||||||||||||||||
| quantity | |||||||||||||||||||||||||||||
| weight | |||||||||||||||||||||||||||||
| href | |||||||||||||||||||||||||||||
| unit | |||||||||||||||||||||||||||||
| type | |||||||||||||||||||||||||||||
| total_price | |||||||||||||||||||||||||||||
| total_price_raw | |||||||||||||||||||||||||||||
| total_final_price | |||||||||||||||||||||||||||||
| total_final_price_raw | |||||||||||||||||||||||||||||
| final_price_difference | |||||||||||||||||||||||||||||
| final_price_difference_raw | |||||||||||||||||||||||||||||
| total_final_price_difference | |||||||||||||||||||||||||||||
| total_final_price_difference_raw | |||||||||||||||||||||||||||||
| final_price_discount_percent | |||||||||||||||||||||||||||||
| price_per_unit | |||||||||||||||||||||||||||||
| final_price_per_unit | |||||||||||||||||||||||||||||
| quantity_in_unit | |||||||||||||||||||||||||||||
| stock_quantity | |||||||||||||||||||||||||||||
| discounts | list |
| |||||||||||||||||||||||||||
| variants | list |
| |||||||||||||||||||||||||||
| attributes | dictionary |
| |||||||||||||||||||||||||||
| data | dictionary | Custom data stored on the shopping cart entry. |
Specials page (specials.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| specials.pagination | pagination | Pagination info | N/A |
| specials.page_href_format | URL | Pagination link format | N/A |
| specials.specials | products | A list of products with special prices. | list of products |
Tell a friend page (tell_a_friend.html)
| Variable name | Type | Description | Format |
|---|---|---|---|
| tell_a_friend.form_action | URL | A link to the page which handles the form | N/A |
| tell_a_friend.back_href | URL | Link back to the product page | N/A |
| tell_a_friend.product | product | Product information. | N/A |
Extensions
Functions
build(string, array, array)
Creates the target file as the concatenation of the list of source files. SCSS-files are compiled to CSS. The target file is updated when any of the source files have a modified date later than that of the target file.
Relative paths in CSS-files are not updated, take care that the information referenced is reachable from the output directory. If the generated file is put in the same directory as the source files, it should work as paths relative to the generated URL will still work.
JavaScript-files can also be built.
<link rel="stylesheet" href="{{ build('output/out.css',
['input/a.css', 'input/b.css', 'input/test.scss']) }}">
The returned string could look like this:
/static/9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08/template/output/out.css
The third parameter is an optional list of options. The currently supported options are "dry-run" and "force". "dry-run" causes the function to return the URL to the output file without generating or regerenrating it. "force" causes the function to always regenerate the output file.
<link rel="stylesheet" href="{{ build('output/out.css',
['input/a.css', 'input/b.css', 'input/test.scss'],
['dry-run', 'force']) }}">
check_customer_exists(value, field)
Returns true/false if customer exists.
Will check if a customer exists based on field. Current accepted fields are 'id' (default) and 'personnummer'
check_customer_exists('900805-2122', 'personnummer')
file_exists(file)
Returns true/false if template file found.
product_has_associated_products(products_id [, associations_type = 0])
Returns a boolean indicating if the product has associated products of the requested type.
get_associated_products(products_id [, associations_type = 0 [, order_by = 'association_priority' [, replace_variants = false]]])
Returns a product listing of associated products for the given product.
Use type = -1 for "customers who bought this also bought...".
{% import 'helpers/html.html' as html %}
{% for p in get_associated_products(product.product.id) %}
{{ html.listed_product(p) }}
{% endfor %}
To get the priority of the associated product use the field associated_priority.
If order_by is omitted, the associated product priority (products_associations.priority) is used as default.
Valid values for order_by
- date_added:asc
- date_added (evaluates to date_added:desc)
- date_added:desc
- new_until:asc
- new_until:desc
- rand
- sort_order
- products_ordered_recent (DESC is default order)
- products_name:asc
- products_name:desc
- products_model:asc
- products_model:desc
- products_price:asc
- products_price:desc
The parameter replace_variants replaces the associated products with their parent products.
get_associated_product_types()
Returns an indexed listing of all associated product types.
| Variable name | Type | Description |
|---|---|---|
| id | integer | The association type's id. |
| name | string | The association type's name. |
The default associated product types are:
| id | name |
|---|---|
| -1 | Andra som köpte denna köpte även |
| 0 | Associerade produkter |
Example syntax:
{{ get_associated_product_types() }}
get_categories(products_id)
Returns the categories for the given product.
<ul>
{% for c in get_categories(product.product.id) %}
<li><a href="{{ c.id }}">{{ c.name }}</a></li>
{% endfor %}
</ul>
get_category_tree(categories_id, [options])
Returns a category tree starting from the requested ID. Using 0 for the ID is not possible.
{{ get_category_tree(123, ['inactive']) }}
get_coupon_codes_by_category(category_input)
Returns active coupon codes by category. The input parameter may be a category id or an array of category ids. Only valid coupon codes for the currently logged in customer are returned.
{{ get_coupon_codes_by_category(11) }}
{{ get_coupon_codes_by_category([11, 164, 182]) }}
get_coupon_codes_by_manufacturer(manufacturer_input)
Returns active coupon codes by manufacturer. The input parameter may be a manufacturer id or an array of manufacturer ids. Only valid coupon codes for the currently logged in customer are returned.
{{ get_coupon_codes_by_manufacturer(12) }}
{{ get_coupon_codes_by_manufacturer([12, 18, 64]) }}
get_customer_address_book()
Returns the customer's address book based on session customer id.
| Variable name | Type | Description |
|---|---|---|
| type_id | string | |
| type_name | string | |
| firstname | string | |
| lastname | string | |
| company | string | |
| street_address | string | |
| street_address2 | string | |
| suburb | string | |
| city | string | |
| postcode | string | |
| state | string | |
| zone_id | string | |
| country | string |
get_customer_country_by_ip()
Returns an array with information about country based on users IP.
| Key | Type | Description |
|---|---|---|
| name | string | Country name (e.g. Sverige) |
| country_id | integer | Country ID |
| iso2 | string | Two letter country code (e.g. SE) |
| iso3 | string | Three letter country code (e.g. SWE) |
get_customer_logins()
Returns an array containing all the customer logins.
{{ get_customer_logins() | json_encode }}
get_customer_order(order_id)
Returns a customer order with the same data structure as on Order Info Page (account_history_info), with the exception of returning parcel_id instead of events (order delivery events), id instead of id_formatted, and status_id in addition to status.
get_customer_orders()
Returns the customer's orders with the highest order id first.
| Variable name | Type | Description |
|---|---|---|
| id | integer | The order's id. |
get_customer_subscription_info()
Returns information about subscriptions.
| Variable name | Type | Description | Format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| shopping_cart_subscriptions | list of dictionaries | Subscriptions that would be generated from the shopping cart contents. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| subscriptions | list of dictionaries | Previous subscriptions. | The format is the same as for shopping_cart_subscriptions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pauses | list of date | Global pauses in deliveries. | N/A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| delivery_minimum_days | integer | Minimum number of days from an automatic subscription order creation to a delivery. | N/A |
get_delivery_status()
Returns an array containing an array with the history from Unifaun and the order_status from Admin.
{{ get_delivery_status() | json_encode }}
get_discounts()
Returns the active discounts.
{{ get_discounts() | json_encode }}
get_discounted_product_discount(product_id, [customers_group_id])
Returns the active discounts matching a product.
{
"when": {
{"name": "Ta 3 betala för 2"}
},
"what": {
{"name": "Ta 3 betala för 2"},
{"name": "Köp över 699kr, få ett hårband på köpet"}
}
}
get_information_page_tree(page_id, [options])
Returns a page tree starting from the requested page_id. The tree has the same structure as boxes.information_pages.tree (see above). Using 0 for the ID *is* possible and returns a tree of all pages. Omitting the page_id will yield the same result as setting page_id to 0. The only options supported are "inactive" (include inactive pages) and "hidden" (include hidden pages).
{{ get_information_page_tree() }}
{{ get_information_page_tree(30) }}
{{ get_information_page_tree(30, ['inactive']) }}
Remember it doesn't return an array straight, so you can do this:
{% for c in [get_information_page_tree(id)] %}
Unless you go for children example:
{% for c in get_information_page_tree(81, ['hidden']).children %}
You can also access key values directly like:
{{ get_information_page_tree(id).name }}
get_manufacturer(manufacturers_id)
Returns a specific manufacturer.
{{ get_manufacturer(123) }}
get_manufacturer_category_tree(manufacturer_id)
Returns a simple category tree filtered by manufacturer. Only the categories containing active products with the selected manufacturer are returned. Also returns a count of those products for each section of the category tree.
{{ get_manufacturer_category_tree(123 }}
Result item structure:
| Key | Type | Description |
|---|---|---|
| id | integer | Category ID |
| name | string | Category name |
| href | URL | Absolute url path to the category |
| seo_link | URL | Relative url path to the category |
| image | URL | Category image url |
| children | array | Category children |
| product_count | integer | Number of products matching the manufacturer in the category and all child categories |
get_markets_for_countries([countries_id])
Returns an array containing the countries selected. In the array for a country are the markets that it's connected to and information about that market.
get_unit(unit_id)
Returns an array with information about a unit.
| Key | Type | Description |
|---|---|---|
| title | string | Title of unit (e.g. Styck) |
| abbr | string | Abbreviation of title (e.g. st) |
| relation_id | integer | ID of unit it's connected to |
| calculation_value | integer | Value in relation to connected unit |
get_page_content_block_history([filterByLanguageId = 0 [, groupByDate = true [, pageId = 0]]])
Returns a list of all content block changes in descending chronological order. If filterByLanguageId is not sent, then all language changed will be included. Same with pageId.
NOTE: The function will return a maximum of 250 results.
| Key | Type | Description |
|---|---|---|
| page_id | integer | Page ID |
| page_title | string | Page title |
| date_changed | date | Date for the change |
| changed_by | string | Name of the admin who saved the page, if super admin then this will only return "Vendre" |
| language_id | int | Language id of the change |
| language_name | string | Language name |
| language_code | string | Two letter ISO language code |
get_partners([options])
Returns all partners. The only options supported are
- "active", which filters out inactive partners
- "visible", which filters out partners hidden from listing
- "stocked", which filters out unstocked partners
- "translate", which translates worktitle and description
NB: The default options are "translate", "active" and "visible" (used when the function is called without an options array).
{{ get_partners() }}
{{ get_partners(["translate"]) }}
{{ get_partners(["translate", "active", "stocked"]) }}
get_partners_stock(product_id)
Returns an array with all partner stock for a chosen product. The key for each row is the partner id.
Example response:
{
"1": {
"products_quantity": 2
},
"2": {
"products_quantity": 12
},
"3": {
"products_quantity": 0
},
"9": {
"products_quantity": 4
}
}
get_product(search, mode, [options])
Returns a single product. Valid search modes are product id (default), model or ean. When searching by product id, mode should be omitted or included as empty string.
{{ get_product(10) }}
{{ get_product("ve4875", "model") }}
{{ get_product("7313222320034", "ean") }}
{{ get_product("ve4875", "model", ["inactive"]) }}
By default only active products are returned. The only options supported are "inactive" (return both active and inactive products) and "inactive_only" (include only inactive products).
get_product_attributes(product_id)
Returns the product's attributes as a dictionary where the attribute id is used as the key and the elements have the below structure. The passed product id can be a product id string, including selected attributes.
| Key | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | integer | Attribute ID. | ||||||||||||||||||||||||||||||
| type | integer | Attribute type. 0 for regular multi-choice attributes, 1 for attributes where a text can be entered, 2 for image attributes. | ||||||||||||||||||||||||||||||
| name | string | Attribute name. | ||||||||||||||||||||||||||||||
| values | list of dictionaries |
|
get_product_files(product_id)
Returns an array with links and info relating to attached product files.
Note that this function is resource intensive (due to looking up and confirming the files by accessing the system each time), so use it sparingly and be aware that it may adversely affect site performance.
| Key | Type | Description |
|---|---|---|
| name | string | File name. |
| path | URL | File link. |
| size | integer | Size in bytes. |
get_product_units(product_id, [load_unit])
Returns multidimensional array with the product's configured units indexed by Unit ID. The array will be sorted by the amount value (ascending). If load_unit is true, a unit array will be included in the returned array.
| Key | Type | Description |
|---|---|---|
| unitId | integer | Unit ID |
| amount | integer | Amount relative to the products primary unit. |
| unit | array | Array with unit info (as returned from get_unit). NOTE: Available only if load_unit is true. |
get_product_customer_group_prices(product_id)
Returns the available prices for a product as an array of dictionaries with the keys quantity, active_from, active_to, price and price_incl. price_rek_incl is also returned with the function activated. The prices are returned as raw prices.
{{ get_product_customer_group_prices(10) }}
get_product_variants(id)
Returns information about variants for the given product. The information returned is the same as is stored in modules.products_variants, except that category is not included.
get_products(limit, [search], order_by, mode, [options])
Returns all products which match the values in the search array.
{{ get_products(6, [157, 164, 182]) }}
{{ get_products(6, [157, 164, 182], "rand") }}
{{ get_products(6, ["ve4875", "ve5299", "ve6988"], "sort_order", "model") }}
{{ get_products(6, ["ve4875", "ve5299", "ve6988"], "sort_order", "model", ["inactive"]) }}
(int) limit - maximum amount of products to return
(array) search
- on default mode: array of product ids
- on mode "model": array of models
- on mode "extra_field_X" (1-5): array of values to match with extra field
(string) order_by (required if mode is "model")
- "date_added:asc": sort products by date added and order added, the oldest products first.
- "date_added", "date_added:desc": sort products by date added and order added, the newest products first.
- "rand": sort products randomly. Note that the result of the function is cached.
- "sort_order": sort products by given sort order and order added, the products with the lowest given sort order first.
- Any other string: sort products by order added, the first added products first.
(string) mode
- empty string (default): array of product ids
- "model": array of models
- "extra_field_X" (1-5): array of values to match with extra field
(array) options (only active products are returned by default)
- "inactive": return both active and inactive products
- "inactive_only": return only inactive products
- "new_only": return only new products
get_specification_values_by_id(specification_id)
Returns unique specification values by specification id (category id of type specification). Retrieved values are sorted alphabetically the way a human would sort them (uses strnatcmp for consistency with specification filter sorting).
{{ get_specification_values_by_id(30) }}
See below for expected return value structure.
| Key | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| id | integer | The ID belonging to the specification. | ||||||
| name | string | The name of the specification. | ||||||
| type | string | Either "text" or "value". | ||||||
| unit | string | Currency name or specification unit (Provided only if type is "value" and specification unit is set).
| ||||||
| short_value | string | If type is "text", this contains the short value. | ||||||
| value | string | The value of the specification |
get_specifications(product_id)
Returns all specifications by product id (and filtered by session language).
{{ get_specifications(24) }}
See below for expected return value structure.
| Key | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| id | integer | The ID belonging to the specification. | ||||||
| name | string | The name of the specification. | ||||||
| type | string | Either "text" or "value". | ||||||
| unit | string | Currency name or specification unit (Provided only if type is "value" and specification unit is set).
| ||||||
| short_value | string | If type is "text", this contains the short value. | ||||||
| value | string | The value of the specification |
get_store_design_button_class
Returns the standard (and configured) CSS classes for buttons used in the standard templates.
get_tag_tree(tag_id)
Returns a tag tree starting from the requested tag_id. Using 0 for the ID *is* possible and returns a tree of all tags. Omitting the tag_id will yield the same result as setting tag_id to 0.
{{ get_tag_tree() }}
{{ get_tag_tree(30) }}
get_package_per_unique_product_details(product_id)
Returns one product for each product-id with the total sum of the quantity on the package. The array will be empty if it's not a package.
{{ get_package_per_unique_product_details(746) }}
get_product_with_package_info(product_id)
Returns all products in the package together with the package quantity. The array will be empty if it's not a package. This function works almost like "modules.products_in_package.products" on the products page with one exception; It works on every page.
{{ get_product_with_package_info(746) }}
langimg(image, width, height)
If the image exists, returns the HTML needed to display it.
{{ langimg("imagename.jpg") }}
langstr(name)
Returns a language string.
{{ langstr("LANGUAGE_STRING") }}
search_information_pages(keywords, [options])
Searches through the informations pages for the keywords (separeted by whitespace). Options are: pages_only bool (if true only regular information pages will be searched)
Plugins
getByTags(limit, tags, fill, order_by, new_only, replace_variants)
Get products by categories or tags.
{% set products = get_plugin('product_query').getByTags(4, [120, 130, 140]) %}
Limit is the maximum amount of products to return, tags are the tags from which products are selected, fill controls if products which do not match any of the tags are also returned, order_by controls how the products are sorted and new_only only returns new products (if true).
order_by can be one of these strings:
- "date_added:asc": Sort products by date added and order added, the oldest products first.
- "date_added", "date_added:desc": Sort products by date added and order added, the newest products first.
- "rand": Sort products by number of tag matches, then randomly.
- "sort_order": Sort products by sort order.
- "tags+date_added:asc": Sort products by number of tag matches, then by date added and order added, the oldest products first.
- "tags+date_added", "tags+date_added:desc": Sort products by number of tag matches, then by date added and order added, the newest products first.
- Any other string: Sort products by order added, the first added products first.
replace_variants is optional and can be true/false, default false.
getAllByTags(limit, tags, fill order_by, new_only, replace_variants)
Get products by categories or tags, this includes subcategories and subtags.
{% set products = get_plugin('product_query').getAllByTags(12, [164], false, "sort_order", false) %}
Filters
bool
Casts value to boolean, if value is a scalar (i.e. string, int, float or bool). Otherwise returns null.
1|bool
bool_filter
Casts value to boolean in an intelligent (but non-standard) way. See below for details:
- Returns true for "1", "true", "on" and "yes".
- Returns false for "0", "false", "off", "no", and "".
- Returns null for all non-boolean values.
"false"|bool
chain(array)
Chain two iterable values.
[1, 2]|chain([3, 4])
choose(number)
Choose random entries from an array or dictionary.
[1, 2, 3, 4, 5]|choose(3)
currency_format
Formats raw number with store currency.
float|currency_format
currency_calculate
Calculates raw number with store currency.
float|currency_calculate
float
Casts value to float, if value is numeric (using php's is_numeric function). Otherwise returns null.
"123,456"|float
image_button_url
Looks up an image button image for the current language.
"filename.jpg"|image_button_url
int
Casts value to integer, if value is either numeric (using php's is_numeric function) or a boolean. Otherwise returns null.
"123"|int
link(query_string)
Create a link.
"filename.php"|link(query_string)
query_string
Converts a dictionary to a valid query string.
dict|query_string
sort_by_property(sort_key [, sort_order = 'ASC'])
Sort an array consisting of objects or associative arrays by selected property (sort_key).
array_of_objects|sort_by_property('name')
{% for object in array_of_objects|sort_by_property('name', 'DESC') %}
string
Casts value to string, if value is a scalar (i.e. string, int, float or bool) or if value is an object that can be stringified (has a __toString method). Otherwise returns null.
123|string
strip
Strips whitespace from the begnning and end of strings.
string|strip
strip_tags(allowed_tags)
Strips tags.
|strip_tags("<allowed><tags>")
thumbnail(width, height)
Return thumbnail path, width and height for thumbnailed image.
image|thumbnail([width[, height]])
truncate(limit, append)
Truncate string to given limit and append string
string|truncate(limit[, append = "..."])
truncate_html(limit, append)
Truncate string to given limit and append string after stripping HTML and expanding HTML entities.
string|truncate(limit[, append = "..."])
type
Returns the type of the value/variable (uses php's function gettype).
"text"|type
unique(array)
Remove duplicates from array
[1, 1, 2]|unique
Optional parameter sort_flags may be used. Valid values are 'string' (default), 'regular', 'locale_string' and 'numeric' and correspond to the PHP constants SORT_STRING, SORT_REGULAR, SORT_LOCALE_STRING and SORT_NUMERIC. See https://www.php.net/manual/en/function.array-unique.php.
[1, 1, 2]|unique('string')