Advanced Shipping is an extension for the e-commerce solution Magento.
Thanks to its syntax using JSON, this extension allows great flexibility in setting delivery charges.
This documentation explains how to create a configuration for one of the proposed shipping modes.
Discover our add-ons on Owebia Store.
Use the index to find more easily something in the documentation.
* or regular expressionsWith the following regular expression, you block the postal codes that starts with 97 or 98 (with or without interspersed zeros and spaces).
address_filterYou can use the name or ID of the customer groups.
Formulas can be used in properties conditions and fees.
min()range()substr()A variable of type string must be surrounded by single quotes unless the auto-quoting is used with the characters {{ and }}.
{table … in …}
In a table, you can include or exclude a limit value with the characters [ and ]:
In a table, you must specify the reference value. To do this, you can use one of the variables available.
You can also use a formula to define another reference value.
{switch … in …} (associative table)
In a switch, you must specify the reference value. To do this, you can use one of the variables available.
You can also use a formula to define another reference value.
{count …}
If the property is of type Yes/No, you must use the values true/false or 1/0 without quotes.
{count distinct …}{sum …}{min …}{max …}{foreach …} loopsin_array()in_array() avec des chaînes de caractères *array_match_any()array_match_all()Warning: you must notice that in Magento, a product can be in multiple categories. So be particularly careful how you use this property.
data elementAn element of type data allow to define data that can be used in shipping methods.
meta elementAn element of type meta allow to specify informative data (author, date…).
The configuration of a shipping mode is a JSON object containing properties.
Each property has a unique name, wich will serve as unique identifier.
Each property will consiste on a configuration element (also a JSON object).
There are three different types of configuration element:
Each element has several properties:
about: comment about the elementtype: element type (method, meta or data)
Properties specific to the element type method:
label: name of shipping methoddescription (visible only if the template displays it)enabled: shipping method enabled or notfees: shipping feesconditions: activation conditionsshipto: countries (regions, postal codes) allowed for deliverybillto: countries (regions, postal codes) allowed for billingorigin: countries (regions, postal codes) allowed for origincustomer_groups: customer groups allowedtracking_url (more informations)shipto, billto and origin)
The country codes used are those of Magento (apparently they are the same as the ISO 3166-1 alpha-2 codes).
It is possible to specify region codes (only with shipto) or zip codes that you want to filter or exclude.
You can use the wildcard character * or regular expressions for postal codes.
A regular expression must start and end with the character /. If you want to use the characters (, ) or ., you must escape them with the character \ (ex: "FR(/^25\([0-9]{3}\)$/)").
You can use the insensitivity modifier (ex: "GB(/^PO.*$/i)").
Tip
To shorten the seizure of countries, you can use the following variables:
{address_filter.AF}: African countries{address_filter.AS}: Asian countries{address_filter.EU}: European countries{address_filter.NA}: North American countries{address_filter.SA}: South American countries{address_filter.OC}: Oceanian countries{address_filter.AN}: countries of Antarctica{address_filter.EU-27}: countries of the European Union{address_filter.DOM}: country codes of French Overseas "Départements"{address_filter.COM}: country codes of French Overseas "Collectivités"Each configuration element has a unique identifier. This identifier can be used to refer to the element.
Example:
Warning: to avoid conflicts, use only the characters a-z, A-Z, 0-9, - and _ for the unique identifier.
You should also avoid identifiers that already correspond to variable names (cart, product, item…).
The properties fees and conditions are defined using formulas.
A formula uses variables, functions, special functions and mathematical operators.
Available mathematical operators:
*, /, + and -%( and )&&, and, ||, or, ==, <, >, <=, >=& and |C ? X : Y (ex: "{cart.price_exluding_tax}>100 ? 15*{cart.weight} : 20*{cart.weight}")You can put spaces and line breaks in formulas (for lightening).
You can use the following advanced features: casting to interger (int) or floatting numbers (float),
comparison with the null value or with boolean values true and false.
When you use variables of type string, you must escape them with single quotes or use the auto-quoting syntax {{ }}.
The following variables can be used in formulas.
{cart.weight}: weight of goods{cart.qty}: the quantity of items{cart.price-tax+discount}: price excluding tax with discount{cart.price+tax+discount}: price including tax with discount{cart.price-tax-discount}: price excluding tax without discount{cart.price+tax-discount}: price including tax without discount{cart.coupon_code}: coupon code{cart.free_shipping}: delivery offered (by rules in Magento) [true/false]{cart.weight_unit}{cart.weight_for_charge}: weight of goods whose delivery is not offered (by cart pricing rules in Magento){quote.subtotal}: subtotal (excluding tax){quote.subtotal_with_discount}: subtotal (excluding tax) with discount{quote.grand_total}: total (including tax) with discount{quote.base_subtotal}: subtotal (excluding tax) in base currency{quote.base_subtotal_with_discount}: subtotal (excluding tax) with discount in base currency{quote.base_grand_total}: total (including tax) with discount in base currency{customer_group.id}: id of customer group{customer_group.code}: name of customer group{customer_group.*}: property of the customer group (ex: {customer_group.tax_class_id}){customer.id}: id of customer{customer.attribute.*}: attribute of the customer (ex: lastname, firstname, group_id…){customer.attribute.*.value}: in case of an attribute of type selection list, {customer.attribute.*} returns the id, to get the value, you have to use {customer.attribute.*.value}{customer.*}: same as {customer.attribute.*}, unless the variable is already defined (ex: {customer.id} is already defined){customvar.*}: custome variable defined in Magento (ex: {customvar.my_var}){shipto.country_name}{shipto.country_id}: the country code{shipto.region_id}{shipto.region_code}{shipto.street}{shipto.city}{shipto.postcode}{billto.country_name}{billto.country_id}: the country code{billto.postcode}{billto.*}: property of the billing address (ex: {billto.city}){origin.country_name}{origin.country_id}: the country code{origin.region_id}{origin.city}{origin.postcode}{store.id} {store.code} {store.name} {store.address} {store.phone}{date.timestamp}: UNIX timestamp of the current date{date.year} {date.month} {date.day} {date.hour} {date.minute} {date.second}{date.weekday}: day of the week for the current date from 0 (Sunday) to 6 (Saturday)request object:
{request.*}: property of the request object (Mage_Shipping_Model_Rate_Request) given by Magento (ex: {request.package_qty}). Use "Debug" option to get more details on available properties.The following variables can be used in special functions.
Unlike elsewhere, the following variables should not be surrounded by the characters { and }.
An item is a variation of a product to which some options have been added. Each item has a quantity.
item:
item.qty: quantity in the cartitem.price-tax+discount: price excluding tax with discountitem.price-tax-discount: price excluding tax without discountitem.price+tax+discount: price including tax with discountitem.price+tax-discount: price including tax without discountitem.option.*: option (the available options depend on the product)product:
product.attribute.*skunameweightprice (as defined in Magento backoffice)special_price: (as defined in Magento backoffice)product.attribute.*.value: value of the attributeproduct.attribute.* returns the id. To get the value, you have to use product.attribute.*.valueproduct.*: same as product.attribute.* unless the variable is already defined (ex: product.category)product.category: name of the categoryproduct.category.idproduct.category.*: attribute of the category (ex: product.category.is_active)is_activenameproduct.categories: array of name of the categoriesproduct.categories.id: array of id of the categoriesproduct.attribute_set: name of the attribute setproduct.attribute_set.idproduct.attribute_set.*: attribute of the attribute set (ex: product.attribute_set.attribute_set_name)product.stock.*: attribute of the product stockis_in_stockqty: quantity in stockforeach loopsThe following variables can be used in foreach loops.
{selection.weight}{selection.qty}: items count in the selectionWhen the selection is made on the sku, each selection consists of a single article. We can therefore use the item and product variables.
{item.*}: item property{product.*}: product property
Item and product variables are identical to variables that can be used in special functions with the only difference that they must be surrounded by the characters { and }.
abs(x): absolute valueceil(x): round upexp(x): exponentfloor(x): round downlog(x): logarithmlog(x, base): natural logarithmmax(x, y, …): maximum, null values ignoredmin(x, y, …): minimum, null values ignoredpi(): PI numberpow(x, puissance): powrand(min, max): random integerround(x)sqrt(x): square rootsubstr(string, start, length): returns a string segment.in_array(value, array(value1, value2, …)): returns true if the value is found in the array.array_match_any(array(value1, value2, …), array(value1, value2, …)): returns true if at least one value is found in both arrays.array_match_all(array(value1, value2, …), array(value1, value2, …)): returns true if both arrays are identical.range(value, min, max, include_min, include_max): returns true if value is greater than min and lower than max. By default, include_min and include_max are equal to true.{table … in …}: defining values based on thresholds (examples){switch … in …}: defining an associative table (examples)
The first parameter … of table and switch functions is the reference value, it can be either a variable or a formula.
{count items[ where …]}: counts eligible items (examples){count distinct …[ where …]}: counts all different values of a property for eligible items (examples){sum …[ where …]}: calculates the sum of the values of a property for eligible items (examples){min …[ where …]}: returns the minimum value of a property for eligible items (examples){max …[ where …]}: returns the maximum value of a property for eligible items (examples)
The first parameter … of count distinct, sum, min and max functions must be a property (ex: product.attribute.weight).
The condition where is optional. If specified, it will be in the form of a formula.
foreach loops
foreach loops can perform a calculation on groups of products rather than consider all the products in the cart.
The overall result of a foreach loop is the sum of the results of each pass through the loop.
Inside a foreach loop, you can use new variables.
The following variables must be replaced by their equivalent.
{cart.coupon} {cart.coupon_code}{cart.quantity} {cart.qty}{cart.price_excluding_tax} {cart.price-tax+discount}{cart.price_including_tax} {cart.price+tax+discount}{cart.weight.for-charge} {cart.weight_for_charge}{cart.weight.unit} {cart.weight_unit}{customer.group.code} {customer_group.code}{customer.group.id} {customer_group.id}{{customVar code=*}} {customvar.*}{destination.country.code} {shipto.country_id}{destination.country.name} {shipto.country_name}{destination.postcode} {shipto.postcode}{destination.region.code} {shipto.region_code}{free_shipping} {cart.free_shipping}{origin.country.code} {origin.country_id}{origin.country.name} {origin.country_name}{origin.region.code} {origin.region_id}{selection.quantity} {selection.qty}
The use of tracking_url property is reserved for experienced users. If you don't understand the instructions below, it is recommended that you avoid using this feature.
The tracking_url property overrides the field "Tracking URL" of an Advanced Shipping shipping mode. So you can specify a tracking URL foreach shipping method rather than one for all shipping mode.
To automatically insert the tracking number in the tracking URL, you must use {tracking_number}.
Magento does not support tracking links but tracking statuses. The extension Advanced Shipping provides an HTML link instead of the status, link allowing you to go on the carrier's website and follow the progress of the parcel.
When the tracking URL is built by the extension, the only information available is the tracking number and there was nowhere an access to the shipping method selected. In order to find the tracking URL in the configuration, you must specify the shipping method inside the tracking number, for example: colissimo:8Lxxxxxxxxxxx where colissimo is the code of the shipping method selected.
If no code is specified (if you enter only the tracking number), the URL used will be the one of the shipping mode.
To answer a recurrent question, Magento displays the tracking status from the back office or front office. If you want to insert the tracking URL in shipping mails, you need to develop yourself the retrieval of tracking URL and its incorporation in the mail, in fact, the Advanced Shipping extension simply provides customizable shipping methods without making big changes to Magento core to reduce incompatibility and update problems.
If you get a blank popup when you click on the tracking link, your problem is most likely related to the fact that you did not specify the code of the shipping method in the tracking number (see instructions above) and your global field "Tracking URL" is empty.
There are currently no plans to change this feature.
about: propertyenabledoriginbilltoshiptoaddress_filter: shortcuts, examplesswitchproduct.attribute.*cart: variablesaboutconditions: propertycount: special functionscount distinct: special functionscustomer: variablescustomer_group: variablescustomer_groups: propertycustomvar: variablesdata: element type, examplesdate: variablesenableddescription: propertyshiptoenabled: propertyitem: variablesitem.option.*: variableslabel: propertymax:
meta: element type, examplesmethod: element typemin:
product: variablesproduct.attribute.*: variablesproduct.categories: variables, examplesquote : variablesshiptorequest: variablesshipto:
store: variablessum: special functionsswitch: special functions, examplestable: special functions, exampleslabeltracking_url: property, more informationstype: property