Same basket for different languages
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!
Same basket for different languages
Hi,
How / where can we make the basket language-independet?
After switching to EN (step 3 above), the 4 items should remain in the basket and only be displayed in EN.
Thank you!
- start: current local / language setting: DE
- user adds item to basket, eg. 4 items
- customer changes local / language to: EN
-> basket empty, 0 items - switch back to DE: basket has 4 items again
How / where can we make the basket language-independet?
After switching to EN (step 3 above), the 4 items should remain in the basket and only be displayed in EN.
Thank you!
Re: Same basket for different languages
Hm, the code for migrating products between baskets for different languages/currencies exists and it should work. Can you have to look what happens there in your case:
https://github.com/aimeos/ai-controller ... #L122-L334
https://github.com/aimeos/ai-controller ... #L122-L334
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: Same basket for different languages
added a protocol / log output, it seems like ai-controller-frontend/src/Controller/Frontend/Basket/Base.php is not executed at all
FYI: the same behavior also applies to Aimeos Demo shop on https://laravel.demo.aimeos.org
1. add item to cart
2. change language
-> cart empty
3. change language back
-> item form step 1 is in the cart
FYI: the same behavior also applies to Aimeos Demo shop on https://laravel.demo.aimeos.org
1. add item to cart
2. change language
-> cart empty
3. change language back
-> item form step 1 is in the cart
Re: Same basket for different languages
added a log output of the exception message:
Log::info(print_r($e->getMessage(), true));
in https://github.com/aimeos/ai-controller ... e.php#L284
with every language change:
"Adding product with ID "1234" is not allowed "
Why?
It's a standard article (type: article) and can be added to the basket on the EN and DE category page without any problems.
Log::info(print_r($e->getMessage(), true));
in https://github.com/aimeos/ai-controller ... e.php#L284
with every language change:
"Adding product with ID "1234" is not allowed "
Why?
It's a standard article (type: article) and can be added to the basket on the EN and DE category page without any problems.
Re: Same basket for different languages
Please give a hint
I am stuck here and have no clue why it is not working and why this message "Adding product with ID "###" is not allowed" appears
Thank you!
I am stuck here and have no clue why it is not working and why this message "Adding product with ID "###" is not allowed" appears
Thank you!
Re: Same basket for different languages
The message is from the catalog decorator for the basket controller:
https://github.com/aimeos/ai-controller ... hp#L37-L62
It checks if the product is assigned to a category because otherwise, it's not allowed to add the product to the basket (products without categories are e.g. rebate products).
Guess, the product is a variant article of a selection product and the problem is located here:
https://github.com/aimeos/ai-controller ... e.php#L271
Instead of:
It must be:
Does that fix the problem?
https://github.com/aimeos/ai-controller ... hp#L37-L62
It checks if the product is assigned to a category because otherwise, it's not allowed to add the product to the basket (products without categories are e.g. rebate products).
Guess, the product is a variant article of a selection product and the problem is located here:
https://github.com/aimeos/ai-controller ... e.php#L271
Instead of:
Code: Select all
$item = $manager->get( $product->getProductId(), $domains );
Code: Select all
$item = $manager->get( $product->getParentProductId() ?: $product->getProductId(), $domains );
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: Same basket for different languages
it's working now for variants "default article" linked to a select article) - thank you!
but for "simple" default article we get:
Error migrating product with code "018501" in basket to locale "default|en|EUR": Adding product with ID "7680" is not allowed
(the article is active of course and we don't have a stock limitation)
but for "simple" default article we get:
Error migrating product with code "018501" in basket to locale "default|en|EUR": Adding product with ID "7680" is not allowed
(the article is active of course and we don't have a stock limitation)
Re: Same basket for different languages
The fix is now available in dev-master and 2023.10.x-dev.
Product "7680" is of type "default"? Does it have a category assigned?
Can you check what happens here for that product?
https://github.com/aimeos/ai-controller ... hp#L46-L79
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: Same basket for different languages
thank you!
If you disable (comment) lines 52-56 in https://github.com/aimeos/ai-controller ... hp#L52-L56 basket translation works
So it seems as the product is not assigned to any category, but in fact it is assigned to (standard) categories.
Also tried with other products that are only assigned to one category, but same behaviour
Yes, it is of type "default"and has two active (standard) categories assigned.Product "7680" is of type "default"? Does it have a category assigned?
If you disable (comment) lines 52-56 in https://github.com/aimeos/ai-controller ... hp#L52-L56 basket translation works
So it seems as the product is not assigned to any category, but in fact it is assigned to (standard) categories.
Also tried with other products that are only assigned to one category, but same behaviour
Re: Same basket for different languages
Fetching categories was missing when migrating products. This is now patched in ai-controller-frontend dev-master and 2023.10.x-dev. Thank you very much for your support!
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