Template API
Complete reference to all classes and methods available in Shoporama templates
Available classes
In your templates, you have access to objects of the following classes:
SafeBlogPost
Handles blog posts with title, content, and related data
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
@param string $text The text to parse
@param string $key The key of the meta value
@param string $tag The HTML field's tag
@param int $limit Maximum number of products (default: 50)
@param string $name The name of the extension data field
SafeBrand
Represents a brand with image and link information
otherwise the brand page (/brands/
@param int $limit Number of products (max 50)
SafeCampaign
Handles campaigns with discounts and expiry dates
in the destination country", this is the price in the visitor's delivery country, so the theme shows
the same price that the cart charges (#1271).
or 'both'.
the campaign has no subscription price.
0 means the campaign is never triggered — see Basket::price().
SafeCategory
Represents product categories with a hierarchical structure
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
@param bool $reverse Whether to reverse the order (default: false)
@param int $level The level in the category hierarchy
@param int $limit Maximum number of products (default: 2500)
@param int $offset Start position (default: 0)
@param int $count Reference to the total count (filled in by the method)
@param string $sort Sorting: default | sold | price | alphabetic | created (optional)
@param string $sort_order Sort order: asc | desc (default: 'DESC')
@param int $limit Maximum number of posts (default: 2500)
@param int $offset Start position (default: 0)
@param int $count Reference to the total count (filled in by the method)
@param string $sort Sorting: updated | created | publish_after (optional)
@param string $sort_order Sort order: asc | desc (default: 'DESC')
@param string $key The key of the meta value
@param string $tag The HTML field's tag
@param int $limit Maximum number of products (default: 25)
@param int $days Number of days to look back (default: 90)
@param array $exclude Array of product IDs to exclude (optional)
@param string $name The name of the extension data
SafeCompany
Contains company information such as name, address, and contact details
SafeContentEntry
An entry in a content type (Content → Content types), e.g. a single recipe, with fields, images, and its own URL
SafeCategory, or SafeContentEntry (lists of them for the plural types), yes/no is
true/false, multiple choice is a list of the selected values, video is the video's URL, and
repeating rows are a list of rows (a gallery in a row is a list of SafeImage)
@param string $key The field's key
@param string $name The field's key
Yes/No, dates as 24.12.2026, etc. Empty text for images, references, and repeating rows
@param string $key The field's key
generic display of all fields in the order they have in the type. Repeating rows also
have sub_fields (key, title, and type for each subfield)
@param bool $include_empty Also include empty fields (default: false)
SafeContentType
A content type the store owner has created in admin, e.g. Recipes, with fields and entries
@param int $limit At most this many entries (default: 12, max 100)
@param int $offset Skip this many entries (for pagination)
@param string $sort weight (manual sort order), title, newest, oldest, updated, or field:
@param string $sort_order asc or desc (used with field:
SafeCountry
Handles countries with shipping rules and currency
SafeCustomFeed
SafeCustomer
Represents customers with personal information and loyalty points
SafeCustomerField
Handles custom customer fields and their values
that is sent and saved is always the Danish one from getValues(), so the customer's answer is the same in
every language
@param string $value A value from getValues() or getVal()
SafeImage
Handles images in different sizes and formats
@param int $w The width of the image
@param int $h The height of the image
@param string $t Scaling type: box | fit | pad (default: 'fit'). fit scales the whole image down within the dimensions, box fills the dimensions and crops, pad places the whole image centered on a white canvas at exactly the given dimensions (e.g. 1080x1080 for Facebook)
@param string $format Image format: jpg | png | webp (optional)
@param int $quality Image quality: 0-100 (optional)
@param int $width The width of the image
@param int $height The height of the image
@param string $type Scaling type: box | fit | pad (default: 'fit')
@param string $format Image format: jpg | png | webp (optional)
@param int $quality Image quality: 0-100 (default: 100)
@param int $w The width of the image
@param int $h The height of the image
@param string $t Scaling type: box | fit | pad
@param string $format Image format (default: 'png')
@param int $quality Image quality: 0-100 (default: 100)
an empty string if none is set. Used by themes that crop the image themselves with
object-fit. If the theme crops via getSrc(..., 'box'), the server has already taken
the focal point into account, and nothing needs to be done.
SafeLandingPage
Represents landing pages with content and SEO data
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
@param int $limit Maximum number of products (default: 25000)
@param int $offset Start position (default: 0)
@param int $count Reference to the total count (filled in by the method)
@param string $key The key of the meta value
@param string $tag The HTML field's tag
@param string $name The name of the extension data field
SafeManufacturer
Handles manufacturers with contact information and images
SafeMenu
Represents menus for navigation in the webshop
SafeMenuItem
Handles individual menu items with links and hierarchy
SafeNewsletterCampaign
* Use the theme's |date_format modifier for formatting.
* NOTE: heavy, as it renders all blocks. Use ONLY to display a single newsletter,
* never in a loop over many (use getTitle/getExcerpt/getDate/getImage for cards).
* or false if there is no image
SafeNewsletterSubscriber
SafeOrder
Represents orders with products, prices, and delivery information
Countries #1363), otherwise the store's
therefore has two invoices (HD #6141). Otherwise empty.
@param string $n The name of the setting
this is the order number from there (see isHistorical())
is shown in the customer's order history, but cannot be returned, canceled, or reordered
@param bool $as_string Whether to return the numbers as a single combined string (default: false)
An empty list means the order ships in one package, so use getTrackingNumbers() as before.
Used when an order ships in several packages, so the theme can show which products are in
which package and with which tracking number.
@param string $action The action to perform (default: 'order')
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
Order::getAmountExVatAndShipping() (export and reverse charge have no VAT).
campaign discount, points, and gift card have been deducted. The basis for commission to
affiliate networks (e.g. Make Influence). Deposit is not included, the amount is never below 0,
and with partial payment, the remaining balance is included in the booking (see Order::getGoodsAmountExVat()).
The remainder order (getIsDownPaymentRemainder()) is therefore not a new sale.
orders in the store's own currency.
@param float $amount The amount in the order's currency
Goes with amounts from toMain(). Within a country, $webshop->getCurrency() returns that country's currency.
its own 0% rate), with shipping and discounts distributed across the rates:
[['rate' => 25.0, 'net' => 196.44, 'vat' => 24.56], ['rate' => 0.0, ...]]. Empty for orders with
a single rate, so themes only show the breakdown when it matters.
the note from getMarginSchemeNote(), and no VAT amount may be shown for those products: mark them
with $order_product->isMarginScheme(), and hide the VAT line when the order's VAT is 0.
@return bool
the VAT is 0, and do not show "reverse charge" (it does not apply to second-hand goods).
@return bool
"Margin scheme – second-hand goods. The buyer cannot deduct the VAT."
@return string
(isHistorical()), so <{if $order->getReturnUrl()}> hides the link
or the order is itself an exchange order. Use it to show a message instead of
the exchange button on the return page:
<{if $order->hasExchange()}>You have already created an exchange<{/if}>
Check it BEFORE hasExchange(), since both are true on an exchange order, so the customer gets the right
explanation of why it cannot be exchanged again:
<{if $order->isExchangeOrder()}>This order is already an exchange<{/if}>
has set the theme setting checkout.withdrawal_days). Used for the text on the withdrawal page:
<{if $order->getWithdrawalDays() > 14}>You have a <{$order->getWithdrawalDays()}>-day right of withdrawal<{/if}>
the customer that the right of withdrawal for those products may have lapsed.
Each element is an array with 'name' (product name), 'amount', 'reason' (legal ground)
and 'text' (translated explanation for the customer). Empty array if no products are exempt.
Deposit lines (#645) are filtered out — they have no product (product_id = 0) and would make
older themes' line loops fail on getProduct()/getImage() calls. Themes instead show
the deposit via getDepositLines()/getDepositTotal(), and the totals (getPrice/
getTotalPrice) always include the deposit amount.
objects, one per product. A review applies to the product, and the fields are named rating[product id],
description[product id] and review_images[product id][]. If the same product is on several lines (e.g. in
two colors), the last line's empty fields would otherwise overwrite the customer's stars and text.
Negative quantities on credit notes.
@param string $field Specific field to fetch (optional, returns all if not specified)
and demoted. Known theme keys get a Danish field name, and the old customer_type
is marked demoted so a document can leave it out.
getExtras() above is still raw data and must stay that way — the themes'
own printed_invoice.html passes the value on unchanged.
the code is a means of payment with a balance: getVoucher()->getSaveChange() is true for gift cards
@param int $i The value to set (default: 1)
NOTE: the number is NEGATIVE and is summed from customer_point, which also contains the
points a credit note/return has given back — that inflates the number after a return.
If you need the discount as an amount of money, use getPointDiscount() instead.
were used. Reads the order's own 'use_points' and only falls back to
customer_point, so it is also correct on orders where the point rows are missing.
Needs a minus in front of it in the template — the amount is positive.
edit attendees), or null when the order has no tickets. The link is signed and can be passed on.
Also null on /order and the thank-you page when the visitor did not buy the order themselves (those pages can be opened
with the order number and email). Use hasTickets() to say that the tickets have been sent by email.
the gift card as a PDF, or "null" when the order does not include a gift card or the store does not have a
gift card design. Also "null" on the /order and thank-you pages when the visitor did not place the order themselves.
holder, type, code, url, and qr_url (the QR code as a PNG, for emails). code and url are null when
the product does not send QR tickets (e.g. trips).
overdue, cancelled ...), deposit_formatted, remainder_formatted, send_date, due_date, is_remainder
(this order is the remainder order) and payment_url (link to pay the remaining balance when the remainder order exists
and is not paid), or null when the order was not paid with a deposit.
List of arrays with name, amount, unit_price, and total.
SafeOrderProduct
Represents products in an order with quantity and prices
Already exists on SafeProduct. Without this one, an email template that
iterates over order lines (rather than $order->getProducts(), which returns SafeProduct)
would get null and an empty link — e.g. when a partial shipment shows the products in its own package.
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
both dates), or null if the line is not a rental.
Example: <{if $rental = $op->getRental()}><{$rental.from|date_format:"%d.%m.%Y"}> - <{$rental.to|date_format:"%d.%m.%Y"}> (<{$rental.days}> days)<{/if}>
info, location, and tickets (list with holder, type, code, and url), or null when the line is not
a ticket line. Canceled tickets are not included.
fallback when the product object is missing (deposit lines, hard-deleted products).
for the line, and the themes mark it and show the note from $order->getMarginSchemeNote().
@return bool
Additive keys (attribute_id, input_mode, data_type, is_variant) so templates
can tell customer input rows from variant rows; sort order = variants first.
is_variant/input_mode/data_type are NULL if the attribute has been deleted.
COALESCE(is_variant, 1) in the sorting: NULL (deleted attribute) is sorted LAST by
a plain DESC, and then $attributes[0] would become a customer input row on old
order lines whose variant attribute has been deleted. Same sorting as
OrderProductAttribute::getList(), so all readers agree on what "first" means.
The types match OrderProductAttribute::getList(): int on the id columns, and NULL
is kept on is_variant for deleted attributes (so "unknown" can be told apart from
"confirmed non-variant"). Without the cast, the values are raw mysqli strings, and the
"=== 0" checks found around the codebase become silent no-ops.
@return array Array of OrderProductBatch objects
SafeOrderReturn
Handles order returns
objects (name via getDisplayName(), quantity via getDepositUnits()).
SafeOrderReturnExchange
SafeOrderReturnProduct
Handles products in a return case
SafeOrderShipment
Use this rather than getPartCount() > 1 in emails: when the first package is sent,
the later packages do not exist yet, so the counter would say "1 of 1"
Used to write "the last part of your order has shipped"
the shipping method has no tracking URL, or the package has no tracking number
products=$shipment->getProducts() for the shared product line partial
SafeOrderShipmentProduct
Already exists on SafeProduct. Without this one, an email template that
iterates over order lines (rather than $order->getProducts(), which returns SafeProduct)
would get null and an empty link — e.g. when a partial shipment shows the products in its own package.
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
@param int $amount Number of units (default: 1)
both dates), or null if the line is not a rental.
Example: <{if $rental = $op->getRental()}><{$rental.from|date_format:"%d.%m.%Y"}> - <{$rental.to|date_format:"%d.%m.%Y"}> (<{$rental.days}> days)<{/if}>
info, location, and tickets (list with holder, type, code, and url), or null when the line is not
a ticket line. Canceled tickets are not included.
fallback when the product object is missing (deposit lines, hard-deleted products).
for the line, and the themes mark it and show the note from $order->getMarginSchemeNote().
@return bool
Additive keys (attribute_id, input_mode, data_type, is_variant) so templates
can tell customer input rows from variant rows; sort order = variants first.
is_variant/input_mode/data_type are NULL if the attribute has been deleted.
COALESCE(is_variant, 1) in the sorting: NULL (deleted attribute) is sorted LAST by
a plain DESC, and then $attributes[0] would become a customer input row on old
order lines whose variant attribute has been deleted. Same sorting as
OrderProductAttribute::getList(), so all readers agree on what "first" means.
The types match OrderProductAttribute::getList(): int on the id columns, and NULL
is kept on is_variant for deleted attributes (so "unknown" can be told apart from
"confirmed non-variant"). Without the cast, the values are raw mysqli strings, and the
"=== 0" checks found around the codebase become silent no-ops.
@return array Array of OrderProductBatch objects
SafePage
Represents static pages with content and SEO data
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
@param string $text The text to parse
@param string $key The key of the meta value
@param string $tag The HTML field's tag
@param string $name The name of the extension data field
SafePaymentGateway
Represents a payment gateway with settings
SafePoint
Handles loyalty points for customers
SafeProduct
Represents products with prices, images, and variants
@param int $attribute_id The attribute ID (optional)
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_id The attribute ID (optional)
@param int $attribute_id The attribute ID (optional)
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_id The attribute ID (optional)
inseparable, other) or null if the product has the standard right of withdrawal.
or null if the product has no deposit (no type selected, or the type has been removed).
$attributes uses the basket line format, so variant quantities are looked up automatically.
voucher (via getRealPrice). Returns null if the product has no unit quantity set.
the right of withdrawal. The store's own note takes precedence if it is set.
Empty string if the product is not exempt.
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_id The attribute ID (optional)
on subscription"), as SafeCampaign objects. Use getSubscriptionPrice()/
getSubscriptionUnitPrice() or getSubscriptionPercent() on the campaign.
or null when the item has a fixed amount. If there are limits, the theme must display an amount field named
giftcard_amount in the Add to Cart form (e.g., 350 or 350.50). The customer pays the amount, and the gift card
is credited with the same amount. If no amount is provided, the item is rejected with $giftcard_amount_error (product_id, code, min, max;
codes: missing, invalid, min, and max). The theme sets "supports_giftcard_amount": true in
theme_settings.json.
@param int $attribute_value_id The attribute value ID (optional)
@param int $attribute_id The attribute ID (optional)
For bundles where the stock status reflects the contents, it also applies that none of the
missing products may themselves prohibit negative stock (HD #5731 / GH #977). Without this, a
discontinued product was sold again and again through the bundle, because the bundle's own flag is inherited from
the webshop's default setting and thereby overrode the product's own choice. All other
products are unaffected and return the setting as before.
Same answer as getAllowNegativeStock(), but with a name that says what it means.
@param int $amount Quantity to be purchased (default: 1)
@param bool $parsed Whether the values should be parsed for variables (default: true)
Used by themes to, for example, hide sticky add-to-cart bars that do not
post attributes. Request-cached via getProductProfileAttributeList.
(product cards, landing pages, upsell) should then link to the product page
instead, since they cannot collect the customer's input.
@param int $country_id The country ID (optional, uses the session if not specified)
@param string $key The key of the meta value
@param bool $parsed Whether the value should be parsed for variables (default: true)
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
@param int $country_id The country ID (optional, uses the session/webshop default if not specified)
The counterpart to getRealPrice(), which returns the sale price when there is one. Used for
the struck-through previous price on a cart line: without the variant lookup, the previous price
would be the product's base price, even when the line is a variant with its own price.
@param int $amount Number of products (default: 1)
@param array $attributes The line's attributes (optional)
@param int $amount Number of products (default: 1)
@param array $attributes Array of attributes (optional)
@param array $a Array of attributes (optional)
Used by themes to show a "Quantity discount" badge and a hint on the product page.
Requires a threshold >= 1 ("buy more than X"): over = 0 would mean "always"
(not a real quantity discount) and would make getBulkDiscountPrice() subtract
the discount twice in the strikethrough display.
bulk_discount_over means "more than X", so the discount applies at X+1.
Returns null if there is no quantity discount.
Mirrors the VAT logic in getRealPrice()/getBulkDiscountPrice().
variants and lines. Used, for example, to show whether an add-on from
$webshop->getBasketAddOnProducts() is already selected (0 = not in the cart).
Mirrors the condition in getRealPrice(): the quantity discount is skipped when a
customer group/contract price is active (the contract price wins), and otherwise the quantity must be
strictly greater than the threshold, counted across variants/lines via
Basket::getProductCount().
@param array $attributes The line's attributes (so the group price check matches the variant)
@param bool $in_stock_only Only variants in stock. For themes that hide sold-out variants, so
"From" does not show the price of a variant the customer cannot select. If all are sold out, it works as before.
@param bool $in_stock_only See getLowestPrice(). Here a variant without a sale price is included at its regular price,
so a cheaper sold-out variant does not look like a sale.
@param int $amount Number of products (default: 1)
@param array $attributes Array of attributes (optional)
@param int $amount Number of products (default: 1)
@param array $attributes Array of attributes (optional)
@param bool $no_voucher Whether the gift card discount should be ignored (default: false)
@param bool $skip_basket_check Whether the cart check should be skipped (default: false)
@param float $price_per_unit Reference to the unit price (filled in by the method)
on sale or has no quantity limit, in which case there is nothing to tell
the customer. Used by themes for the "3 of 5 at sale price" line in the cart.
@param int $amount Quantity on the cart line
@param array $attributes The line's attributes
this product? Used by Basket::price() to route a group price line as
not on sale (contract price ≠ sale). Always returns false when there
is no group.
*
[min_quantity => price_incl_vat_per_unit], sorted ascending. Empty if there is no group or
no fixed tiers. For storefront display of quantity discounts (the template shows prices excl. VAT).
*
@param int $amount Number of products
@param int $attribute_value_id The attribute value ID
@param int $amount Number of products (default: 1)
@param array $attributes Array of attributes (optional)
@param int $country_id The country ID (optional)
@param int $amount Number of products (default: 1)
@param array $attributes Array of attributes (optional)
@param int $country_id The country ID (optional)
@param int $attribute_value_id The attribute value ID
@param bool $before_sale Whether the sale price should be ignored (default: false)
@param int $attribute_value_id The attribute value ID
@param int $attribute_value_id The attribute value ID
@param int $country_id The country ID (optional)
@param mixed $attribute_value_id ID or value of the attribute (e.g. 'L') (optional)
the daily price, the stock figure is the number of units, and add to cart requires the fields rental_from and
rental_to (Y-m-d). Available dates are fetched from /rental-availability.
a number of seats (getTicketDates()), and add to cart requires the field ticket_date_id, unless
the product has only one date available for purchase. Stock is not used.
ticket_date_id, starts_at, ends_at, date (e.g. "Fri. 18.01.2027 at 19:00–22:00"), label, info,
remaining (null = unlimited), sold_out and price (the price per ticket incl. the date's surcharge).
Seats can be up to 4 hours old on a cached page: fetch them fresh from /ticket-availability.
@param bool $include_sold_out Include sold-out dates (default: yes, so they can be shown as sold out)
location (venue), terms (terms and conditions) and send_tickets (QR tickets or just a booking confirmation).
Array with label (e.g. "Deposit"), type (fixed or percent), amount (fixed amount per unit in the
customer's currency), percent and send_days (the deposit applies when the date is more than that many days away).
@param int $i The attribute ID
→ all issues in the series. Null when the product has no value. For non-variant properties with
text, numbers or a value list (not yes/no, files or HTML).
@param int $attribute_id The property's ID
@return string|null
@param string $sku SKU to search for
@param int $i The attribute ID
@param string $i The name of the attribute
@param string $pre Prefix before each category name (default: "")
@param string $sep Separator between category names (default: " ")
@param string $post Suffix after each category name (default: "")
@param bool $as_ids Whether to return only category IDs (default: false)
The store enforces the limit itself in the cart and checkout. Use the number to show the limit and as max on
the quantity field. The message shown when the limit is reached is in $max_per_order_notice.
@return int|null
at the register. It cannot be added to the cart in the webshop.
@return bool
Uses the same logic as the Google Shopping feed, so the product page and the feed do not
contradict each other (HeroDesk #5659 / issue #877)
@param array $attributes Array of attribute_id => value_id if the stock status applies to a variant
Returns null if the product is not on backorder, or the store has not specified a number of days
@param array $attributes Array of attribute_id => value_id if the stock status applies to a variant
@param array $attributes Array of attributes, or an attribute ID if $x is specified
@param mixed $x Attribute value if the first parameter is an attribute ID
@param int $stock_location_id ID of the stock location (optional)
@param int $attribute_id ID of the attribute (optional)
@param int $attribute_value_id ID of the attribute value (optional)
$order->getProducts(). The order line's category, not the product's current one. The themes Alaska2,
California and Washington call it on these products in emails; previously it only existed on
SafeOrderProduct, so the asterisk was missing. False for products outside an order.
to look up the line's price in SafeRecurringOrder::getLinePrices(). Null for other products.
@param int $limit Maximum number of products (default: 25)
@param string $order_by Sorting: 'stock' (in stock first), 'price' (cheapest first), 'price_desc' (most expensive first), 'name' (alphabetical), 'random' (random), or null (default weighting)
@param int $limit Maximum number of products (default: 25)
@param string $order_by Sorting: 'stock' (in stock first), 'price' (cheapest first), 'price_desc' (most expensive first), 'name' (alphabetical), 'random' (random), or null (default sorting)
@param int $limit Maximum number of products (default: 25)
@param string $tag The HTML field's tag
@param bool $only_in_stock Show only variants in stock (default: false)
@param bool $hide_stock Hide the stock quantity (default: false)
@param int $order_id The order ID (optional, uses the product's order ID if not specified)
@param int $attribute_id ID of the attribute (optional)
@param int $attribute_value_id ID of the attribute value (optional)
@param int $amount Number of products
@param int $attribute_value_id ID of the attribute value (default: 0)
@param int $amount Number of products
@param int $attribute_value_id ID of the attribute value (default: 0)
@param string $own_id The SKU
@param int $category_id The category ID
@param int $limit Maximum number of reviews (default: 25)
@param bool $no_round Whether the rating should not be rounded (default: false)
a single unit (percent or fixed with a minimum quantity of 1). Otherwise null.
@param float $price The price shown today (incl. any sale price/variant). Default getRealPrice()
Mirrors Basket::price(): percent is calculated from getRealPrice() (so the sale price is
the basis), fixed gives the campaign's price per unit (+ VAT if prices are excl. VAT).
If more than one active campaign applies to the product, null is returned — the cart
stacks them, and a displayed price that doesn't match the cart is worse than none.
@param string $name The name of the extension data field
SafeProductBatch
SafeProductDeposit
(for B2B themes that show prices excl. VAT)
SafeProductProfileAttributeValue
Handles values for product attributes
SafeProductReview
Represents customer reviews of products
been approved, or if the store has turned off showing the images on the review.
SafeProfile
Handles product profiles with attributes and properties
SafeProfileAttribute
Represents attributes for product profiles
If $product is given, the values are filtered by active variants for that product
the field on the product page — personalization)
SafeRecurringOrder
Handles subscription orders and recurring payments
@param string $n The name of the setting
@param string $action The action (default: 'subscription')
recurring_order_product_id (the same as getRecurringOrderProductId() on the lines from
getOrderProducts()). Per line: product_id, name, amount, base_price (without campaign),
price, unit_price and campaign (SafeCampaign or null).
Methods for the delivery country that the subscription's products are not too heavy for. The
current method is always included. Use SafeShipping::hasDeliveryShops() to see whether
the method requires a parcel shop.
@param string $field Specific field to get (optional, returns all if not specified)
@param int $i The value to set (default: 1)
SafeShipping
Represents shipping methods with prices and delivery times
(GLS, PostNord, DAO, DHL, Swipbox)
@param int $country_id The country ID (optional, uses the session if not specified)
@param float $basket_total The cart total (optional, calculated automatically if not specified)
Empty list if no logo should be shown.
@param string $tag The HTML field's tag
@param bool $as_json Whether the data should be returned as JSON (default: false)
default tracking page. Empty string if there is none. Without a number, the template is returned
with %ID%. If the order has several parcels, call it once per number
@param string $id Tracking number (default: "")
SafeVoucher
Handles discount codes and gift cards
store credit) and not a discount. The themes use it to name the line in the cart.
*
the delivery country in the session and the cart amount, not just the flag in the database.
The themes use it to show the "Free shipping" line, and it must disappear when
shipping is actually charged — e.g. when the customer chooses a country the code doesn't apply in.
*
SafeWebshop
Represents the webshop with settings and configuration
the template variable $free_shipping_progress. null when there is nothing to show (no
limit, "Never free shipping" on the shipping method, a product with "Never free shipping" in
the cart, or an empty cart). Otherwise an array:
limit the limit in the country's currency
price the amount measured against the limit
remaining the missing amount (0 when free shipping is reached)
percent 0-100
reached true when free shipping is reached
the cart's contents. Empty list when free shipping is reached, or when there is no limit.
Each element is an array:
product SafeProduct
price the unit price the customer pays
reaches true when the product alone gives free shipping
attribute the variant attribute, or null when the product has no variants
values the variant values that can be bought (getAttributeValueId(), getVal())
Add to the cart with a POST to / with product_id, amount=1, attributes[attribute-id]
and redirect=/basket (or /shipping).
@param int $limit Max. number of suggestions (default: 3, at most 12)
@param string $element The element name
@param string $name The setting's name
@param string $action The action (default: "view")
@param string $controller Controller name (optional)
email is shown in a country (Countries, #1363). For JavaScript's Intl, payment windows and widgets
nothing is set. E.g. for a theme that fetches the next page itself (infinite scroll).
different number format (Countries, #1363), otherwise $default
@param string $default The theme's own decimal separator (default: comma)
with a different number format (Countries, #1363), otherwise $default
@param string $default The theme's own thousands separator (default: period)
@param bool $only_with_products Only brands with at least one product the customer can see (as on /brands)
to (Countries → the country → Delivery and payment). For the delivery address's country. The billing address
may be in any of the store's countries (getCountries()), so customers from all over the EU can shop.
*
* @param int $limit Number per page (default 25)
* @param int $offset Offset for pagination
* @param int $count Filled with the total number of public newsletters (reference)
* @param string $sort 'newest' (default), 'oldest' or 'title'
* @return array List of SafeNewsletterCampaign
* @return SafeNewsletterCampaign|false
* or isn't public.
* @param string $slug The newsletter's slug (rewrite_url)
* @return SafeNewsletterCampaign|false
* an archive section).
* @return bool
@param string $tag The tag to search for
@param array $tags Array of tags or variadic arguments
@param string $tag The tag to search for
@param string $tag The tag to search for
@param array $tags Array of tags or variadic arguments
@param int $category_id The category ID
Themes that looped over a comma-separated ID list and called getCategory() per
iteration made one "SELECT * FROM product_category" per category. Here the
whole set is primed via Category::preloadIds() first, so the lookup becomes one IN(...) query.
Invalid and foreign categories are skipped — exactly like getCategory() — and
the order from $category_ids is preserved.
@param mixed $category_ids Array of category IDs or a comma-separated string
@param int $max Maximum number of categories returned (default: 100)
@param int $landing_page_id The landing page ID
@param array $categori_ids Array of category IDs (optional)
currency (Countries, #1363), otherwise the store's
otherwise empty. For themes that otherwise show the store's own currency text (e.g. "kr.").
@param array $products Array of SafeProduct objects
@param array $products Array of SafeProduct objects
@param array $products Array of SafeProduct objects
@param int $limit Maximum number of products (default: 25)
@param int $days Number of days to look back (default: 90)
@param array $exclude Array of product IDs to exclude (optional)
@param string $page Page path to append (default: "")
(e.g. Washington): <{$webshop->getVippsExpressScript()}> before