Page 1 of 1

Adding additional salutations 2020.10.*

Posted: 10 Jan 2022, 12:52
by createanet
Happy new year,

I just wonder if I can get some feedback on managers, sub managers please.

https://github.com/aimeos/aimeos-laravel/issues/198

There was query on github regarding extending a submanager, or rather a submanagers item. I understand the need to extend the Manager, and then create the new Item from the Manager due abstract classes etc etc

This works for Managers, but doesn't appear to be working for submanagers.

eg.

Code: Select all

mshop/customer/manager/address/name = CustomerAddressManager
does not nothing, its not loaded. I can use any name here and it will not register, or throw exception due to class not existing.

My problem is Aimeos gives the user ability to manage salutations, but only those that exist already within the class \Aimeos\MShop\Common\Item\Address\Base. ie only removal, not additions.

I can see this has changed between 2020.10.* => 2021.10.*, we are however restricted to 2020.10.*.

My salutations are defined as follows where 'ms' is an addition.

Code: Select all

['company', 'mr', 'mrs', 'ms', 'miss']
The `checkSalutation` method on the item address base validates that the value given, defined on the config, exists within the range of salutations defined in the class - which is now obviously throwing a validation exception. This had led down the path to overwrite this method in the class to allow it to validate on those defined in the configuration - which is where I am stuck, as the behavior isn't acting as described in the docs.

Code: Select all

mshop/customer/manager/address/name => CustomerAddressManager
No doubt im missing something there, but ive gone over the docs and tried many things, but my class is never loaded.

The following https://aimeos.org/docs/2020.x/infrastr ... /#managers describes "mshop/<domain>/manager/<submanager>/<submanager>/name", im definitely doing this.

I also found something related here viewtopic.php?f=18&t=3250&p=12975&hilit ... ess#p12975, however the response wasn't really answering the OPs question.

I came across this thread viewtopic.php?f=18&t=3235&p=12921&hilit ... ess#p12921 which explains
You can either increase the number of options by extending several places in the code...
This is what I believe I am trying to do.

Im hoping there is something obvious I am missing or doing incorrectly?

Thanks

Re: Adding additional salutations 2020.10.*

Posted: 11 Jan 2022, 08:45
by aimeos
Can you post the exact configuration you have been added for your new submanager?

Re: Adding additional salutations 2020.10.*

Posted: 11 Jan 2022, 12:01
by createanet

Code: Select all

return [
    ...
     'customer' => [
        'manager' => [
            'address' => [
                'name' => 'CustomerAddressManager' 
            ],
        ],
    ],
]
* For reference, the manager is in the following namespace

Code: Select all

\Aimeos\MShop\Customer\Manager\Address\CustomerAddressManager
And im following the document comments as outlined here

https://github.com/aimeos/aimeos-core/b ... #L327-L337

It's probably something I might be missing from its parent customer manager configuration that isn't quite clear through documentation? It's just my understanding from the website is that submanagers are created no differently to managers.

Thanks

Re: Adding additional salutations 2020.10.*

Posted: 12 Jan 2022, 08:41
by aimeos
Do you use Laravel? If yes, did you add the configuration to the ./config/shop.php file?
If you've added it to a config file in your own extension, it may get overwritten by the Laravel configuration which uses a custom customer manager.

Re: Adding additional salutations 2020.10.*

Posted: 12 Jan 2022, 08:56
by createanet
Yes I do! And no, the configuration is defined in my extensions /ext/xxxxx/config/mshop.php file.

This sounds what it might be doing, moving forward is the suggestion to configure this then under the "mshop" key within the laravel shop configuration? I'm not able to test this right now, but I will look into this shortly. Thank you