How to sort event products by start date in the frontend?
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to sort event products by start date in the frontend?
Hi,
I would like to sort event products by default by start date in the frontend catalog list automatically. At the moment they are sorted by relevance and this seems to be sorted by creation date but I need a default sorting by start date.
At the moment I have no idea which file(s) I have to edit or which code I have to add. Perhaps the pagination.php file?
Thanks.
Aimeos version: 24.4.2 (TYPO3)
I would like to sort event products by default by start date in the frontend catalog list automatically. At the moment they are sorted by relevance and this seems to be sorted by creation date but I need a default sorting by start date.
At the moment I have no idea which file(s) I have to edit or which code I have to add. Perhaps the pagination.php file?
Thanks.
Aimeos version: 24.4.2 (TYPO3)
Re: How to sort event products by start date in the frontend?
Add these lines in your custom product controller:
https://github.com/aimeos/ai-controller ... #L591-L593
We've added it to the aimeos/ai-controller-frontend controller package too and it will be part of the next LTS release.
Furthermore, you need to add a new sort option in the pagination partial for sorting by "start" date/time:
https://github.com/aimeos/ai-client-htm ... nation.php
https://github.com/aimeos/ai-controller ... #L591-L593
We've added it to the aimeos/ai-controller-frontend controller package too and it will be part of the next LTS release.
Furthermore, you need to add a new sort option in the pagination partial for sorting by "start" date/time:
https://github.com/aimeos/ai-client-htm ... nation.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to sort event products by start date in the frontend?
Wonderful, thank you very much for your answer! It helped me a lot.
Because I didn't manage to change the default sorting by manipulating the partial pagination (and on the home page I don't use a pagination) I added also these lines in the file
/vendor/aimeos/aimeos-typo3/Configuration/FlexForms/CatalogList.xml
...
<numIndex index="7" type="array">
<numIndex index="0">LLL:EXT:aimeos/Resources/Private/Language/plugins.xlf:catalog-list.sort-start</numIndex>
<numIndex index="1">start</numIndex>
</numIndex>
...
and the translation, e.g. for german:
...
/vendor/aimeos/aimeos-typo3/Resources/Private/Language/de.plugins.xlf
<trans-unit id="catalog-list.sort-start" xml:space="preserve">
<source>Start time</source>
<target>Startzeit</target>
</trans-unit>
...
Perhaps you can also add this to the lts version.
Because I didn't manage to change the default sorting by manipulating the partial pagination (and on the home page I don't use a pagination) I added also these lines in the file
/vendor/aimeos/aimeos-typo3/Configuration/FlexForms/CatalogList.xml
...
<numIndex index="7" type="array">
<numIndex index="0">LLL:EXT:aimeos/Resources/Private/Language/plugins.xlf:catalog-list.sort-start</numIndex>
<numIndex index="1">start</numIndex>
</numIndex>
...
and the translation, e.g. for german:
...
/vendor/aimeos/aimeos-typo3/Resources/Private/Language/de.plugins.xlf
<trans-unit id="catalog-list.sort-start" xml:space="preserve">
<source>Start time</source>
<target>Startzeit</target>
</trans-unit>
...
Perhaps you can also add this to the lts version.
Re: How to sort event products by start date in the frontend?
Are you able to create a pull request with your changes in the Github repository?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to sort event products by start date in the frontend?
I've created now a pull request. As it's the first time I pull to an official package I hope I made it right. Unfortunately I didn't manage to put the 2 commits in one pull request, so you will see 2 pull requests.
Re: How to sort event products by start date in the frontend?
Thanks a lot, they are merged now
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star