Git Product home page Git Product logo

Comments (12)

aimeos avatar aimeos commented on May 17, 2024 1

The changes will be available in the upcoming 2019.10 releases (ETA: this month)

from aimeos.

FlorianMoser avatar FlorianMoser commented on May 17, 2024

A correction: specifying a "URL segment" for each language does work, but only for some languages. I have three languages (de/fr/en) and created a "URL segment" for each of them for "My Product", but only the "de" language works. fr/en still shows a Product "new-name" not founderror.

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

What are the records for each language in the mshop_index_text table?
Can you check what happens here in your case:
https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Index/Manager/Text/Standard.php#L681-L736

from aimeos.

FlorianMoser avatar FlorianMoser commented on May 17, 2024

That's how the table looks after adding "URL segment" for "All" languages (product not found for all languages):

aimeos_table_2

When I change the "URL segment" from "All" language to "German" (product found on german page, but not on others), the table looks like this:

aimeos_table_3

When I then add the "URL segment" for french and english, nothing changes. The table still looks like on the last picture, and product only shows on german page.

Can you check what happens here in your case:
https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Index/Manager/Text/Standard.php#L681-L736

I'm not very familiar with Aimeos' architecture yet, but I will look into it tomorrow. Anything specific I should look for?

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

It might be enough to extend that SQL conditions by
mindte."langid" = $1 OR mindte."langid" IS NULL
in https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Index/Manager/Text/Standard.php#L37

from aimeos.

FlorianMoser avatar FlorianMoser commented on May 17, 2024

It might be enough to extend that SQL conditions by
mindte."langid" = $1 OR mindte."langid" IS NULL

After I changed the query, always the first product is shown on the details page. So no luck here.

I investigated further. The problem is, how the URLs are saved. If I create a URL segment for every language, the DB contains exactly the same result, as you see in my second screenshot above. The row with langid=de shows "new-name" as URL. The other languages still have "My_Product" as url.

Changing them manually to "new-name", works. It seems there are two problems:

  1. By saving a product with custom URL segments (one for every language), only one segment for one language is saved
  2. Adding a URL segment for "All" languages creates a new row, instead of updating each row for each language (but doing so manually in the DB circumvents the problem)

The bug is where the segments are stored, not where the product is fetched.

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

Did you add parenthesis around?
( mindte."langid" = $1 OR mindte."langid" IS NULL )

1.) Can you check again what happens here why only a segment for one language is stored:
https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Index/Manager/Text/Standard.php#L681-L736

2.) That's true. We will implement a way to fix that by removing the old entries afterwards

from aimeos.

FlorianMoser avatar FlorianMoser commented on May 17, 2024

Did you add parenthesis around?
( mindte."langid" = $1 OR mindte."langid" IS NULL )

I changed this to ( mindte."langid" = $1 OR mindte."langid" = \'\' ) (because langid is an empty string, not null), which works.

1.) Can you check again what happens here why only a segment for one language is stored:
https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Index/Manager/Text/Standard.php#L681-L736

The problem is, that $item->getRefItems( 'text', 'url', 'default' ) only returns the german (default) language item. I traced it back to https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Common/Item/ListRef/Traits.php#L268

There, $refItem->isAvailable() returns false, when the langid is not "de".

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

OK, but langid should be null, so we added that condition: aimeos/aimeos-core@3bbc0f70d
Together with this commit, the products should now be found: aimeos/aimeos-core@1ebb782

getRefItems() behaves that way because a language ID is set in the context when storing the product in the admin interface. This should fix the problem: aimeos/aimeos-laravel@c40d55c

from aimeos.

FlorianMoser avatar FlorianMoser commented on May 17, 2024

Perfect, that fixed both situations explained above. Thank you.

In which release will those changes be available?

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

The approach has some flaws, e.g. a new record is created for generic texts (url, name, etc.) but in combination with a full text search the products won't be found.

We use another way now: aimeos/aimeos-core@06711e9

from aimeos.

aimeos avatar aimeos commented on May 17, 2024

Old records are now removed too: aimeos/aimeos-core@8595789

from aimeos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.