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

_getShoppingLists

Example Usage of _getShoppingLists Method#

The _getShoppingLists method is used to retrieve all shopping lists from the server and process them through a callback function. It also emits an event with the retrieved data.

Purpose#

To fetch all shopping lists from the server and handle them via a callback function while notifying other parts of the application of the new data.

Method Signature#

Parameters#

callback (Function): A function to be executed with the shopping lists data once the data is successfully retrieved.

Usage Steps#

1.
Define a Callback Function:
Create a function that will process the shopping lists data. This function will be called with the shopping lists data as its argument.
2.
Invoke the Method:
Call _getShoppingLists and pass your callback function to it. This will initiate the data retrieval and processing.

Detailed Breakdown#

Data Retrieval: Sends a GET request to /api/ShoppingList to fetch the shopping lists.
Event Emission: Emits a view-all-wishlist event with the shopping lists data. This event can be used to update the UI or notify other components of the data change.
Callback Execution: Calls the provided callback function with the retrieved shopping lists data.

Example#

Here's how you might use the _getShoppingLists method in your application:

Common Use Cases#

Displaying Shopping Lists: Useful for rendering a list of shopping lists in a user interface.
Updating UI Components: Helps in updating parts of the UI that are interested in the shopping lists data.
Data Synchronization: Ensures that different parts of the application are synchronized with the latest shopping lists data.

Notes#

Event Subscription: Make sure that your application has handlers for the view-all-wishlist event if you're using it to trigger UI updates.
Error Handling: Consider adding error handling to manage scenarios where the data retrieval fails (though this example does not include error handling).
By following this documentation, you will be able to use the _getShoppingLists method to effectively retrieve and manage shopping lists in your application.
Previous
_completeCheckout
Next
_updateShoppingList
Built with