Language switching in product detail issue
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Language switching in product detail issue
Hi,
I'm having an issue when switching language in a product detail page.
When selecting a product from the catalog list, I land on a working product detail page with this url :
http://example.com/shop/productname/0
But when switching to english (my default locale is french), the url is http://example.com/shop/productname/0/en?currency=EUR and i get this error message :
Item with ID "en" in "product.id" not found
Also, after having added text descriptions and name to the product, the url then changes to
http://example.com/shop/productname/en/eur
leading to a 404
Am I doing something wrong here ? Thanks in advance !
I'm having an issue when switching language in a product detail page.
When selecting a product from the catalog list, I land on a working product detail page with this url :
http://example.com/shop/productname/0
But when switching to english (my default locale is french), the url is http://example.com/shop/productname/0/en?currency=EUR and i get this error message :
Item with ID "en" in "product.id" not found
Also, after having added text descriptions and name to the product, the url then changes to
http://example.com/shop/productname/en/eur
leading to a 404
Am I doing something wrong here ? Thanks in advance !
Re: Language switching in product detail issue
Which Aimeos version are you using? Can you post the output of
Code: Select all
composer show
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: Language switching in product detail issue
Here you go:
Code: Select all
aimeos/ai-admin-jqadm 2019.10.11 Aimeos ai-admin-jqadm extension
aimeos/ai-admin-jsonadm 2019.10.4 Aimeos ai-admin-jsonadm extension
aimeos/ai-client-html 2019.10.13 Aimeos ai-client-html extension
aimeos/ai-client-jsonapi 2019.10.4 Aimeos JSON API extension
aimeos/ai-controller-frontend 2019.10.9 Aimeos ai-controller-frontend extension
aimeos/ai-controller-jobs 2019.10.10 Aimeos ai-controller-jobs extension
aimeos/ai-gettext 2019.10.1 Aimeos Gettext extension
aimeos/ai-laravel 2019.10.5 Laravel adapter for Aimeos web shops and e-commerce so...
aimeos/ai-swiftmailer 2019.10.1 SwiftMailer adapter for Aimeos web shops and e-commerc...
aimeos/aimeos-core 2019.10.19 Full-featured e-commerce components for high performan...
aimeos/aimeos-laravel 2019.10.2 Professional, full-featured and high performance Larav...
beyondcode/laravel-dump-server 1.3.0 Symfony Var-Dump Server for Laravel
composer/installers v1.8.0 A multi-framework Composer library installer
dnoegel/php-xdg-base-dir v0.1.1 implementation of xdg base directory specification for...
doctrine/cache 1.10.0 PHP Doctrine Cache library is a popular cache implemen...
doctrine/dbal v2.9.3 Powerful PHP database abstraction layer (DBAL) with ma...
doctrine/event-manager 1.1.0 The Doctrine Event Manager is a simple PHP event syste...
doctrine/inflector 1.3.1 Common String Manipulations with regard to casing and ...
doctrine/instantiator 1.3.0 A small, lightweight utility to instantiate objects in...
doctrine/lexer 1.0.2 PHP Doctrine Lexer parser library that can be used in ...
dragonmantank/cron-expression v2.3.0 CRON for PHP: Calculate the next or previous run date ...
egulias/email-validator 2.1.17 A library for validating emails against several RFCs
erusev/parsedown 1.7.4 Parser for Markdown.
fideloper/proxy 4.3.0 Set trusted proxies for Laravel
filp/whoops 2.7.1 php error handling for cool kids
fzaninotto/faker v1.9.1 Faker is a PHP library that generates fake data for you.
hamcrest/hamcrest-php v2.0.0 This is the PHP port of Hamcrest Matchers
jakub-onderka/php-console-color v0.2
jakub-onderka/php-console-highlighter v0.4 Highlight PHP code in terminal
laravel/framework v5.8.37 The Laravel Framework.
laravel/tinker v1.0.10 Powerful REPL for the Laravel framework.
league/flysystem 1.0.64 Filesystem abstraction: Many filesystems, one API.
mockery/mockery 1.3.1 Mockery is a simple yet flexible PHP mock object frame...
monolog/monolog 1.25.3 Sends your logs to files, sockets, inboxes, databases ...
myclabs/deep-copy 1.9.5 Create deep copies (clones) of your objects
nesbot/carbon 2.31.0 An API extension for DateTime that supports 281 differ...
nikic/php-parser v4.3.0 A PHP parser written in PHP
nunomaduro/collision v3.0.1 Cli error handling for console/command-line PHP applic...
opis/closure 3.5.1 A library that can be used to serialize closures (anon...
paragonie/random_compat v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() f...
phar-io/manifest 1.0.3 Component for reading phar.io manifest information fro...
phar-io/version 2.0.1 Library for handling version information and constraints
phpdocumentor/reflection-common 2.0.0 Common reflection classes used by phpdocumentor to ref...
phpdocumentor/reflection-docblock 4.3.4 With this component, a library can provide support for...
phpdocumentor/type-resolver 1.0.1 A PSR-5 based resolver of Class names, Types and Struc...
phpoption/phpoption 1.7.2 Option Type for PHP
phpspec/prophecy v1.10.2 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 6.1.4 Library that provides collection, processing, and rend...
phpunit/php-file-iterator 2.0.2 FilterIterator implementation that filters files based...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 2.1.2 Utility class for timing
phpunit/php-token-stream 3.1.1 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 7.5.20 The PHP Unit Testing framework.
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.2 Common interface for logging libraries
psr/simple-cache 1.0.1 Common interfaces for simple caching
psy/psysh v0.9.12 An interactive shell for modern PHP.
ramsey/uuid 3.9.3 Formerly rhumsaa/uuid. A PHP 5.4+ library for generati...
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belon...
sebastian/comparator 3.0.2 Provides the functionality to compare PHP values for e...
sebastian/diff 3.0.2 Diff implementation
sebastian/environment 4.2.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 3.1.2 Provides the functionality to export PHP variables for...
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumer...
sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inhe...
sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP vari...
sebastian/resource-operations 2.0.1 Provides a list of PHP built-in functions that operate...
sebastian/version 2.0.1 Library that helps with managing the version number of...
swiftmailer/swiftmailer v6.2.3 Swiftmailer, free feature-rich PHP mailer
symfony/console v4.4.5 Symfony Console Component
symfony/css-selector v4.4.5 Symfony CssSelector Component
symfony/debug v4.4.5 Symfony Debug Component
symfony/error-handler v4.4.5 Symfony ErrorHandler Component
symfony/event-dispatcher v4.4.5 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.7 Generic abstractions related to dispatching event
symfony/finder v4.4.5 Symfony Finder Component
symfony/http-foundation v4.4.5 Symfony HttpFoundation Component
symfony/http-kernel v4.4.5 Symfony HttpKernel Component
symfony/mime v4.4.5 A library to manipulate MIME messages
symfony/polyfill-ctype v1.14.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv v1.14.0 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-idn v1.14.0 Symfony polyfill for intl's idn_to_ascii and idn_to_ut...
symfony/polyfill-mbstring v1.14.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.14.0 Symfony polyfill backporting some PHP 7.2+ features to...
symfony/polyfill-php73 v1.14.0 Symfony polyfill backporting some PHP 7.3+ features to...
symfony/process v4.4.5 Symfony Process Component
symfony/psr-http-message-bridge v1.3.0 PSR HTTP message bridge
symfony/routing v4.4.5 Symfony Routing Component
symfony/service-contracts v1.1.8 Generic abstractions related to writing services
symfony/translation v4.4.5 Symfony Translation Component
symfony/translation-contracts v1.1.7 Generic abstractions related to translation
symfony/var-dumper v4.4.5 Symfony mechanism for exploring and dumping PHP variables
theseer/tokenizer 1.1.3 A small library for converting tokenized PHP source co...
tijsverkoyen/css-to-inline-styles 2.2.2 CssToInlineStyles is a class that enables you to conve...
vlucas/phpdotenv v3.6.0 Loads environment variables from `.env` to `getenv()`,...
webmozart/assert 1.7.0 Assertions to validate method input/output with nice e...
zendframework/zend-diactoros 1.8.7 PSR HTTP Message implementations
Re: Language switching in product detail issue
Laravel 5.x has a bug that assigns parameters to empty route placeholders regardless of their name. That's fixed in Laravel 6+
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: Language switching in product detail issue
I updated to Laravel 6 and it works indeed, thanks a lot !
I see 2 other issues:
- The stock status is not translated in the product details
- When I continue browsing, the language switches back to default
I see 2 other issues:
- The stock status is not translated in the product details
- When I continue browsing, the language switches back to default
Re: Language switching in product detail issue
That depends if there's a translation available for your language. If not, please add translations here for the "client" translation domain: https://www.transifex.com/aimeos/aimeos-core/
Until your translations get integrated into the next release, you can also add them locally:
https://aimeos.org/docs/Laravel/Overwrite_translations
Adapt your route configuration so it contains the {locale} placeholder (and {currency} if needed)
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: Language switching in product detail issue
- The translation already exists:
when displaying the page in english (2nd language on this site), the stock status is still displayed in french (default language)
- {locale} and {currency} are already defined in config/shop.php
when displaying the page in english (2nd language on this site), the stock status is still displayed in french (default language)
- {locale} and {currency} are already defined in config/shop.php
Re: Language switching in product detail issue
Guess, the locale parameter is missing here:
https://github.com/aimeos/ai-client-htm ... e.php#L130
Can you test if you add
... "s_prodcode" => $list->toArray(), 'locale' => $view->param( 'locale' ) ) ...
Probably the same there. Where exactly does that happen?
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: Language switching in product detail issue
( I'm on Aimeos 2019.10 )
There is no " "s_prodcode" => $list->toArray()" in my file, only :
" array("s_prodcode" => $list ) " on this line
Nevertheless I added ", 'locale' => $view->param( 'locale' )" but the effects remain the same.
Language switching back to default happens for instance when using the "next" (or "previous") navigation link in the product detail page
There is no " "s_prodcode" => $list->toArray()" in my file, only :
" array("s_prodcode" => $list ) " on this line
Nevertheless I added ", 'locale' => $view->param( 'locale' )" but the effects remain the same.
Language switching back to default happens for instance when using the "next" (or "previous") navigation link in the product detail page
Re: Language switching in product detail issue
We've tried now several times to reproduce your behavior with several versions but are unable to get your result. If we add the locale selector like this:
And e.g. in the catalog/list view:
Then, the selected locale (language) is always used in the URLs (it don't gets lost) and the translation of the stock text is also in the correct language.
Code: Select all
'routes' => [
'account' => ['prefix' => '{locale}/myaccount', 'middleware' => ['web', 'auth']],
'default' => ['prefix' => '{locale}/shop', 'middleware' => ['web']],
],
'page' => [
'account-index' => ['locale/select', 'account/profile', 'account/subscription', 'account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session' ],
'basket-index' => ['locale/select', 'basket/standard','basket/related' ],
'catalog-count' => [ 'catalog/count' ],
'catalog-detail' => ['locale/select', 'basket/mini','catalog/stage','catalog/detail','catalog/session' ],
'catalog-list' => ['locale/select', 'basket/mini','catalog/filter','catalog/lists' ],
'catalog-stock' => [ 'catalog/stock' ],
'catalog-suggest' => [ 'catalog/suggest' ],
'catalog-tree' => ['locale/select', 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ],
'checkout-confirm' => [ 'checkout/confirm' ],
'checkout-index' => [ 'checkout/standard' ],
'checkout-update' => [ 'checkout/update' ],
],
Code: Select all
@extends('shop::base')
@section('aimeos_header')
<?= $aiheader['basket/mini'] ?>
<?= $aiheader['catalog/filter'] ?>
<?= $aiheader['catalog/lists'] ?>
<?= $aiheader['locale/select'] ?>
@stop
@section('aimeos_head')
<?= $aibody['locale/select'] ?>
<?= $aibody['basket/mini'] ?>
@stop
@section('aimeos_nav')
<?= $aibody['catalog/filter'] ?>
@stop
@section('aimeos_body')
<?= $aibody['catalog/lists'] ?>
@stop
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