Page 1 of 1

Customize delivery and payment providers

Posted: 28 Nov 2022, 14:35
by alkhachatryan
OS: Ubuntu 20.04 LTS
PHP: 7.4
Laravel: 8.83
Aimeos-laravel: 2021.10.6

Hello. I have a shop for local and world wide market. I want to make some customizations in delivery and payment providers.
So if you are from local market (Armenia) you can choose pay via cash after delivery, or if you are from another country, you will not be able to choose that.

Or another case:
If you are from Armenia, but selected devlivery is Fedex, you will not able to post pay via cash, because fedex shipper will not get that money :D

So where can I put these rules between delivery and payment providers?

Re: Customize delivery and payment providers

Posted: 28 Nov 2022, 14:46
by aimeos
Use the "Country" service decorator to limit delivery options by the country the customer selected in the address tab:
https://aimeos.org/docs/latest/manual/s ... s/#country
https://aimeos.org/docs/latest/manual/s ... ors/#usage

To hide the "Cash on delivery" payment option if "Fedex" has been chosen, you need to implement your own decorator that does the check:
https://aimeos.org/docs/latest/provider ... ecorators/

Re: Customize delivery and payment providers

Posted: 28 Nov 2022, 14:59
by alkhachatryan
Excellent, thanks

Re: Customize delivery and payment providers

Posted: 30 Nov 2022, 16:01
by alkhachatryan
Hello. I couldn't find a way and place to make. Would you provide me more info?
I created an extended and empty decorator class, but even couldn't find it in admin panel when editing a service.
Maybe I need to add that class name some where? Or clear some cache after class creation?
I need to "enable" it so I could start to develop and debug my code. Because as I understand it's not so ease to make what I want

Re: Customize delivery and payment providers

Posted: 01 Dec 2022, 15:13
by aimeos
Service decorators are found automatically if they are placed in the right location, e.g. in your own Aimeos extension in:

Code: Select all

./packages/<myext>/src/MShop/Service/Provider/Decorator/
No caching or other activation needed. Also check that your decorator uses the correct PHP namespace.