PhoenixKitEcommerce.Web.Components.ShopCards (PhoenixKitEcommerce v0.5.6)

Copy Markdown View Source

Reusable product display components for the shop storefront.

Provides product card and pagination components shared between the main catalog page and category pages.

Summary

Functions

Renders a product card with image, title, price, and optional category badge.

Renders a "load more" button + page links for product grids.

Compact cart-side actions for storefront pages, rendered on the same row as the page's breadcrumbs.

Functions

product_card(assigns)

Renders a product card with image, title, price, and optional category badge.

Attributes

  • product (:map) (required)
  • currency (:any) (required)
  • language (:string) - Defaults to "en".
  • filter_qs (:string) - Defaults to "".
  • show_category (:boolean) - Defaults to false.
  • name_prefixes (:list) - NamePrefix.prefixes/0, computed once by the grid rendering many cards; nil (a lone card) reads the setting itself. Defaults to nil.

shop_pagination(assigns)

Renders a "load more" button + page links for product grids.

Attributes

  • page (:integer) (required)
  • total_pages (:integer) (required)
  • total_products (:integer) (required)
  • per_page (:integer) (required)
  • base_path (:string) (required)
  • active_filters (:map) - Defaults to %{}.
  • enabled_filters (:list) - Defaults to [].

storefront_bar(assigns)

Compact cart-side actions for storefront pages, rendered on the same row as the page's breadcrumbs.

The storefront used to ship its own top-level layout carrying a cart link, a language switcher and a home link. Rendering inside the HOST's layout is the right call — the shop should look like the site — but a host whose header has no cart link would leave a shopper with no way back to their cart. This is the replacement: in-content (so it composes with any host chrome rather than competing with it), server-rendered, and switchable off via shop_show_cart_bar by hosts that carry their own.

It carries no "Shop" link: every page that renders it also renders breadcrumbs, whose first crumb is that same link, and two of them side by side only cost a row of vertical space.

Attributes

  • language (:string) (required)
  • cart_count (:integer) - Defaults to 0.
  • class (:string) - Defaults to "".
  • admin_edit_url (:string) - when set, an edit link is rendered just before the cart link. Defaults to nil.
  • admin_edit_label (:string) - Defaults to nil.