Templating:Variables

Från Vendre Help
Version från den 31 augusti 2011 kl. 09.07 av Philip (Diskussion | bidrag) (Globals: Document meta information.)
Hoppa till: navigering, sök

Innehåll

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

boolean

list

dictionary

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
delivery_time string
description HTML
description_short HTML
href_buy URL
href URL
image URL
manufacturer_image URL
manufacturer_name string
model string
name string
price_discount_percentage HTML
price HTML
price_recommended HTML
price_special HTML
quantity integer
seo_link string
tax_class_id integer

Globals

Globals are accessible anywhere in the templates, including macros.

Variable name Type Description Format
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
Key Type Description
get dictionary Data received from the GET query string
post dictionary Received POST data
current_customer_id integer Returns customer ID if customer is logged in, else None N/A
meta dictionary Header meta information for current page.
Key Type Description
title HTML Page title.
keywords string Page meta keywords.
description HTML Page meta description.
language string Page language.
generator string Startabutik E-handel.
settings dictionary Contains some of the settings defined in the administration
Key Type Description
ACCOUNT_COMPANY, ACCOUNT_DOB, ACCOUNT_GENDER, ACCOUNT_PERSONNUMMER, ACCOUNT_STATE, ACCOUNT_SUBURB boolean Account fields can be enabled and disabled
CREATE_ACCOUNT_LAYOUT integer Internal
DOWNLOAD_ENABLED boolean Is the download module enabled
ENTRY_CITY_MIN_LENGTH, ENTRY_DOB_MIN_LENGTH, ENTRY_EMAIL_ADDRESS_MIN_LENGTH, ENTRY_FIRST_NAME_MIN_LENGTH, ENTRY_LAST_NAME_MIN_LENGTH, ENTRY_PASSWORD_MIN_LENGTH, ENTRY_POSTCODE_MIN_LENGTH, ENTRY_STATE_MIN_LENGTH, ENTRY_STREET_ADDRESS_MIN_LENGTH, ENTRY_TELEPHONE_MIN_LENGTH integer Used in form validation
ENTRY_PASSWORD_IN_REGISTRATION boolean Is the user allowed to specify a password when registering
FORMS_USE_CAPTCHA boolean Is captcha used for forms
HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT integer Width and height of heading images
MAX_ADDRESS_BOOK_ENTRIES integer Maximum entries in the address book
PREV_NEXT_BAR_LOCATION integer Internal
SMALL_IMAGE_WIDTH integer Width of small thumbnails in pixels
SMALL_IMAGE_HEIGHT integer Height of small thumbnails in pixels
STATISTICS_GOOGLE_ANALYTICS string Google analytics tracking code, if specified
PRODUCT_PAGE_DESIGN integer Internal
shoppingcart_amount string Amount of products in shopping cart N/A
shoppingcart_total string Total sum of the content in shopping cart N/A
random_box_left string Shows boxes at the left side of the store N/A
random_box_right string Shows boxes at the right side of the store 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
Key Type Description
id integer Id of category
name string Name of category in current language
image string Path to category image if such exists
href string Link to category's product listing page
child_count integer Number of open child categories
children list of dictionaries List of visible child categories. See boxes.categories.tree for format
open boolean Returns true if the category (or one of its children) is the currently selected one
selected boolean Returns true if the category is the currently selected one

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
Key Type Description
id integer Id of category
name string Name of category in current language
image string Path to category image if such exists
href string Link to category's product listing page
child_count integer Number of open child categories
children list of dictionaries List of visible child categories. See boxes.categories.tree for format
open boolean Returns true if the category (or one of its children) is the currently selected one
selected boolean Returns true if the category is the currently selected one

Manufacturer select

Variable name Type Description Format
boxes.manufacturers.list list of dictionaries Lists all available manufacturers
Key Type Description
name string Name of manufacturer
href string Link to manufacturer page

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
Key Type Description
name string Name of information page
href string Link to information page
active boolean Is user currently on this page?
target boolean True if information page expects the attribute target="_blank"

Language list

Variable name Type Description Format
boxes.languages.list list of dictionaries Lists all languages
Key Type Description
name string Language name
href string Link to page that sets language to this one
image string Image (flag) for language if available

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

News list

Variable name Type Description Format
boxes.news.list list of dictionaries Lists recent news. Limit set in administration
Key Type Description
name string News name
href string Link to news page
summary string News summary

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
Key Type Description
product_name string Name of product
product_image string Link to product image
review_href string Link to full review
review_rating string Rating
review_text string Text of review

Shopping cart

Variable name Type Description Format
boxes.shopping_cart.list list of dictionaries List of products in shopping cart
Key Type Description
id integer ID of product
model string Model number for product
name string Name of product
image string Link to image of product
quantity string Number of this product in shopping cart
price string Price per product before discounts represented as a string with currency symbol
final_price string Price per product after discounts represented as a string with currency symbol
total_price string Total price for all products of this kind before discounts represented as a string with currency symbol
total_final_price string Total price for all products of this kind after discounts represented as a string with currency symbol
href string Link to product's page
new boolean True if product was just added to the shopping cart
boxes.shopping_cart.total string Total value of contents of shopping cart represented as a string with currency symbol 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.
Key Type Description
name string Name of product
href string Link to product page
image string Link to product image
price string Product standard price represented with currency symbol
special_price string Product price after discounts represented with currency symbol

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

Containboxes

Available in login.html and create_account.html.

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 N/A
containboxes.create_account.customers_personnummer string The customer's personnummer N/A
containboxes.create_account.sms_avisering boolean N/A N/A
containboxes.create_account.countries association list A list of country names mapped to their indices. Array of string to integer 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

Modules

associated_products.html

Variable name Type Description Format
modules.associated_products.products list of products Associated products. N/A

downloads.php

Variable name Type Description Format
downloads.downloads list of dictionaries Available downloads
Key Type Description
href URL Download link
expiry string Download expiry date
valid boolean Is the download valid?
download_count integer Download count
product_name string Product name
downloads.account_history_info boolean Is this module included from the order info page? N/A
downloads.account_href URL A link to the account page. N/A

product_attributes.html

Variable name Type Description Format
modules.product_attributes.attributes list of dictionaries Product attributes.
Key Type Description
value string Attribute value.
id integer Attribute index.
name string Attribute name.
type integer Attribute type.
selected integer Selected attribute.
options list of index to value mappings Attribute options.

product_specifications.html

Variable name Type Description Format
modules.product_specifications.specifications list of dictionaries Product specifications.
Key Type Description
name string Specification name.
value string Specification value.

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.form_action URL Form handler. N/A
modules.products_reviews.error string Error message. N/A
modules.products_reviews.customer dictionary Customer information.
Key Type Description
firstname string First name.
lastname string Last name.
modules.products_reviews.reviews list of dictionaries Product reviews.
Key Type Description
rating integer Review rating, 1-5.
author string Review author.
date string Review date.
text HTML Review text.

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.
Key Type Description
name string Variant name
selected integer Selected variant.
options list of integer to value mappings Variants.
modules.products_variants.products list of dictionaries Variants.
Key Type Description
seo_link URL Variant URL.
name string Variant name.

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
Key Type Description
firstname string Account first name
lastname string Account last name
personnummer string Account personnummer
dob string Account date of birth
email_address string Account email address
telephone string Account telephone number
mobile string Account mobile telephone number
fax string Account fax number
gender string Account gender ('m' or 'f')

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
Key Type Description
id integer Order ID
status string Order status
date string Order date
type string Order type
name string Order delivery name
product_count integer Product count
total string Order total
href URL A link to the description of the order

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
Key Type Description
id_formatted string Order ID
status string Order status
date string Order date
total string Order total
shipping_method string Order shipping method
payment_method string Order payment method
tax_group_count integer Number of different tax groups
billing_address string Order billing address
delivery_address string Order delivery address
delivery boolean
products list of dictionaries Products in order
Key Type Description
qty integer Product quantity
id integer Product ID
name string Product name
model string Product model
tax decimal Product tax
price decimal Product price
final_price decimal Final product price
totals list of dictionaries Order parts of total
Key Type Description
title string Total part label
text string Total part value
statuses list of dictionaries Order statuses
Key Type Description
name string Status name
date string Status date
comments string Status comments
events list of dictionaries Order delivery events
Key Type Description
date string Event date
location string Event location
description string Event description

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
Key Type Description
href URL A link to the order description page
date string The date the order was placed
id integer Order ID
country string Order delivery name and country
status string Order status
total HTML Order total

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
Key Type Description
id integer Product ID
name string Product name
counter integer List index
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

New account password page (account_password_new.html)

Variable name Type Description Format
account_password_new.form_action URL A link to the page which handles the form N/A
account_password_new.back_href URL Link back to the account page N/A
account_password_new.password_provided boolean Is a password provided by the user, or the default password 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
Key Type Description
default boolean Is this the default address book entry
edit_href URL A link to edit the entry
delete_href URL A link to delete the entry
name string Associated name
address HTML The address

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
Key Type Description
male boolean Male gender?
firstname string First name
lastname string Last name
company string Company
street_address string Street address
suburb string Suburb
postcode string Post code
city string City
country_list HTML A drop-down list with countries
state_has_zones boolean Does the state have zones?
state string State
states association list A list of zones in the state

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. Array of string to integer mappings.
advanced_search.manufacturers association list A list of manufacturer names mapped to their indices. Array of string to integer mappings.

Search results page (advanced_search_results.html)

Variable name Type Description Format
advanced_search_results.results list of products The search results. N/A
advanced_search_results.num_results integer The number of search results. N/A
advanced_search_results.back_href URL A link for returning to the search page. 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

Checkout success (checkout_success.html)

Variable name Type Description Format
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
Key Type Description
id integer Question ID
question string Question
alternatives list of dictionaries Question alternatives
Key Type Description
type integer Alternative type, 1 for a radio button, an input field otherwise
id integer Alternative ID
answer string Alternative text

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

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 (login.html)

Variable name Type Description Format
login.heading string Page heading 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)

Variable name Type Description Format
id string N/A N/A
name string N/A N/A
image string 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
postgiro string N/A N/A
bankgiro 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
homepage string N/A N/A
link string N/A N/A

News archive page (news_archive.html)

Variable name Type Description Format
news_archive.news list of dictionaries News articles
Key Type Description
id integer News article ID
title string News article title
date string News article publishing date
content string News article content

News article page (news.html)

Variable name Type Description Format
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.blog_enabled boolean Is the blog functionality enabled? N/A
news.form_action URL A link to the page which handles the new comment form N/A
news.comments list of dictionaries Comments to the news article
Key Type Description
name string Comment author
date string Comment posting date
comment string Comment text

Newsletter page (newsletter.html)

Variable name Type Description Format
newsletter.text HTML The newsletter. N/A

Password forgotten page (password_forgotten.html)

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

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.
Key Type Description
id integer Product index.
image URL Product image.
name string Product name.
href URL Product link
product.category_path list of dictionaries Information about the current category path.
Key Type Description
id integer Category index.
name string Category name.
image URL Category image.
seo_link URL Category link.
product.product dictionary Product information
Key Type Description
id integer Product index.
parent_id integer Parent product index.
categories list of lists of dictionaries Information for all product categories. See product.category_path.
date_added string Date product was added.
date_available string Date product will be available.
delivery_time string Product delivery time.
description HTML Product description.
description_short HTML Short product description.
disabled boolean Product disabled status.
external_url URL Product link.
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.
featured boolean Featured product.
file URL Product file 1.
file2 URL Product file 2.
image URL Product image.
image_href URL Link to full product image.
additional_images Additional product images.
Key Type Description
href URL Image thumbnail link.
image URL Image path.
description string Image description.
last_modified string Product last modified date.
lowest_number integer Minimum required order size.
manufacturer string Product manufacturer.
manufacturer_href URL Manufacturer category link.
manufacturer_image URL Manufacturer image.
manufacturer_model string Product manufacturer model.
model string Product model.
name string Product name.
next_delivery_date string Next delivery date.
next_delivery_quantity string Next delivery quantity.
price string Product price.
price_rek string Recommended product price.
price_special string Special product price.
seo_link URL Product link.
stock integer Products in stock.
type string Product quantity type.
weight string Product weight.

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 one additional key.
Key Type Description
quantity_added integer The quantity of the product added to the shopping cart

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.
Key Type Description
href URL Link to the review page
author string Author of the review
date string The date the review was written
text string The first 100 characters of the review text, lines broken at every 40 characters
full_text string The first 100 characters of the review text
rating integer Review rating, 1-5.

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.
Key Type Description
author string Author of the review
date string The date the review was written
text string The review text, lines broken at every 60 characters
rating integer Review rating, 1-5.

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.
Key Type Description
firstname string First name of the customer writing the review.
lastname string Last name of the customer writing the review.

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
Key Type Description
href URL A link to the review page
product string Product name
author string Review author
date string Review date
image string Product image
text HTML Abbreviated review text
full_text string Unabbreviated review text
rating HTML Product rating

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