Home
Wiki
Home
Wiki
  1. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • 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
  • Noir
  1. Components

Last Visited Products

Documentation: Last Visited Products Component#

The Last Visited Products Component is a Vue.js component that displays a carousel of products that a user has recently visited. It provides a visually engaging way to showcase these products, leveraging a carousel for easy navigation.

Overview#

The Last Visited Products Component dynamically renders a list of products that users have previously interacted with. It retrieves product data from local storage, processes it, and displays it in a responsive carousel layout. This component is particularly useful for e-commerce sites to remind users of their recent browsing history.

Model Documentation#

The model object is used to configure the component's appearance and behavior.
Model Structure#
id: String
A unique identifier for the component, used to set the id attribute of the carousel.
cssClass: String
Optional CSS class(es) for additional styling of the component.
header: String
The header text to be displayed at the top of the section.
alignment: Number
Determines the alignment of the header text. Possible values:
1 for left alignment
2 for center alignment
3 for right alignment
Example Model#
{
  "id": "last-visited-products",
  "cssClass": "last-visited-products",
  "header": "Recently Viewed Products",
  "alignment": 2
}

Component Structure#

The Last Visited Products Component consists of:
1.
Header Section: Displays a title if provided in the model.
2.
Carousel Container: A carousel element to showcase the products.
3.
Product List Items: Individual product components rendered within the carousel.

HTML Template#

The HTML template defines the layout and structure of the component:

JavaScript#

The JavaScript code handles data retrieval, product processing, and carousel initialization.

Explanation#

Data Handling: The component retrieves visited products from local storage and processes them to display in the carousel.
Product Processing: Products are fetched based on IDs stored in local storage. Additional data (e.g., units) is also retrieved if necessary.
Carousel Initialization: The component initializes the carousel using the tns library with customizable options and default settings.
Responsive Carousel: The carousel is configured to adapt to different screen sizes, showing a varying number of items per view.

Usage#

To integrate the Last Visited Products Component into your Vue.js application:
1.
Include the Component: Register lastvisitedproductsdefault in your Vue app.
2.
Provide the Model: Pass a configuration object to the component to define its appearance and behavior.
3.
Initialize and Display: Ensure the component has access to the visited products data in local storage, and it will handle display and interaction automatically.
Modified at 2024-08-27 09:43:34
Previous
Invitation
Next
Layout
Built with