Shop - Connections and data


Here is a list of fields and data connections available in the shop plugin models. First, some examples on how to use it:

// Using data items in template
{{product.data.intro}}
// Using data items in PHP
$product->data->intro
// Using data lists in template
{% foreach product.data.photos as photo %}{{photo.name}}{% endforeach %}
// Using data lists in PHP
foreach($product->data->photos as $photo){ print $photo->name; }
// Using cached items in template
{{product.thumburl}}
// Using cached items in PHP
$product->thumburl

It is recommended that you use the cache fields whereever possible for optimization.

Product data

You can access these with the {{product.data.name}} template variable (where {{product}} is available).

name – the name of the product
intro – short description of the product
description – long description of product (not available with WordPress plugin)
photos – a list of Photo objects associated with the product
friendlyurl – a short SEO-friendly url of the product (not available with WordPress plugin)
uploader – the User who uploaded the product
prices – a list of Price objects associated with the product
properties – a list of ProductProperty objects associated with the product
ean – the ean or upc code
code – the product code, this is given by the user in the admin
unit – the product unit type that can be ‘piece’, ‘box’, ‘bottle’, ‘minute’, ‘hour’, ‘day’, ‘month’, or ‘year’
taxpercent – not currently in use
taxid – not currently in use
importid – if the product was imported, this will be the old id from the previous shop
visitcount – the number of visits to the product page (this may or may not be used)
featured – true if the product is currently featured (starred)
active – true if the product is currently active
other – stores custom fields (see below)
recommended – a list of Product objects that can be used as related products or recommended products
recommended_by – a list of Product objects that are the reverse of recommended
quantity – the number of items in stock
infinite – true if the product quantity should be ignored
weight – the product weight, usually in gramms
wppost – a WpPost object (if WordPress plugin is enabled)
categories – a list of Category objects
packaging – the environmental impact tax packaging type
packaging_weight – the environmental impact tax packaging weight in gramms
shops – a list of Shop objects of the shops that this product is available in
ordernum – the internal sorting order number
id – the internal id (unique)

Product cache

You can access these with the {{product.name}} template variable (where {{product}} is available).

name – same as product.data.name
id – same as product.data.id
code – same as product.data.code
ean – the ean or upc code
visited – same as product.data.visitcount
featured – same as product.data.featured
active – same as product.data.active
quantity – same as product.data.quantity
infinite – same as product.data.infinite
taxpercent – same as product.data.taxpercent or the default tax percent if not specified
thumburl – the url of the first product picture as a thumbnail
friendlyurl – this is the WordPress url OR the friendly url given in the product admin
is_my_own_price – true if the price is my own (not retreived from my parent). Will also be true if I have no price.

Product smart data

You can access these with the {{product.name}} template variable (where {{product}} is available). Unliked cached fields, these are a bit slower and are live data (not cached).

price – the price in the current currency and shop in cents, typically you’ll need to use the |price or |price_unformatted filter instead
recommended – A list of recommended products available in current shop.
similars – A list of similar products available in the current shop. These are different from recommended, because recommended is manual and intended for upsell / accessories, this is automatic (based on tags and categories) and intended for competitor products.

Product data – custom fields

You can define custom text fields for products using the product_other_editable field in shop.conf.ini. First, add a list of comma seperated fields:

product_other_editable = manufacturer,related_link

Then you can also add friendly names for these fields by creating a special language file admin_shop_otherfields.en_US.lang.ini:

[field_names]
manufacturer = Manufacturer
related_link = Related url (with http)

Product data – localized

If you want to display product data localized, you can do so as follows: {{product.translation.name}}

The following fields are available:
name – the name of the product
intro – short description of the product
description – long description of product (not available with WordPress plugin)
wppost – a WpPost object (if WordPress plugin is enabled)

More information about translation-enabled fields can be found here.

ProductVariation data

You can access a list of product variations via the {{product.data.variations}} field.

Each ProductVariation’s data contains:
name – the name of the product variation
properties – a list of ProductProperty objects associated with the product
photos – a list of Photo object uploaded to this product variation
product – the parent Product

Order data

Here are the fields for order data:
orderstatus – an OrderStatus object
orderitems – a list of OrderItem objects
start, end, billing – these are Address objects; in most cases end and billing will be used
paymentmethod – a string representing the method of payment; currently supported: ‘cod’,’transfer’,’paypal’, and ‘cib’
shippingmethod – a ShippingMethod object
discounts – a list of Discount objects that were applied to this order
currency – a Currency object
language – the locale code such as hu_HU for this order
ordered – true if this order has been ordered
time_ordered – the UNIX timestamp of when this was ordered
confimed – true if the confirmation email has been sent
time_confirmed – the UNIX timestamp of when the confirmation email was sent

subtotal_ordered – the subtotal when the order was placed
shipping_ordered – the shipping fee when the order was placed
discount_ordered – the total discount when the order was placed
total_ordered – the total price when the order was placed

paid – true if the order was paid for
paid_amount – the amount that was paid for
paid_currency – the currency in which the payment was recorded
paid_payer – a payer id (for example PayPal email)
paid_id – the transaction id of this payment
time_paid – the UNIX timestamp of when the order was paid for

Order cache

The following fields are cached and available for orders:
name – the name of the person who ordered
ordernum – the order number
ordered – true if ordered
confirmed – true if confirmation email sent
paid – true if paid
storno – true if cancelled
paymentmethod – the text of the payment method
shippingmethod – the id of the shipping method selected
itemcount – the total number of separate OrderItems in this order (if 2 of the same ordered, it is counted as 1)
quantitycount – the total number of products ordered (if 2 of the same ordered, it is counted as 2)
subtotal – the subtotal before anything else is applied
shipping – shipping fee
tax – total taxes (not supported yet)
currency – currency code (HUF for example)
currencyid – id of the Currency object
discount – the total number of discounts and/or fees applied (fees are negative discounts)
totalprice – the total final price of this order

Orderitem data

order – the parent Order object
product – the associated Product object
price – the associated Price object
quantity – the quantity of items ordered (integer)

Orderitem cache

name – the product name
code – the product code (set by shop admin)
productid – the product id
quantity – quantity of items
perprice – price per item
totalprice – the total price for the item (perprice*quantity)
currency – the currency code of the item
perweight – weight in g per item
totalweight – weight in g for the item (perweight*quantity)
taxpercent – tax percentage for this item
pertax – amount of tax per item
totaltax – total tax for item (pertax*quantity)

Price data

product – the parent Product object
value – the float value of the price
currency – the Currency object of the price

Value and the currency code are cached.

Currency data

name – The long name (Forint for example)
shortname – The short name or symbol (Ft. for example)
locale – The locale in which to use this currency (hu_HU for example)
code – The currency code (HUF for example)
default – True if this currency is the default.
customformat – True if a customized formatting is set in admin.
thousands – The thousands separator set in admin. (only if customformat is true)
decimal – The decimal separator set in admin. (only if customformat is true)
precision – The number of decimals to be used, set in admin. (only if customformat is true)

Code, default, locale, customformat, thousands, decimal, precision, and shortname are cached.

Address data

These do not require much explanation, so i will just list them…
first, last, company, street, district, city, postal, province, country, comment, email, phone, taxid

These are the cached fields:
name – this is the Hungarian address form “postal city, street”
full – this is “company last first postal city, street”

Productvisit data

List of products filtered by order id (last visited items)
product – product id
order – order id

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |