Shop - Functions, tags, filters, vars


You can invoke functions via the shop library: $this->zajlib->shop->start();


Betölti a shop-hoz szükséges adatokat. Ezt a default controller __wpload metódusában kell meghívni. Paraméternek megadható a locale – ez opcionális, és hiánya esetén a locale-t automatikusan próbálja megállapítani a rendszer.


Ha a WordPress plugin is aktiválva van, akkor érdemes a start_wp() metódust meghívni. Ezt a default controller __wpload metódusában kell meghívni mert itt már rendelkezésre áll a teljes WordPress motor.


Nincs tag a shop pluginban egyelőre.



{{ product|price }} – Returns the rounded, formatted price in the current shop and current currency.
{{ product|price:'EUR' }} – Returns the rounded, formatted price in the current shop for the specified currency. You can also pass a Currency object or Currency id. You could do {{product|price:shop.default_currency}} to force price display for the shop’s default currency.
{{|price }} – Returns the formatted total price of the current cart.


{{ product|price_unformatted }} – Same as |price but the result is unformatted, so it can be used in Javascript or form inputs.
{{ product|price_unformatted:'EUR' }} – As with |price, you can set the currency for unformatted.


{{ price_in_default_currency|convert_to:'EUR' }} Converts to the specified currency from the default currency.


{{ price_in_eur|convert_from:'EUR' }} Converts from the specified currency to the default currency.


{{ product|set_shop:my_shop|price }} – Sets the shop to the specified id or Shop object. If you want to display prices or discounts for a specific shop, chain this filter before |price or |price_unformatted.


{{ product|in_shop:my_shop }} – Returns true if the current (or specified) shop has this product for sale. Note that this is different from ‘active’ – this is per shop, active is global.


{{ product|in_order:order }} Will return true if the product is currently in the order. Defaults to current order.


{{ product|has_property:productproperty }} – Returns true if the product has this ProductProperty.


{{ product|set_shop:my_shop|is_price_auto:'EUR' }} – Will be true if the product price is automatically calculated via exchange rate for EUR in this shop.


{{ product|quantity_discount_per:'2' }} Will return the per item price when there are 2 items in your cart.


{{ product|quantity_discount_total:'2' }} Will return the total price when there are 2 items in your cart.


All available variables are in the shop object. If the multi-shop feature is enabled, the shop object is an object with the full Shop class parameters. Otherwise it is a stdClass with only the properties below:

  • {{shop.currency}} – the current currency, set based on the current locale
  • {{shop.default_currency}} – the default currency of this shop
  • {{shop.shippingmethods}} – all the available shipping methods
  • {{shop.products}} – all the available products in this shop
  • {{shop.order}} – the current Order object, a unique of which is given to each user when they first visit the site

Do not use the old {{order}} variable. These are no longer supported.

Typical examples

A product price:

{{product|price}} {{shop.currency.shortname}}
# Will result in something like '2.55 Euro'

Using prices in Javascript:

# Because we use the unformatted price it will be directly usable in Javascript
var an_example_price = {{product|price_unformatted}};
# You can also use the parseFloat function to avoid any syntax warnings in your IDE (caused by mixing the template language format with javascript)
var an_example_price = parseFloat('{{product|price_unformatted}}');
Outlast Web & Mobile Development (c) 2023 | Privacy Policy |