menu

SiteGenesis / Server-side JS / Module: controllers/Address

Controller that provides functions for editing, adding, and removing addresses in a customer addressbook. It also sets the default address in the addressbook.

Source:

Members

(static) Add

Renders a dialog for adding a new address to the address book.

Source:
See:

(static) Delete

Deletes an existing address.

Source:
See:

(static) Edit

Renders a dialog for editing an existing address.

Source:
See:

(static) Form

The address form handler.

Source:
See:

(static) GetAddressDetails

Sets the default address.

Source:
See:

(static) List

Lists addresses in the customer profile.

Source:
See:

(static) SetDefault

Sets the default address for the customer address book.

Source:
See:

Methods

(inner) add()

Clears the profile form and renders the addressdetails template.

Source:

(inner) Delete()

Removes an address based on the Address ID in the httpParameterMap. If the httpParameterMap format value is set to ajax, redirects to the Address-List controller function. Otherwise, renders an error message.

Source:

(inner) edit()

Clears the profile form and gets the addressBook for the current customer. Copies address information from the stored customer profile into the profile form. Renders the addressdetails form and passes the address information to the template.

Source:

(inner) getAddressDetails()

Gets the addressBook for the current customer Returns a customer address as a JSON response by rendering the addressjson template. Required to fill address form with selected address from address book.

Source:

(inner) handleForm()

Gets an AddressModel object. Gets the customeraddress form. Handles the address form actions:

  • cancel and error - if the HTTPParameterMap format value is ajax, returns an error message, otherwise redirects to the Address-List controller function.
  • create - if the address is valid, creates the address. If address creation fails, redirects to the Address-Add controller.
  • edit - if the address is valid, updates the address. If the address is invalid or the update fails, displays an error message.
  • remove - removes the address. If the address removal fails, displays an error message.
Source:

(inner) list()

Gets a ContentModel that wraps the myaccount-addresses content asset. Updates the page metadata and renders the addresslist template.

Source:

(inner) setDefault()

Gets the addressBook for the current customer. Gets an address from the addressBook based on the Address ID in the httpParameterMap. Sets the default address. Redirects to the Address-List controller function.

Source: