Skip to the content
Documentation

Webshop

No ratings yet

Exponential has a built-in webshop. Any content class becomes a product class when it has a price attribute; its objects can then be put into a basket and ordered. The shop module handles the basket, the checkout, orders and their statuses, VAT, discounts and currencies, and workflows add payment and shipping steps. The shop pages of the administration are on the Webshop tab.

Products

A product is a content object whose class has an attribute of one of these datatypes:

Datatype Use
Price (ezprice) One price, with a VAT type and whether VAT is included.
Multi-price (ezmultiprice) A price per currency; the visitor's preferred currency is used (shop.ini [CurrencySettings] PreferredCurrency, Webshop > Currencies).
Option, Multi-option, Range option Variants that change the price, such as a size or color.
Product category (ezproductcategory) Used by VAT rules to choose the VAT type per category.

The template of a product shows a form that posts to content/action with the button ActionAddToBasket and the hidden fields ContentNodeID, ContentObjectID and ViewMode, as design/base/override/templates/full/product.tpl does.

From basket to order

  1. Basket (shop/basket): the products of the visitor's session, with quantities and options. Old baskets of visitors who left are removed by the cronjob basket_cleanup.php.
  2. Account information (shop/register or the user's own account): who is ordering and where it goes. shopaccount.ini [AccountSettings] Handler decides how: ezuser (the default) uses the signed-in user's account, ezsimple asks for the information without registration.
  3. Confirm order (shop/confirmorder): the visitor checks the order and confirms.
  4. Checkout (shop/checkout): the order is stored with the status Pending, and confirmation e-mails are sent (shopaccount.ini [ConfirmOrderSettings]).

Each of the operations add to basket, update basket, confirm order and checkout can run a workflow before or after it. That is where payment (the Payment gateway event, with the gateways of paymentgateways.ini and extensions) and shipping (the Simple shipping event) come in.

Orders

Webshop > Orders lists the orders; each has a status. A new installation has the statuses Pending, Processing, Delivered, Awaiting payment and Paid; more can be added under Webshop > Order status. Orders can be archived, and the customer list and statistics summarize what was sold. Who may do what is set by the policies of the shop module: buy (customers), administrate, setup and edit_status.

VAT, discounts and prices

  • VAT types (Webshop > VAT types) are percentages a price refers to. With the dynamic VAT type, VAT rules choose the percentage by the customer's country and the product's category (shop.ini [VATSettings]: UserCountryAttribute, ProductCategoryAttribute).
  • Discount rules (Webshop > Discounts) give user groups a percentage off products, limited by class, section or object.
  • Calculation and rounding follow shop.ini [MathSettings] (default: round to 2 decimals).

In templates

{def $price = $node.data_map.price.content}
{$price.inc_vat_price|l10n( 'currency' )} incl. {$price.vat_percent}% VAT
{if $price.discount_percent}(-{$price.discount_percent}%){/if}
{undef $price}

{def $basket = fetch( 'shop', 'basket' )}
{$basket.items|count} items, {$basket.total_inc_vat|l10n( 'currency' )}

The shop's PHP classes (gateways, VAT handlers, basket info handlers) are documented in the shop reference of the release, doc/eng-us/shop/.

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Link to workflow information

    Leif Arne Storset ·

    References and links to the Payment Gateway workflow would be useful.

Comments

Add a comment

Comments are read by a moderator before they appear.