Page 1 of 1

How to remove "warehouse:default"?

Posted: 10 Aug 2017, 10:26
by Innonic
As you can see in the screenshot snippet, there's always a message showing how many items are available.
And it tells about the warehouse: "Produkt ist auf Lager warehouse:default".

In the backend (Tab: Warehouse) I created a different warehouse with different key and description. After applying it I get:
"Produkt ist verfügbar warehouse:Wird produziert".
The key gets exchanged. But there's still the term "warehouse:". Can I remove or change that somehow?

I apologize for my stupid question, but I didn't find a way, yet.

Thank you very much!

Re: How to remove "warehouse:default"?

Posted: 10 Aug 2017, 22:48
by aimeos
You can overwrite the translation for "warehouse:default" using a single space. The translation domain is "client/code":
https://github.com/aimeos/ai-client-htm ... lt.php#L76

Re: How to remove "warehouse:default"?

Posted: 11 Aug 2017, 10:37
by Innonic
It doesn't work. I already do have working translations, but this one is not. I used:

Code: Select all

plugin.tx_aimeos.settings.i18n.de_DE.0 {
  domain = client/code
  string = warehouse:default
  trans = test
}
and tried many variations. As domain I tried "client" and "code" alone. I tried "warehouse:" and "warehouse" and I tried different language codes like "de" and simply "en".

In the database, on first sight, it looks like the other translations, but it doesn't seem to be used...
Of course I cleared caches before checking results.

Do you have any ideas?

Re: How to remove "warehouse:default"?

Posted: 11 Aug 2017, 13:01
by Innonic
Update:

This seems to be hardcoded: I've found the following line in file "aimeos/Resources/Private/Extensions/ai-client-html/client/html/templates/catalog/stock/body-default.php" (TYPO3):

Code: Select all

$whCode = ( isset( $warehouseItems[$whId] ) ? 'warehouse:' . $warehouseItems[$whId]->getCode() : 'default' );
Here I can exchange "warehouse:" and it's immediatly shown on the webpage.

Hard to believe, I'm the first one who wanted to change this. Maybe I'm still on the wrong way somehow. But if not I suggest, this shouldn't be hardcoded but made available for translations.

Re: How to remove "warehouse:default"?

Posted: 12 Aug 2017, 08:47
by aimeos
Seems like you've upgraded from 16.x to 17.x and still use the 16.x templates (at least for the stock levels).
In 17.x the "warehouse" has been renamed to "stocktype" to be in line with all other type tables.

Nevertheless, it's possible to translate the warehouse codes even in 16.10:
https://github.com/aimeos/ai-client-htm ... lt.php#L79

Re: How to remove "warehouse:default"?

Posted: 12 Aug 2017, 14:23
by Innonic
Yes, I saw that code, but as I said before, I couldn't get the translation to work...

I did not upgrade to 17.x, yet. I'm running version 16.10.5. Somehow I don't dare to since I've made bad experiences with other updates within the TYPO3 environment. But I know, I will have to.

So if I do upgrade to 17.x, do I have to update templates separatly?
And will it run savely? I mean I shouldn't lose anything and the shop ist still available, without any problems?

Re: How to remove "warehouse:default"?

Posted: 13 Aug 2017, 12:15
by aimeos
No, you shouldn't upgrade if you don't need some features from the 2017.x series because 2017.x has some backward incompatible changes compared to 2016.x so upgrading requires some work.

Nevertheless, using a different translation for the warehouse codes in 2016.10 should work and by default. In 2017.x, this translation works well:

Code: Select all

plugin.tx_aimeos.settings.i18n.en {
  0 {
    domain = client/code
    string = stocktype:default
    trans = test
  }
}
In 2016.10, this one should do the same according to the template:

Code: Select all

plugin.tx_aimeos.settings.i18n.en {
  0 {
    domain = client/code
    string = warehouse:default
    trans = test
  }
}
Did you tried to use only "de" instead of "de_DE"?
Another problem (but less likely) can be that the warehouse "default" contains a space or another non-visible character at the beginning or end.

Re: How to remove "warehouse:default"?

Posted: 18 Aug 2017, 09:10
by Innonic
Ok, now I got it. I'm a bit stressed out so it took a while...

I wanted to replace "warehouse:" not "warehouse:default".
Since I changed/added the warehouse properties (key and description), the string "warehouse:default" doesn't exist at all. I have "warehouse:<something else>".

The problem was:
Within the source code I didn't realize the connection between

Code: Select all

'warehouse:'
and

Code: Select all

. $warehouseItems[$whId]->getCode() : 'default'
.
So I can't translate "warehouse:" only, I have to translate the whole string with what is coming after ":".
Now I translate "warehouse:<something else>" and everything works fine.

Thank you for your patience!!!