menu

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

Controller for creating, modifying, and showing a product comparison.

Source:

Members

(static) AddProduct

Adds a product to a comparison.

Source:
See:

(static) Controls

Renders the product comparison widget.

Source:
See:

(static) RemoveProduct

Source:
See:

(static) Show

Creates a product comparison.

Source:
See:

Methods

(inner) addProduct() → {object}

Adds a product to a comparison. Gets the product and category from the httpParameterMap pid and category. If there is no product or category, the function renders a JSON message indicating failure. If both are available, gets the comparison object and adds the product. If successful, renders a JSON message indicating success.

Source:
Returns:

JSON object indicating success or failure.

Type
object

(inner) controls()

Renders the controls for the comparison, including the product images, Compare Items button, and Clear All button. Gets the category from the httpParameterMap category value. If there is no category, renders the search/components/productcomparewidget template. Gets the comparison object and renders the search/components/productcomparewidget template.

Source:

(inner) removeProduct() → {object}

Removes a product from a comparison. Gets the product and category from the httpParameterMap pid and category. If there is no product or category, the function renders a JSON message indicating failure. If both are available, gets the comparison object and removes the product. If successful, renders a JSON message indicating success.

Source:
Returns:

JSON object indicating success or failure.

Type
object

(inner) show()

Gets a compare form and gets or creates a comparison object associated with the session. Renders the product/compare/compareshow template.

Source: