new BackendCartComponent()

Description

DEPRECATED

This component has been deprecated. Use components in the frontend extensibility API, or SuiteScript 2.0 modules and methods instead.

Provides methods for working with multiple aspects of a cart, including lines, cart summary, estimates, promotions, and the submit action. It also exposes cancelable events that are triggered before and after changes to lines, estimates, promotions, and so on.

Details

Since SuiteCommerce 2020.1

Members


componentName :string

Description

A name that identifies the component. Use the name to register a new component and get a component implementation with BackendComponentContainer.

Details
string

Methods


addLine( data ) → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Adds a new line to the cart. Returns a Deferred object. If the promise is resolved, the line is added to the cart. If the promise is rejected, it returns an error.

Parameters
Name Type Description
data Object

A Line object.

Returns
Details

Since SuiteCommerce 2020.1


extend( componentDefinition ) → {BackendBaseComponent}

Description

Extends the current component and returns a child component.

Parameters
Name Type Description
componentDefinition Object

Any object that has properties and methods.


cancelableOn( event_name, handler ) → {void}

Description

Attaches an event handler to an event.

Parameters
Name Type Description
event_name String

The event name that the handler will be attached to.

handler function

The event handler (function) that will be invoked when event_name is triggered. The event handler can accept one optional callback parameter. The event handler can return a Deferred object, which if resolved, executes the callback function. If the promise is rejected, the callback function does not execute.

Returns

on( event_name, handler ) → {void}

Description

Attaches an event handler to an event name. Alias for BackendCancelableEvents#cancelableOn.

Parameters
Name Type Description
event_name string

The event name that the handler will be attached to.

handler function

The event handler (function) that will be invoked when event_name is triggered. The event handler can accept one optional callback parameter. The event handler can return a Deferred object, which if resolved, executes the callback function. If the promise is rejected, the callback function does not execute.

Returns
Details

addLineSync( data ) → {String}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

The synchronous version of addLine.

Parameters
Name Type Description
data Object
Returns
Details

Since SuiteCommerce 2020.1


off( event_name, handler ) → {void}

Description

Detaches an event handler from an event name. Alias for BackendCancelableEvents#cancelableOff.

Parameters
Name Type Description
event_name string

The event name that the handler will be detached from. Optional.

handler function

The event handler (function) that will be removed from the list of registered handlers.

Returns
Details

cancelableOff( event_name, handler ) → {void}

Description

Detaches an event handler from an event.

Parameters
Name Type Description
event_name String

The event name that the handler will be detached from. This argument is required.

handler function

The event handler (function) that will be removed from the list of registered handlers. This argument is required.

Returns

addLines( lines ) → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Adds multiple lines to the cart. Returns a Deferered object. If the object is resolved, the lines (as an array of strings) are added to the cart. If the object is rejected, it returns an error.

Parameters
Name Type Description
lines Object
Returns
Details

Since SuiteCommerce 2020.1


cancelableDisable( event_name ) → {void}

Description

Disables all event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event for which event handlers will be disabled.

Returns

addLinesSync( lines ) → {Array.<String>}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

The synchronous version of addLines.

Parameters
Name Type Description
lines Object
Returns

cancelableEnable( event_name ) → {Void}

Description

Re-enables all event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event for which event handlers will be re-enabled.

Returns

getLines() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Gets the lines in the cart and returns a Deferred object. If the promise is resolved, it returns an array of Line objects. If the promise is rejected, it returns an error.

Returns

cancelableTrigger( event_name, ...args ) → {Deferred}

Description

Triggers an event with one or more arguments. If any of the event handlers associated with the event are rejected, callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

Any arguments to be passed to all event handlers attached to the event.

Returns

Returns a Deferred object. Because event handlers are sometimes asynchronous, any callbacks in the event handlers will also be asynchronous.


getLinesSync() → {Array.<Line>}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getLines.

Returns

cancelableTriggerUnsafe( event_name, ...args ) → {Deferred}

Description

Triggers an event with one or more unsanitized arguments. If any of the event handlers associated with the event are rejected, callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

Any arguments to be passed to all event handlers attached to the event.

Returns

Returns a Deferred object. Because event handlers are sometimes asynchronous, any callbacks in the event handlers will also be asynchronous.


removeLine( internalid ) → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Removes a line from the cart. Returns a Deferred that is resolved in the case the operation was done successfully or rejected with an error message.

Parameters
Name Type Description
internalid String

id of the line to remove

Returns

removeLineSync() → {undefined|string}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#removeLine.

Returns

returns undefined if successful or an error message if an errors occurs.


updateLine( line ) → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Updates a cart's line. Returns a Deferred that is resolved with Line in the case the operation was done successfully,
or rejected with an error message.

Parameters
Name Type Description
line Line
Returns

updateLineSync( line ) → {Line|string}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#updateLine.

Parameters
Name Type Description
line Object
Returns

getSummary() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the summary of the cart as a Deferred that is resolved with a Summary in the case the operation was done successfully or
rejected with an error message.

Returns

getSummarySync() → {Summary}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getSummary.

Returns

submit() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Submits the order. Returns a Deferred that is resolved with a ConfirmationSubmit object in the case
the operation was done successfully, or rejected with an error message.

Returns

submitSync() → {ConfirmationSubmit}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#submitSync.

Returns

addPayment()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Adds a payment method


addPaymentSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#addPayment.


getPaymentMethods() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the payment methods added to the order

Returns

Return a jQuery Deferred that is resolved with an array of PaymentMethod
in the case the operation was done successfully or the promise is rejected with an error message.


getPaymentMethodsSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#addPayment.


addPromotion( the )

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Adds a promotion

Parameters
Name Type Description
the Object

promocode to add


addPromotionSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#addPromotion.


removePromotion( data ) → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Removes a promotion.

Parameters
Name Type Description
data Object
Returns

removePromotionSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#removePromotion.


getPromotions() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the promotion codes added to the cart.

Returns

Returns a Deferred that is resolved with an array of Promotion in the case the
operation was done successfully or rejected with an error message.


getPromotionsSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getPromotions.


estimateShipping( locationData )

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the estimated shipping costs.

Parameters
Name Type Description
locationData Object

estimateShippingSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#estimateShipping.


removeShipping()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Removes the shipping method


removeShippingSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#removeShipping.


clearEstimateShipping()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Clears the shopping estimations in the cart.


clearEstimateShippingSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#clearEstimateShipping.


getAddresses() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the addresses of the order.

Returns

Return a jQuery Deferred that is resolved with an array of Address in the case the operation
was done successfully or the promise is rejected with an error message.


getAddressesSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getAddresses.


getShipAddress() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the shipping address of the order.

Returns

Return a jQuery Deferred that is resolved with an Address in the case the operation
was done successfully or the promise is rejected with an error message.


getShipAddressSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getShipAddress.


getBillAddress() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the billing address of the order

Returns

Return a jQuery Deferred that is resolved with an Address in the case the operation
was done successfully or the promise is rejected with an error message.


getBillAddressSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getBillAddress.


getShipMethods() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the ship methods of the order.

Returns

Return a jQuery Deferred that is resolved with an array of ShipMethod in the case the operation
was done successfully or the promise is rejected with an error message.


getShipMethodsSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getShipMethods.


getShipMethod() → {Deferred}

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Returns the selected shipping method of the order.

Returns

Return a jQuery Deferred that is resolved with an array of ShipMethod in the case the operation
was done successfully or the promise is rejected with an error message.


getShipMethodSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#getShipMethod.


voidLine()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Voids a line. Implemented only for SCIS.


voidLineSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#voidLine.


unvoidLine()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Unvoids a line. Implemented only for SCIS.


unvoidLineSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#unvoidLine.


updateCustomer()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Updates a customer data. Implemented only for SCIS.


updateCustomerSync()

Description

This method has been deprecated. Use methods in the frontend extensibility API, or SuiteScript 2.0 methods instead.

Synchronous version of BackendCartComponent#updateCustomer.

Events


beforeUpdateLine

Description

Cancelable event triggered before a cart's line is updated. See BackendCancelableEvents

Properties
Type Description
boolean

afterUpdateLine

Description

Triggered after a cart's line is updated See

Properties
Type Description
boolean

beforeRemoveLine

Description

Cancelable event triggered before a cart's line is removed. See BackendCancelableEvents

Properties
Type Description
boolean

afterRemoveLine

Description

Triggered after a cart's line is removed

Properties
Type Description
boolean

beforeEstimateShipping

Description

Cancelable event triggered before doing an estimate shipping in the cart. See BackendCancelableEvents

Properties
Type Description
boolean

afterEstimateShipping

Description

Triggered after an estimate shipping is done in the cart

Properties
Type Description
boolean

beforeClearEstimateShipping

Description

Cancelable event triggered before clearing an estimate shipping in the cart. See BackendCancelableEvents

Properties
Type Description
boolean

afterClearEstimateShipping

Description

Triggered after an estimate shipping is cleared in the cart

Properties
Type Description
boolean

beforeAddPromotion

Description

Triggered before a promotion is added to the cart. See BackendCancelableEvents

Properties
Type Description
boolean

afterAddPromotion

Description

Triggered before a promotion is added to the cart

Properties
Type Description
boolean

beforeRemovePromotion

Description

Triggered before a promocode is removed from the cart. See BackendCancelableEvents

Properties
Type Description
boolean

afterRemovePromotion

Description

Triggered after a promocode is removed from the cart

Properties
Type Description
boolean

beforeAddPayment

Description

Triggered before a payment method is added to the order. See BackendCancelableEvents

Properties
Type Description
boolean

afterAddPayment

Description

Triggered after a payment method is added to the order

Properties
Type Description
boolean

beforeSubmit

Description

Triggered before the order is submitted. See BackendCancelableEvents

Properties
Type Description
boolean

afterSubmit

Description

Triggered after the order is submitted

Properties
Type Description
boolean

beforeAddLine

Description

Cancelable event triggered before adding a new cart's line. See BackendCancelableEvents

Properties
Type Description
boolean

afterAddLine

Description

Triggered after a new line is added in the cart

Properties
Type Description
boolean