Reputation: 55
Currently, I have an issue about display pagination title in Shopware, template use Twig, load pagination pages by ajax, multi languages use snippet.
Detail:
Page items will be loaded by use ajax when click the page number. So, I don't know what to do display the pagination title on page title with multi languages.
Can everyone help me to resolve this issue? Thank everyone.
Upvotes: 0
Views: 534
Reputation: 35008
You can hook into this method:
ListingPaginationPlugin.onChangePage
(see the source code in vendor/shopware/storefront/Resources/app/storefront/src/plugin/listing/listing-pagination.plugin.js
)
And after calling the parent method, insert - for a proof of concept - code like this:
document.title = event.target.value;
This would simply show the page number in the title (but losing the original title)
I suggest you back-up the original title and just append the "Page X" / "Seite X" information to it according to your necessary logic.
Now you need the translated word for "Page" available in the Javascript code.
You could attach this as a data-attribute to the title tag in the according twig template and use the normal `|trans' filter. I am not sure if there is a better way to have translations available in Javascript code in Shopware, so I asked.
Upvotes: 2