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

Products Carousel

Products Carousel Component Documentation#

Overview#

The Products Carousel Component is a component that provides a responsive carousel display of product items. It allows for the presentation of products in a sliding carousel format with navigation controls. The component is designed to be flexible and responsive, adapting to various screen sizes and including features such as optional headers and alignment options.

Model Documentation#

Model Structure#

The model object for the ProductsCarouselComponent contains the following properties:
id: Unique identifier for the section.
cssClass: Optional CSS class(es) to apply to the section.
header: Optional header text to display above the carousel.
alignment: Alignment for the header, determining how it should be positioned (1: left, 2: center, 3: right).
collectionIds: Array of collection IDs from which to fetch the products.

Example Model#

{
  "id": "carousel-1",
  "cssClass": "custom-carousel",
  "header": "Top Rated Products",
  "alignment": 2,
  "collectionIds": ["xxxx"]
}

Component Structure#

The ProductsCarouselComponent is structured as follows:
1.
Section Wrapper: The main container for the carousel, including optional CSS classes and conditional rendering based on the presence of products.
2.
Header Section: Conditionally renders a header if the header property is provided in the model. The alignment is determined by the alignment property.
3.
Carousel Container: Implements a carousel using the tns library with options for responsive item counts and navigation controls.
4.
Carousel Items: Iterates over the products and displays them within the carousel. Each product includes an image and a title, with links to the product details.

HTML Template#

JavaScript#

Explanation#

Conditional Rendering#

The main section is rendered only if this.products is not null and contains items.
The header is displayed only if the header property in the model is not null or an empty string.

Carousel Initialization#

The carouselInitialization method configures and initializes the carousel using the tns library. Default options are provided, which can be overridden by options specified in the data-carousel-options attribute of the carousel container.

Methods#

carouselInitialization: Sets up the carousel with default and user-defined options.
getAlignmentClass: Returns the appropriate Bootstrap class for header alignment.

Usage#

To use the ProductsCarouselComponent, ensure that the model object provided includes the necessary properties and conforms to the structure outlined. Import the component and register it with your Vue application. Use it in your template with the appropriate data bindings and props.
Previous
Products Block
Next
Product Single
Built with