Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add itemlist with items related to product tiles #3518

Draft
wants to merge 1 commit into
base: stable
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions resources/views/Category/Item/CategoryItem.twig
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
{% endif %}

<div class="col-12 col-lg-{% if category is defined and ceresConfig.header.showNavBars in ["side", "both"] %}9{% else %}12{% endif %}">
{% set listItems = [] %}
{% set position = 1 %}
{% if itemList is not empty %}
<ul class="product-list row grid">
{% for item in itemList %}
Expand All @@ -125,10 +127,38 @@
</a>
</category-item>
</li>
{% set itemurl = item.data | itemURL %}
{% set itemImage = item.data.images.variation[0].urlMiddle %}
{% if itemImage is null or (itemImage | trim is empty) %}
{% set itemImage = item.data.images.all[0].urlMiddle %}
{% endif %}
{% set listItem =
[
{
"@type": "ListItem",
"position": position,
"name": item.data | itemName,
"url": webstoreConfig.domainSsl ~ itemurl,
"image": itemImage
}
]
%}
{% set listItems = listItems | merge(listItem) %}
{% set position = position + 1 %}
{% endfor %}
</ul>
{% endif %}

{% if category is defined %}
<script2 type="application/ld+json">
{
"@context":"http://schema.org/",
"@type":"ItemList",
"name": "{{ category.details[0].name }}",
"itemListElement": {{ listItems | json_encode | raw }}
}}
</script2>
{% endif %}
{% if category is not defined and itemList is empty %}
<p class="h3 text-muted mb-5 text-center">{{ trans("Ceres::Template.itemSearchNoResults", {"searchString": searchString}) }}</p>
{% endif %}
Expand Down