{% set currentVendor = market.vendors.getCurrentVendor() %} {% set page = page ?? 1 %} {% set sort = sort ?? 'postDate' %} {% set sortDir = sortDir ?? 'desc' %} {% set limit = limit ?? 10 %} {% if limit > 100 %}{% set limit = 100 %}{% endif %} {% set query = query ?? '' %} {% set status = status ?? '' %} {% do sprig.pushUrl('?page='~page~'&sort='~sort~'&sortDir='~sortDir~'&query='~query) %} {% set productsQuery = craft.products .status(status) .limit(limit) .search(query) .orderBy(sort~' '~sortDir) .relatedTo({ 'targetElement': currentVendor.id, 'field': 'vendor' }) %} {% set pageInfo = sprig.paginate(productsQuery, page) %} {% set products = pageInfo.pageResults %} {% set statusMap = { live: 'bg-green-100 text-green-800', pending: 'bg-orange-100 text-orange-800', expired: 'bg-red-100 text-red-800', disabled: 'bg-gray-100 text-gray-800', } %} {% if selectedIds is not defined %} {% set selectedIds = [] %} {% endif %} {% if selectedIds is defined and selectedIds is not iterable %} {% set selectedIds = selectedIds|split(',') %} {% endif %} {% set selectedIds = selectedIds|filter|unique %} {% if successfulNotice is defined %} {% do craft.app.session.setNotice(successfulNotice) %} {% do sprig.redirect('/market/products') %} {% endif %} {# Header #}
Applies to {{ selectedIds|length }} products
| Select all products {% if selectedIds|length >= 1 and products|length != selectedIds|length %} {% endif %} | Status | ||||
|---|---|---|---|---|---|
|
{% set img = product.primaryImage[0] ?? null %}
{% if img %}
{{ product.title }}
|
{{ product.status|title }} | {{ product.defaultSku }} | {{ product.defaultPrice|currency(null, [], [], true) }} | {{ product.postDate|datetime('short') }} |
We couldn’t find anything for “{{ query }}”, try being less specific or using different keywords.
You can search for most things including product titles, descriptions, SKUs and other text content you have added.
{% elseif status %}We couldn’t find any {{ status }} products.
{% endif %}You don’t have any products yet, go ahead and add your very first one!