HomeWiki
HomeWiki
  1. Shopping Lists
  • Back to home
  • 1. Themes
  • Layout
    • New Layout
    • Legacy Layout
  • Components
    • Announcement
    • Banner Carousel
    • Banner With Products Carousel
    • Blog Category List
    • Blog List
    • Brand List
    • Brands Carousel
    • Breadcrumb
    • Call To Action
    • Cart
    • Categories List
    • Change Password
    • Checkout
    • Cookie Manager
    • Filter list
    • Footer
    • Forgot Password
    • Form
    • Hero Carousel
    • Icon Block
    • Invitation
    • Last Visited Products
    • Layout
    • Login
    • Map
    • Nav Bar
    • Offer
    • Product Attachments
    • Product Attributes
    • Product Documentation
    • Product Expected
    • Product Modal
    • Products Block
    • Products Carousel
    • Product Single
    • Profile
    • Quote
    • Register
    • Related Products
    • Search
    • Stores
    • Subscribe Newsletter
    • Text with Image
    • Top Bar
    • Video
  • Reusables
    • Getting Started
  • Assets
    • Getting Started
  • SDK
    • Products
      • _findProductsByCategory
      • _findProductsByIds
      • _findProductsByTitle
      • _findProductsByFilter
      • _findProductsByCriteria
      • _findProductsAndCalculate
      • _findProductsThenCalculate
      • _getProductAttributeSet
      • _setLastVisited
    • Categories
      • _findCategoryTreeById
      • _findCategoriesByIds
      • _findCategoryByAlias
      • _findCategoryTreeByAlias
      • _getCategoryContent
    • Collections
      • _getCollectionContent
      • _findCollectionsByIds
      • _findCollectionsByIdsThenCalculate
    • Brands
      • _getBrandContent
      • _findBrandsByIds
    • Cart
      • _addToCartMulti
      • _addToCart
      • _setCart
      • _clearCart
      • _setCartListener
      • _removeFromCart
      • _calculateCart
    • Checkout
      • _startCheckout
      • _updateCheckout
      • _completeCheckout
    • Shopping Lists
      • _getShoppingLists
      • _updateShoppingList
      • _createShoppingList
      • _deleteShoppingList
      • _getShoppingListByAlias
    • Navigation
      • _getFooterMenu
      • _getHeaderMenu
    • Users
      • _getUserById
    • Utils
      • _calculateCurrency
      • _getCurrencySymbol
      • _getCulture
      • _subscribeToNewsletter
      • _findUnitsByIds
  • Vs Code
    • Getting Started
  1. Shopping Lists

_getShoppingListByAlias

Example Usage of _getShoppingListByAlias Method#

The _getShoppingListByAlias method retrieves a specific shopping list based on its unique identifier (alias). It performs a GET request to the server and processes the response using a callback function.

Purpose#

To fetch a shopping list from the server using its alias and handle the result through a callback function.

Method Signature#

Parameters#

alias (String): The unique identifier (alias) of the shopping list to retrieve.
Example:
callback (Function): A function to be executed with the retrieved shopping list data once the request completes.

Usage Steps#

1.
Define a Callback Function:
Create a function that will handle the retrieved shopping list data. This function will be called with the list as its argument.
2.
Prepare the Alias:
Obtain or define the alias of the shopping list you want to retrieve.
3.
Invoke the Method:
Call _getShoppingListByAlias with the alias and the callback function.

Detailed Breakdown#

Get Request: Sends a GET request to /api/ShoppingList/${alias} where ${alias} is the identifier of the shopping list to be retrieved.
Callback Execution: Calls the provided callback function with the retrieved shopping list data. This allows you to handle the result, such as updating the UI.

Example#

Here's an example of using the _getShoppingListByAlias method in your application:

Common Use Cases#

Viewing Details: Useful for scenarios where users need to view the details of a specific shopping list.
UI Display: Helps in updating parts of the UI with the retrieved shopping list data.
Data Management: Ensures that you have the latest data for a specific shopping list available for user interaction.

Notes#

Alias Validation: Ensure that the alias is correct and exists on the server to avoid errors.
Error Handling: While this example does not include error handling, consider adding it to manage scenarios where the request might fail (e.g., network issues, server errors).
By following this documentation, you can effectively use the _getShoppingListByAlias method to retrieve shopping lists from your application and handle the results appropriately.
Previous
_deleteShoppingList
Next
_getFooterMenu
Built with