HomeWiki
HomeWiki
  1. Categories
  • 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. Categories

_getCategoryContent

Example Usage of _getCategoryContent Method#

The _getCategoryContent method is used to retrieve detailed content or information for a specific category based on its ID. This method leverages an internal function to fetch content that is specific to the category type.

Overview#

The _getCategoryContent method provides a way to access detailed content related to a category within your application. By using this method, you can easily fetch and handle category-specific content, which can be useful for displaying detailed information about a category or its associated data.

Method Signature#

Parameters#

categoryId (Number/String): The unique identifier of the category for which content is to be retrieved.
callback (Function): A function that will be called with the retrieved category content.

How to Use#

1.
Define the Category ID: Identify the category for which you want to retrieve content by providing its unique ID.
2.
Define a Callback Function: Create a function that will handle the content once it is retrieved. This function will process the category content and perform any necessary actions.
3.
Invoke the Method: Call the _getCategoryContent method with the category ID and the callback function.

Example Usage#

Here is an example of how to use the _getCategoryContent method:
In this example:
categoryId specifies the ID of the category whose content you want to retrieve.
handleCategoryContent is the function that processes and logs the retrieved content.

Detailed Steps#

1.
Provide Category ID: Pass the unique identifier of the category to the _getCategoryContent method. This ID is used to fetch the relevant content.
2.
Callback Function: Implement a callback function that will receive the category content once it is retrieved. This function should be capable of handling the content and performing any required operations.
3.
Content Retrieval: The _getCategoryContent method will internally use _getInternalContentByType to fetch content for the specified category type ("categories").
4.
Handling the Response: Once the content is retrieved, the callback function will be called with the category content, allowing you to handle it as needed.

Error Handling#

Ensure that the categoryId provided is valid and corresponds to an existing category.
The callback function should be prepared to handle scenarios where content might be null or undefined.

Notes#

Internal Function: The _getInternalContentByType function is used internally by _getCategoryContent. Ensure that this function is correctly implemented and accessible.
Callback Implementation: The callback function should be designed to process and display category content effectively, including handling any potential errors.
By following this guide, you can effectively use the _getCategoryContent method to fetch and handle detailed content for categories in your application.
Previous
_findCategoryTreeByAlias
Next
_getCollectionContent
Built with