BitBagCommerce / SyliusCmsPlugin

Content management system for eCommerce apps created on Sylius platform. Built with Sylius code quality, flexibility, BDD.
MIT License
235 stars 159 forks source link

How to sort blocks in sections #113

Closed ambroisemaupate closed 6 years ago

ambroisemaupate commented 6 years ago

I use sections to create a kind of block collection (for carousels) but I need them to be sorted using a dedicated position field.

For example, create a homepage-carousel section then add many BlockImage into it. How do you sort them?

{{ render(path('bitbag_sylius_cms_plugin_shop_block_index_by_section_code', {
    'sectionCode' : 'home-carousel', 
    'template' : '@SyliusShop/Homepage/_carousel.html.twig',
    'sort': { 'position': 'ASC' }
})) }}

Is it possible to extend Block entity to add position and Gedmo Sortable behaviour ?

bitbager commented 6 years ago

Yes, just upgrade to the dev-master version and customize the Block entity like it's done in http://docs.sylius.org/en/latest/customization/model.html. Don't forget to customize the repository and grid as well.

ambroisemaupate commented 6 years ago

Awesome, I was not on dev-master branch so resource overriding was not working using annotations.

Thanks for you really quick answer.

bitbager commented 6 years ago

No problem. I will tag a new release as soon as I find a minute. This feature is a definitely must on a stable branch.