How to remove "warehouse:default"?

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

How to remove "warehouse:default"?

Post by Innonic » 10 Aug 2017, 10:26

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!
Attachments
img1.png
img1.png (10.67 KiB) Viewed 3213 times

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to remove "warehouse:default"?

Post by aimeos » 10 Aug 2017, 22:48

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: How to remove "warehouse:default"?

Post by Innonic » 11 Aug 2017, 10:37

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?

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: How to remove "warehouse:default"?

Post by Innonic » 11 Aug 2017, 13:01

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.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to remove "warehouse:default"?

Post by aimeos » 12 Aug 2017, 08:47

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: How to remove "warehouse:default"?

Post by Innonic » 12 Aug 2017, 14:23

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?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: How to remove "warehouse:default"?

Post by aimeos » 13 Aug 2017, 12:15

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: How to remove "warehouse:default"?

Post by Innonic » 18 Aug 2017, 09:10

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!!!

Post Reply