You can use the following attributes from the Order object in your costing scripts:
Method | Type | Description |
---|---|---|
Product name |
||
order.productName | string | The product name (for example, Document (Metric)). |
Delivery options |
||
order.deliveryOption.cost | string | The cost of the delivery option selected by the customer. |
order.deliveryOption.name | string | The name of the delivery option selected by the customer (for example, Courier Delivery) |
order.deliveryOption.detailsLabel | string | The label for the text field under Delivery & Instructions (for example, Address). |
Order dates |
||
order.created | date | The date the order was created. |
order.due | date | The due date selected by the customer. |
Copies |
||
order.copies.quantity | number | The number of copies requested by the customer. |
Color mode |
||
order.color.enabled | boolean | Returns true if color is selected, and false if grayscale is selected |
Pages |
||
order.pages.grayscalePages | number | The number of grayscale pages in the document(s). |
order.pages.colorPages | number | The number of color pages in the document(s). |
Single or double sided |
||
order.printOnBothSides.enabled | boolean | Returns true if double sided is selected, and false if single sided is selected |
Paper stock |
||
order.paperStock.cost | decimal | The cost of the Paper Stock option selected by the customer. |
order.paperStock.size | string | The Paper Size selected by the customer (for example, A3). |
order.paperStock.color | string | The Paper Color selected by the customer (for example, White). |
order.paperStock.type | string | The Paper Type selected by the customer (for example, 80gsm). |
Collating |
||
order.collating.name | string | The name of the Collating option selected by the customer (for example, Collated). |
Front Cover |
||
order.frontCover.cost | decimal | The cost of the Front Cover option selected by the customer. |
order.frontCover.name | string | The name of the Front Cover option selected by the customer, for example, Black Leathercraft). |
order.frontCover.printOnCover | string | The name of the Print on Cover option selected by the customer (for example, First page as cover) . Valid only if the printable attribute for the front cover option is set to true in the JSON configuration file. |
Back Cover |
||
order.backCover.cost | decimal | The cost of the Back Cover option selected by the customer. |
order.backCover.name | string | The name of the Back Cover option selected by the customer, for example, Black Leathercraft). |
Binding |
||
order.binding.cost | decimal | The cost of the Binding option selected by the customer (for example, the cost for Tape Binding, Velo Binding, or Stapling). |
order.binding.name | string | The name of the Binding option selected by the customer (for example, Stapling). |
Binding option sub-attributes |
||
order.binding.attributes.length | number | Checks the number of elements in a collection. You can use this in For Loops to determine whether or not a sub-attribute has any options. For more information, see
Cost calculation functions (For Loop)
. |
order.binding.attributes[X ].name |
string | The name of a Binding option’s sub-attribute. Sub-attributes are the Binding option specific fields that are displayed on the New Order form when a customer selects a particular Binding option. This is a zero-based index, in order of how the sub-attributes are listed in the product’s JSON config file, where X represents the position in the collection. For example, if a customer selects Comb Binding as the Binding option, additional fields such as Binding Edge and Color are displayed. These are the sub-attributes. For example, order.binding.attributes [0].description.option.name would return the first Binding Edge option. |
Binding option sub-attribute options |
||
order.binding.attributes[X ].option.cost |
decimal | The cost of the Binding option’s sub-attribute value selected by the customer. Sub-attributes are the Binding option specific fields that are displayed on the New Order form when a customer selects a particular Binding option. This is a zero-based index, in order of how the sub-attributes are listed in the product’s JSON config file, where X represents the position in the collection. For example, if a customer selects Comb Binding as the Binding option, additional fields such as Binding Edge and Color are displayed. These are the sub-attributes. For example, order.binding.attributes [0].option.cost would return the cost of the option selected by the customer (such as Long) for the first Binding sub-attribute. |
order.binding.attributes[ X].option.name |
string | The name of the Binding option’s sub-attribute value selected by the customer. Sub-attributes are the Binding option specific fields that are displayed on the New Order form when a customer selects a particular Binding option. This is a zero-based index, in order of how the sub-attributes are listed in the product’s JSON config file, where X represents the position in the collection. For example, if a customer selects Comb Binding as the Binding option, additional fields such as Binding Edge and Color are displayed. These are the sub-attributes. For example, order.binding.attributes [0].option.name would return the name of the option selected by the customer (such as Long) for the first Binding sub-attribute. |
Cutting |
||
order.cutting.cost | decimal | The cost of the Cutting option selected by the customer. |
order.cutting.name | string | The name of the Cutting option selected by the customer (for example, Half horizontal). |
Hole punching |
||
order.holePunching.cost | decimal | The cost of the Hole punching option selected by the customer. |
order.holePunching.name | string | The name of the Hole punching option selected by the customer (for example, 2 hole punch top). |
Folding |
||
order.folding.cost | decimal | The cost of the Folding option selected by the customer. |
order.folding.name | string | The name of the Folding option selected by the customer (for example, Tri-fold). |
Packaging |
||
order.packaging.cost | decimal | The cost of the Packaging option selected by the customer. |
order.packaging.name | string | The name of the Packaging option selected by the customer (for example, Shrink wrap in sets). |
order.packaging.itemsPerSet | number | The number of items per set selected by the customer. Valid only if the showItemsPerSet attribute for the packaging is set to true in the JSON configuration file. |
Laminating |
||
order.laminating.cost | decimal | The cost of the Laminating option selected by the customer. |
order.laminating.name | string | The name of the Laminating option selected by the customer (for example, Glossy with no border). |
Proof Required |
||
order.proofRequired.cost | decimal | Returns the cost of the selected proof required option |
order.proofRequired.name | string | The name of the Proof Required option selected by the customer (for example, Hard copy proof via pick-up). |
Material |
||
order.material.cost | string | The cost of the Material option selected by the customer. |
order.material.name | string | The name of the Material option selected by the customer (for example, PLA). |
Material color options |
||
order.material.color.cost | decimal | The cost of the Material color selected by the customer. |
order.material.color.name | string | The name of the Material color selected by the customer (for example, Blue). |
order.material.color.value | string | The hex color value of the Material color selected by the customer (for example, #0000ff). |
Custom text fields |
||
order.custom.fields.length | number | Checks the number of elements in a collection. You can use this in For Loops to determine whether or not a custom field has any options. For more information, see
Cost calculation functions (For Loop)
. |
order.custom.fields[ X].name |
string | The name of a Custom field label (for example. Thesis Title). This is a zero-based index, in order of how the fields are listed in the product’s JSON config file, where X represents the position in the collection. For example, order.custom.fields [0].name would return the first custom field. |
order.custom.fields[ X].value |
string | (Custom text fields only) The text entered by the customer in a Custom text field label (for example. Running Head: Pricing and Microfinance). This is a zero-based index, in order of how the fields are listed in the product’s JSON config file, where X represents the position in the collection. For example, order.custom.fields [0].value would return the customers entry in the first custom field. |
Custom drop-down list options |
||
order.custom.fields[ X].option.cost |
decimal | (Custom drop-down lists only) The cost for the option selected by the customer from a custom drop-down list. This is a zero-based index, in order of how the fields are listed in the product’s JSON config file, where X represents the position in the collection. For example, order.custom.fields [2].cost would return the cost of the option selected by the customer for the third custom field. |
order.custom.fields[X].option.name | string | (Custom drop-down lists only) The name of the option selected by the customer from a custom drop-down list (for example, Thesis Title). This is a zero-based index, in order of how the fields are listed in the product’s JSON config file, where X represents the position in the collection. For example, order.custom.fields [0].name would return the option selected by the customer for the first custom field. |
Comments