Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
return {
blogCategory: null,
translationContext: 'werkl-blog-category',
categories: [],
};
},

Expand All @@ -28,5 +29,22 @@ export default {
},

syncProducts() {},

async onGetTreeItems({ parentId }) {
const criteria = new Shopware.Data.Criteria(1, 500);

// Filter by parent ID if provided (for nested categories)
// If no parentId, get root categories
if (parentId) {
criteria.addFilter(Shopware.Data.Criteria.equals('parentId', parentId));
}

try {
return await this.categoryRepository.search(criteria, Shopware.Context.api);
} catch (error) {
console.error('Failed to load blog categories:', error);
return null;
}
},
},
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% block block_werkl_blog_detail %}
{% set element = block.slots.getSlot('blogDetail') %}

<div class="{% if element.config.fullWidth %}col-12{% elseif section and section.sizingMode === 'boxed' %}col-md-8 offset-md-2{% endif %}" data-cms-element-id="{{ element.id }}">
<div class="{% if element.config.fullWidth.value %}col-12{% elseif section and section.sizingMode === 'boxed' %}col-md-8 offset-md-2{% endif %}" data-cms-element-id="{{ element.id }}">
{% sw_include '@Storefront/storefront/element/cms-element-' ~ element.type ~ '.html.twig' ignore missing %}
</div>
{% endblock %}