Project directory:


Shared Oxshop base directory:


Both constant contains trailing slash. E.g. for public images directory use

$imageDir = ONXSHOP_PROJECT_DIR . "public_html/images/";

Detect back office request:



Redirect to Onxshop page (with page id):


Redirect to external URL:

onxshopGoTo("", 2);

Redirect to homepage:


Redirect to current page (without query string):


or if current page node_id is known


where current page node_id can be fetched:

$node_id = $_SESSION['active_pages'][0]

Get page URL by node_id:


Get URL to a specific file:

$protocol = $_SERVER['HTTPS'] ? 'https' : 'http';
$url = "$protocol://{$_SERVER['HTTP_HOST']}/path/to/a/file";

Getting ids and URLs of special pages:

$node_conf = common_node::initConfiguration();

and perhaps:

$this->tpl->assign('NODE_CONF', $node_conf);

some important nodes are:

$node_id = $node_conf['id_map-login'];
$node_id = $node_conf['id_map-registration'];
$node_id = $node_conf['id_map-myaccount'];
$node_id = $node_conf['id_map-homepage'];
$node_id = $node_conf['id_map-404'];
$node_id = $node_conf['id_map-basket'];
$node_id = $node_conf['id_map-checkout'];

or redirect

onxshopGoTo("page/" . $node_conf['id_map-login']);


Running component in controller:

New way:

$captcha = new Onxshop_Request("component/captcha~node_id={$this->GET['node_id']}:state=on~");
$this->tpl->assign('CAPTCHA', $captcha->getContent());

Old way:

$captcha = new nSite("component/captcha~node_id={$this->GET['node_id']}:state=on~");

Running component in template:

{ONXSHOP_REQUEST_related_static #component/ecommerce/}

Loading component on client side using AJAX:

var limit_form = 0, limit_per_page = 10;
makeAjaxRequest('#sub_content', '/request/bo/component/ecommerce/product_list~' + limit_from + ':' + limit_per_page + '~');

Include specific node by id:

{ONXSHOP_REQUEST_banner #node~id=1312~}

Use different template:

$captcha = new Onxshop_Request("component/captcha@component/captcha_js~node_id={$this->GET['node_id']}:state=on~");



Get current logged customer:

$customer_id = $_SESSION['client']['customer']['id'];


Accessing files from controllers:

$media_library_file = ONXSHOP_PROJECT_DIR . "var/files/dir/name.jpg";
$local_image = ONXSHOP_PROJECT_DIR . "/public_html/images/name.jpg";

if (file_exists($media_library_file)) { ... }
if (file_exists($local_image)) { ... }

To pass file locations to a template:

$image = "var/files/dir/name.jpg";
$this->tpl->assign('IMAGE', $image);

A then in the template:

<img src="/thumbnail/125/{IMAGE} />
<img src="/image/{IMAGE} />

Download file (fill force download):

Get image orignial size:

Get image resized:

Get image resized with fluid height:

Image options

Add query string parameters to the end of thumbnail URL for special options:

method      Resize method
            Available options: crop, extend
            Default option: extend

gravity     Direction of cropping an image
            Available options: northwest, north, northeast, west, center, east, southwest, south, southeast
            Default option: center

fill        Whatever to fill thumbnail region with the image
            Available options: 1, 0
            Default option: 0



Get current basket_id:


Get current basket content:

require_once "models/ecommerce/ecommerce_basket.php";

$Basket = new ecommerce_basket();
$basket_detail = $Baskter->getContent($_SESSION['basket']['id']);

Basket detail:

"id"                Reference to ecommerce_basket
"customer_id"       Reference to client_customer  
"created"           Timestamp  
"note"              Note (probably not used)  
"ip_address"        Customer's IP address  
"discount_net"      Received net disctount
"content"           Basket content (see Basket content)  

Basket content:

"id"                                Reference to ecommerce_basket
"customer_id"                       Reference to client_customer  
"created"                           Timestamp  
"note"                              Note (probably not used)  
"ip_address"                        Customer's IP address  
"discount_net"                      Received disctount net
"total_weight"                      Sum of all product weights
"total_weight_gross"                Sum of all product gross weights (for delivery calculations)
"total_sub"                         Sum of all item totals (VAT included) (*)
"total_vat"                         Total accountable VAT, i.e. sum of all basket_item['vat']
"total"                             Total basket price (VAT included)
"total_after_discount"              Total minus discount_net (VAT included)
"total_goods_net"                   Total basket price (VAT excluded)
"total_goods_net_before_discount"   Total basket price (VAT excluded)
"total_items"                       Number of unique items in the basket        
"total_items_qty"                   Total quantity of items in the basket
"items"                             Array of basket items (see Basket item)

(*) Prior Onxshop 1.7.4 included VAT depending on backoffice_with_vat and frontend_with_vat globals

Basket item:

"id"                    Reference to ecommerce_basket_content
"basket_id"             Reference to ecommerce_basket
"product_variety_id"    Reference to ecommerce_product_variety
"quantity"              Number of particular product varieties included in the basket
"price_id"              Reference to ecommerce_price
"other_data"            Custom data
"product_type_id"       Reference to ecommerce_product_type (i.e. VAT group)
"price"                 Price value, i.e. price['value'] (VAT included) (*)
"total"                 Total price, i.e. price['value'] * quantity (VAT included) (*)
"total_net"             Total price (VAT excluded), i.e. price['value_net'] * quantity
"vat"                   Total accountable VAT value, i.e. vat_rate * total_net
"total_inc_vat"         Total price (VAT included), i.e. total_net + vat
"product"               Product detail, see Product

(*) Prior Onxshop 1.7.4 included VAT depending on backoffice_with_vat and frontend_with_vat globals


Price values (from ecommerce_price):

"value"                 Price value to display (*)
"value_net"             Price value net (= price value)
"value_gross"           Price value + VAT

(*) May include VAT depending on backoffice_with_vat and frontend_with_vat globals


Product detail:

"id"                    Reference to ecommerce_product
"name"                  Product name
"teaser"                Product teaser (HTML)
"description"           Product description (HTML)
"product_type_id"       Reference to ecommerce_product_type (i.e. VAT group)
"url"                   External URL (i.e. more information external link)
"priority"              Sorting priority
"publish"               Published flag
"other_data"            Custom data
"modified"              Timestamp
"availability"          Probably unused (and deprecated?)
"name_aka"              Subtitle (optional)
"type"                  Array containing attributes from ecommerce_product_type
"vat"                   VAT rate (as integer)
"variety"               Array containing attribues from ecommerce_product_variety
"node"                  Array containing attribues from common_node

Product variety:

"id"                    Reference to ecommerce_product_variety
"name"                  Variety name
"product_id"            Reference to ecommerce_product
"sku"                   Stock-keeping unit
"weight"                Weight displayed on front end
"stock"                 Current stock availability
"priority"              Sorting priority
"description"           Description (HTML)
"other_data"            Custom data
"width"                 Product dimension (x)
"height"                Product dimension (y)
"depth"                 Product dimension (z)
"diameter"              Product dimension (R)
"modified"              Timestamp
"weight_gross"          Weight used to calculate delivery fee
"publish"               Published flag
"display_permission"    Display permission
"ean13"                 EAN
"upc"                   UPC code
"condition"             Unused (and deprecated?)
"wholesale"             Unused (and deprecated?)
"reward_points"         Unused (and deprecated?)
"subtitle"              Variety subtitle
"price"                 Array containing attributes from ecommerce_price


Testing cards

A/B Testing

Put the following to conf/global.php

 * enable A/B testing

Then in the controller choose switch between alternative routes:


    // code for an alternative route here

} else {

    // code for the default route here