new MyAccountMenu()

Description

The MyAccountMenu component lets you add menu groups and menu items to the main menu on the My Account page of a SuiteCommerce webstore.

You can specify the order in which items appear in the menu by specifying a number in the index property. Menu groups or menu items with lower index numbers appear higher in the menu. If two or more items have the same index number, the position of the items will be indeterminate.

It is not possible to remove menu groups or menu items from the My Account menu.

Get an instance of this component by calling container.getComponent("MyAccountMenu");

Note: This component adds and displays new items in the main menu on the My Account page only. It does not display those new items in the header menu.

Details

SuiteCommerce 2019.1

Members


componentName :String

Description

A unique name that identifies the component. Use the component name when getting a component, for example, application.getComponent(componentName).

Details
String

application :ComponentContainer

Description

The name which identify this kind of component. This name is used both for registering a new component and
getting a component implementation with ComponentContainer

Methods


extend( componentDefinition ) → {BaseComponent}

Description

Extends the current component and creates a child component.

Parameters
Name Type Description
componentDefinition Object

An object with the appropriate properties and methods to create the component.

Returns
Details

on( event_name, handler ) → {void}

Description

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

Parameters
Name Type Description
event_name String

The name of the event to attach to

handler function
Returns
Details

off( event_name, handler ) → {void}

Description

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

Parameters
Name Type Description
event_name String

The name of the event from which to detach the event handler.

handler function
Returns
Details

cancelableOn( event_name, handler ) → {void}

Description

Attaches an event handler to an event.

Parameters
Name Type Description
event_name String

The name of the event to which the event handler will be attached.

handler function

The event handler method that will be invoked when event_name is triggered. This function can receive optionally one parameter representing the action parameter. Besides optionally can return a Deferred to details the execution of the trigger's callback. If the returned Deferred is rejected the trigger's callback wont be called

Returns

cancelableOff( event_name, handler ) → {void}

Description

Detaches an event handler from an event.

Parameters
Name Type Description
event_name String

The name of the event from which to detach the event handler. This argument is required.

handler function

The event handler that will be removed from the list of handlers attached to the event. This argument is required.

Returns

cancelableDisable( event_name ) → {void}

Description

Disables all the event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event.

Returns

cancelableEnable( event_name ) → {Void}

Description

Re-enables all the event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event.

Returns

addGroup( MyAccountMenuGroup ) → {Deferred}

Description

Adds a menu group to the menu on the My Account page. A menu group is a top-level item in the My Account menu that may contain one or more subitems.

In the following example, a menu group is added to the My Account menu. The menu group will be displayed as the second menu group in the menu, it has the name Preorders, and it requires either of two permissions to be viewed by the logged in user. The menu group has the ID preorders. Use the ID to add menu items to the menu group.

var myaccountmenu = container.getComponent("MyAccountMenu");
			var preordersmenugroup = {
			     id: "preorders",
			     name: "Preorders",
			     index: 2,
			     permissionoperator: "OR",
			     permission: [
			         {
			             group: "transactions",
			             id: "tranSalesOrd",
			             level: "1"
			         },
			         {
			             group: "transactions",
			             id: "tranEstimate",
			             level: "1"
			         }
			     ] 
			}
			
			myaccountmenu.addGroup(preordersmenugroup);
			
Parameters
Name Type Description
MyAccountMenuGroup MyAccountMenuGroup

An object representing the menu group you want to add to the My Account menu.

Returns

Returns a Deferred object.


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

Description

Triggers an event with a set of arguments. If an event handler is rejected, the event handler callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

One or more arguments that will be broadcast 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.


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

Description

Triggers an event with a set of unsanitized arguments. If an event handler is rejected, the event handler callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

One or more arguments that will be broadcast 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.


addGroupEntry( MyAccountMenuGroupEntry ) → {Deferred}

Description

Adds a menu item to a menu group on the My Account page.

In the following example, a menu item is added as the first subitem of the menu group with the id preorders. The menu item points to a landing page called preorders-view. To view the menu item, the user must have either of the two permissions specified in the permission property.

     var myaccountmenu = container.getComponent("MyAccountMenu");
			var preordersviewall = {
			 id: "preordersviewall",
			 groupid: "preorders",
			 name: "View All",
			 index: 1,
			 url: "preorders-view",
			 permissionoperator: "OR",
			 permission: [
			     {
			         group: "transactions",
			         id: "tranSalesOrd",
			         level: "1"
			     },
			     {
			         group: "transactions",
			         id: "tranEstimate",
			         level: "1"
			     }
			 ]
			}
			
			myaccountmenu.addGroupEntry(preordersviewall);
			
Parameters
Name Type Description
MyAccountMenuGroupEntry MyAccountMenuGroupEntry
Returns

Returns a Deferred object.