Home
Wiki
Home
Wiki
  1. 3. Reusables
  • 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
    • 0. Introduction
    • 6. FAQ
    • 1. Structure
      • _Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • _Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogHighlights
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • CustomTable
      • Faq
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • Offer
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Quote
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
      • OrderReviews
      • ProductReviews
      • Newsletter
    • 3. Reusables
      • _Overview
      • Addresses
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • BillingRetail
      • BlogPostingStructuredData
      • BrandListStructuredData
      • CollectionStructuredData
      • Company
      • General
      • GroupChildrenTable
      • Login
      • LoginModal
      • MonthlyTransactions
      • Offers
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductAvailabilityAction
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductGridItemClassic
      • ProductListItem
      • ProductModal
      • ProductStructuredData
      • ProfileInfo
      • PromptModal
      • Quotes
      • Register
      • Services
      • Shipping
      • ShoppingLists
      • ShoppingListsButton
      • ShoppingListsNavbar
      • StoresStructuredData
      • Toast
      • Transactions
      • Users
      • VariantContent
      • VariantContentClassic
      • WishlistButton
      • ProductRating
      • ClientHelpers
      • FaqStructuredData
      • ShoppingAssistant
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • _Overview
        • theme.js
      • Css - Scss
        • _Overview
        • ThemeClasses
    • 5. SDK
      • _Overview
      • LiquidGlobals
      • ServicesSDK
  1. 3. Reusables

Orders

Purpose#

Orders is the Profile-tab reusable that lists customer orders with search, filters, and pagination.
It also supports order preview/details and “order again” behavior through cart service integration.

Where it's rendered#

In Components/Profile/Default.liquid:
{% render 'Reusables\\Orders\\Default', orderData: orderData %}

Inputs (Liquid render parameters)#

Orders is rendered with a single parameter.

Model shape (storefront example)#

Below is a sanitized excerpt from a real Profile component model dump containing the orderData passed to this reusable.
{
  "orderData": {
    "pagination": {
      "totalCount": 27,
      "pageSize": 12,
      "pageNumber": 1,
      "numberOfPages": 3
    },
    "availableStatuses": [
      "Placed",
      "Cancelled",
      "Processing",
      ...
    ],
    "availableYears": [
      "2026",
      "2025",
      "2024",
      ...
    ],
    "list": [
      {
        "id": "Order Id",
        "status": "Placed",
        "code": "ORD00000027",
        "placedAt": "2026-04-01T09:47:15.2948642+00:00",
        "billingAddress": {
          "address1": "Sample address",
          "city": "Sample city",
          "postalCode": "11147",
          "state": "Sample state",
          "country": "Sample country"
        },
        "shippingAddress": {
          "address1": "Sample address",
          "city": "Sample city",
          "postalCode": "11147",
          "state": "Sample state",
          "country": "Sample country"
        },
        "shippingLine": {
          "title": "Sample title",
          "carrierId": "Carrier Id",
          "carrierCode": "Sample code",
          "netPrice": 0,
          "totalAmount": 0,
          "totalAmountText": "0.00 €",
          "vatLines": []
        },
        "payment": {
          "name": "Sample name",
          "provider": "COD",
          "amount": 0,
          "serviceAmount": 2,
          "serviceAmountText": "2.00 €"
        },
        "documentType": "Receipt",
        "canReview": false,
        "totalQuantity": 1,
        "totalAmount": 125,
        "totalAmountText": "125.00 €",
        "netAmount": 100,
        "vatAmount": 23,
        "lines": [
          {
            "id": "Order Line Id",
            "productId": "Product Id",
            "productVariantId": "Product Variant Id",
            "productTitle": "Sample title",
            "quantity": 1,
            "link": "sample-alias",
            "unitText": "Sample unit",
            "price": 100,
            "netValue": 100,
            "vatValue": 23,
            "vatRate": 23,
            "mediaItem": {
              "id": "Media Item Id",
              "link": "https://example.com/sample",
              "position": 0,
              "alt": "sample",
              "mediaType": "Image"
            }
          },
          ...
        ],
        "vatAnalysis": [
          {
            "vatRate": 23,
            "vatAmount": 23,
            "vatCode": "",
            "netAmount": 100
          },
          ...
        ]
      },
      ...
    ]
  }
}

Required fields#

orderData (object)
pagination.pageNumber
pagination.numberOfPages
list (array)

Optional fields#

Orders reads additional fields when present:
Search/filter state:
orderData.code (string)
orderData.year (string)
orderData.status (string)
Filter options:
availableStatuses
availableYears
For “order again”:
each order line uses productId, productVariantId, quantity (and optional fields like dim1Value, dim2Value, price, initialPrice).
For product reviews:
canReview (boolean) is true when the signed-in user can open the order's review page,
/order-reviews/{orderId}, now: the order has a review request whose period is open, and the store
collects reviews with the Product reviews module. The shipped view always shows the review link,
disabled when canReview is false. Clicking it does not open the order.

Template behavior (Liquid + Alpine)#

Source: Reusables/Orders/Default.liquid.
Computes pagination “sliding window” server-side in Liquid and builds a pages array for UI rendering.
Initializes Alpine with:
x-data='ordersreusabledefault.initComponent({{ currentPage }}, {{ totalPages }}, {{ orderData | serialize | escape }})'
Filters (code/status/year) trigger navigation by updating the URL query parameters.
Uses a “preview mode” controlled by hideOrderPreview.
Uses fallback image logic for order line product images.

Data contract (JS runtime)#

ordersreusabledefault.initComponent(currentPage, totalPages, orderData)#

Source: Reusables/Orders/Default.js.
State highlights:
currentPage, totalPages
orderData
orders = orderData.list || []
filter models: code, year, status
hideOrderPreview / selectedOrder
isAdding (guards repeated bulk-add)

JavaScript#

Source: Reusables/Orders/Default.js.
init(): prepares initial state.
Notes: builds a local years array (current year decreasing, length 10).
Note: this reusable is now always freshly initialized on /profile/orders (a full page
navigation), so preview state (hideOrderPreview, selectedOrder) simply starts at its
default value; there is no client-side tab-switch reset anymore.

init#

Initializes Orders state (years list, filters, and watchers) and prepares the initial view.
redirectToState(newPage = null): builds query parameters (page, code, year, status) and navigates:
window.location.href = `${window.location.pathname}?${params.toString()}`;
triggerVoiceSearch(): uses SpeechRecognition / webkitSpeechRecognition to fill the code model.

triggerVoiceSearch#

viewOrder(index): switches to the order preview view and scrolls into place.
scrollToTopOfSection(): scrolls the Orders section to the top.

scrollToTopOfSection#

formatDate(dateString): formats dates using toLocaleDateString('el-GR').
orderAgain(items, errorMessages): re-adds order lines to cart.
Side effects: calls servicesreusabledefault.addMultipleToCart(variations).
servicesreusabledefault.addMultipleToCart(variations)
Shows toasts on failure.
Handles response.data.lineFailures by mapping failure types to messages with getLineFailureMessages(...).
getLineFailureMessages(lineFailure, errorMessages, selectedProductTitle): maps error types to translation-based toast messages.

Global Alpine stores#

Directly used:
$store.toast
Used for error reporting.

Services / API calls#

servicesreusabledefault.addMultipleToCart(variations)

Dependencies#

Reusables/Orders/Default.liquid
Reusables/Orders/Default.js
Reusables/Orders/Default.json (translations)
Components/Profile/Default.liquid (render site)
$store.toast in Assets/js/theme.js
servicesreusabledefault.addMultipleToCart
Browser Speech Recognition API (optional)

Notes#

Voice search depends on browser support; when unsupported it shows an alert(...).
The reusable renders two very different states (list vs preview) driven by hideOrderPreview.

Examples#

Render from the Profile orders tab:
{% render 'Reusables\\Orders\\Default', orderData: orderData %}
Modified at 2026-11-16 09:18:32
Previous
Offers
Next
Payment
Built with