Members
-
CART_VIEW :String
-
Description
Name of the cart main view. Please use this name to reference views in methods like addChildView, addToViewContextDefinition, etc
-
CART_MINI_VIEW :String
-
Description
Name of the mini-cart main. Please use this name to reference views in methods like addChildView, addToViewContextDefinition, etc
-
WIZARD_VIEW :String
-
Methods
-
addLine( data ) → {Deferred}
-
Description
Adds a line to the cart.
container.getComponent('Cart').addLine({ line: { quantity: 1, item: { internalid: 8058 } } }).then(function() {alert(Utils.translate('Item added.'))});Parameters
Name Type Description dataAddLine Returns
-
addLines( lines ) → {Deferred}
-
Description
Adds multiple lines to the cart.
Parameters
Name Type Description linesAddLines Returns
-
getLines() → {Deferred.<Array.<Line>>}
-
Description
Gets the lines in the cart.
Returns
-
removeLine( internalid ) → {Deferred}
-
Description
Removes a line from the cart. Returns a Deferred object in the resolved state if it was successful, or the rejected state if it failed.
Parameters
Name Type Description internalidString The ID of the line to remove.
Returns
-
updateLine( line ) → {Deferred}
-
getSummary() → {Deferred}
-
Description
Gets a summary of the cart.
Returns
-
submit() → {Deferred}
-
Description
Submits the order.
var cart = container.getComponent("Cart"); cart.submit();Returns
-
addPayment( data )
-
Description
Adds a payment method.
Parameters
Name Type Description dataPaymentMethod -
getPaymentMethods() → {Deferred}
-
Description
Gets the payment methods on the order.
Returns
-
addPromotion( The )
-
Description
Applies a promotion to the cart.
Parameters
Name Type Description TheObject promotion code (promocode) of the promotion.
-
removePromotion( data ) → {Deferred}
-
Description
Removes a promotion from the cart.
Parameters
Name Type Description dataObject Returns
-
getPromotions() → {Deferred}
-
Description
Gets the promotions (promotion codes) in the cart.
Returns
-
estimateShipping( locationData )
-
Description
Gets the estimated shipping costs.
Parameters
Name Type Description locationDataObject The postcode and country.
-
removeShipping()
-
Description
Removes the shipping method from the order.
-
clearEstimateShipping()
-
Description
Clears the shipping estimation from the order.
-
getAddresses() → {Deferred}
-
Description
Gets all addresses of the order.
Returns
-
getShipAddress() → {Deferred}
-
Description
Gets the shipping address of the order.
Returns
-
getBillAddress() → {Deferred}
-
Description
Gets the billing address of the order.
Returns
-
getShipMethods() → {Deferred}
-
Description
Gets the shipping methods of the order.
Returns
-
getShipMethod() → {Deferred}
-
Description
Returns the selected shipping method of the order
Returns
-
setChildViewIndex( view_id, placeholder_selector, view_name, index ) → {void}
-
Description
Changes the position of a child view inside a container.
Parameters
Name Type Description view_idstring The identifier of the view of the current component that contains the child view whose position will be changed.
placeholder_selectorstring The identifier of a location in the specified view (view_id) where the child view will be added.
view_namestring The identifier of a view in the placeholder.
indexnumber The index of the child view's position.
Returns
Throws
Details
-
addChildViews( view_id, child_views ) → {void}
-
Description
Adds one or more child views to an existing view. The existing view must already be in the DOM and must have the 'data-view' HTML attribute.
The addChildViews method is flexible, but more complex than addChildView. Use the simpler addChildView where possible.
EXAMPLE
checkout.addChildViews( checkout.WIZARD_VIEW , { 'Wizard.StepNavigation': { 'CheckoutView': { childViewIndex: 1 , childViewConstructor: function () { return new CheckoutExtensionView({checkout:checkout}); } } } } );Parameters
Name Type Description view_idstring The identifier of the view of the current component to which the child views will be added.
child_viewsobject Returns
Throws
Details
-
addChildView( view_id, childViewConstuctor ) → {void}
-
Description
Adds a child view to an existing View which is already appended in the DOM with the given
data-viewHTML attribute.EXAMPLE
checkout.addChildView('Wizard.StepNavigation', function () { return new CheckoutExtensionView({checkout:checkout}); });Parameters
Name Type Description view_idstring The identifier of the view of the current component to which the child view will be added.
childViewConstuctorSimpleChildViewConstructor The identifier of the location in the specified view (view_id) where the child view will be added.
Returns
Throws
Details
-
removeChildView( view_id, placeholder_selector [, view_name ] ) → {void}
-
Description
Removes a child view from a view.
Parameters
Name Type Attributes Description view_idstring The identifier of the view of the current component from which the child view will be removed.
placeholder_selectorstring The identifier of the location in the specified view (view_id) from which the child view will be removed.
view_namestring <optional> The identifier of the view to be removed.
Returns
Throws
Details
-
addToViewContextDefinition( view_id, property_name, type, callback ) → {void}
-
Description
Adds a property to the UI context of a view to extend interaction with its template.
Parameters
Name Type Description view_idstring The identifier of the view of the current component to which the context property will be added.
property_namestring The name of the property.
typestring The type of the property. The value returned by the callback function must be of the same type.
callbackfunction A function that sets the value of the property (property_name).
Returns
Throws
Details
-
removeToViewContextDefinition( view_id, property_name ) → {void}
-
Description
Removes a property from the UI context of a view.
Parameters
Name Type Description view_idstring The identifier of the view of the current component from which the context property will be removed.
property_namestring The name of the property.
Returns
Throws
Details
-
addToViewEventsDefinition( view_id, event_selector, callback ) → {void}
-
Description
Adds an event handler to an event in a view.
Parameters
Name Type Description view_idstring The identifier of the view of the current component to which the event handler will be added.
event_selectorstring callbackfunction The event handler function to call when the specified event occurs.
Returns
Throws
Details
-
removeToViewEventsDefinition( view_id, event_selector ) → {void}
-
Description
Removes an event handler from an event in a view.
Parameters
Name Type Description view_idstring The identifier of the view of the current component to which the event handler will be added.
event_selectorstring Returns
Throws
Details
Events
-
beforeUpdateLine
-
Description
Cancelable event triggered before a line in the cart is updated. See CancelableEvents.
-
afterUpdateLine
-
Description
Event triggered after a line in the cart is updated.
Properties
Type Description boolean -
beforeRemoveLine
-
Description
Cancelable event triggered before a line in the cart is removed. See CancelableEvents.
Properties
Type Description boolean -
afterRemoveLine
-
Description
Event triggered after a line in the cart is removed.
Properties
Type Description boolean -
beforeEstimateShipping
-
Description
Cancelable event triggered before getting shipping esimates for the cart. See CancelableEvents.
Properties
Type Description boolean -
afterEstimateShipping
-
Description
Event triggered after shipping estimates retrieved.
Properties
Type Description boolean -
beforeClearEstimateShipping
-
Description
Cancelable event triggered before clearing shipping estimates for the cart. See CancelableEvents.
Properties
Type Description boolean -
afterClearEstimateShipping
-
Description
Event triggered after shipping estimates are cleared.
Properties
Type Description boolean -
beforeAddPromotion
-
Description
Cancelable event triggered before a promotion is applied to the cart. See CancelableEvents.
Properties
Type Description boolean -
afterAddPromotion
-
Description
Event triggered after a promotion is applied to the cart.
Properties
Type Description boolean -
beforeRemovePromotion
-
Description
Cancelable event triggered before a promotion is removed from the cart. See CancelableEvents.
Properties
Type Description boolean -
afterRemovePromotion
-
Description
Event triggered after a promotion is removed fromt the cart.
Properties
Type Description boolean -
beforeAddPayment
-
Description
Cancelable event triggered before a payment method is added to the order. See CancelableEvents.
Properties
Type Description boolean -
afterAddPayment
-
Description
Event triggered after a payment method is added to the order.
Properties
Type Description boolean -
beforeSubmit
-
Description
Cancelable event triggered before the order is submitted. See CancelableEvents.
Properties
Type Description boolean -
afterSubmit
-
Description
Event triggered after the order is submitted.
Properties
Type Description boolean -
beforeAddLine
-
Description
Cancelable event triggered before a line is added to the cart. See CancelableEvents.
Properties
Type Description boolean -
afterAddLine
-
Description
Event triggered after a line is added to the cart.
Properties
Type Description boolean