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
Cms pages datagrid not diplay any rows when Change locale #6703
Comments
Hi there, |
I did a small video. https://drive.google.com/file/d/1ZjT9fLxSK1AWOjuAiwMhPL0QT6Rb3Zfv/view The problem is not solved. |
I investigate further and: Request URL: http://127.0.0.1:8000/admin/cms?v=1&page=1 editing \packages\Webkul\Admin\src\DataGrids\CMSPageDataGrid.php public function prepareActions()
it works. But is possible that a user not fill all data with a new locale. Please fix. |
It's not an optimal solution, because all translated pages appear in the list, but at least they appear when you use a local language in the Admin other than EN. Try this:
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('cms_pages')
->select('cms_pages.id', 'cms_page_translations.page_title', 'cms_page_translations.url_key')
->leftJoin('cms_page_translations', function($leftJoin) {
$leftJoin->on('cms_pages.id', '=', 'cms_page_translations.cms_page_id')
->where('cms_page_translations.cms_page_id', app()->getLocale());
});
$this->addFilter('id', 'cms_pages.id');
$this->setQueryBuilder($queryBuilder);
} remove the line:
Will be like this: public function prepareQueryBuilder()
{
$queryBuilder = DB::table('cms_pages')
->select('cms_pages.id', 'cms_page_translations.page_title', 'cms_page_translations.url_key')
->leftJoin('cms_page_translations', function($leftJoin) {
$leftJoin->on('cms_pages.id', '=', 'cms_page_translations.cms_page_id');
});
$this->addFilter('id', 'cms_pages.id');
$this->setQueryBuilder($queryBuilder);
} |
This is a bug and I have added a PR for that. With that PR now you can able to filter the locale from the data grid itself. |
Improvised cms page datagrid #6703
Changing env
APP_LOCALE=it
then clear cache configuration
then added a new translations for specific page: php artisan optimize:clear
The datagrid not diplay any rows
this is my db for cms_page_translations
this is the results of datagrid query
Please could you check ?
Regards.
g.
The text was updated successfully, but these errors were encountered: