Customize delivery and payment providers

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
alkhachatryan
Posts: 4
Joined: 28 Nov 2022, 14:29

Customize delivery and payment providers

Post by alkhachatryan » 28 Nov 2022, 14:35

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?

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

Re: Customize delivery and payment providers

Post by aimeos » 28 Nov 2022, 14:46

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

alkhachatryan
Posts: 4
Joined: 28 Nov 2022, 14:29

Re: Customize delivery and payment providers

Post by alkhachatryan » 28 Nov 2022, 14:59

Excellent, thanks

alkhachatryan
Posts: 4
Joined: 28 Nov 2022, 14:29

Re: Customize delivery and payment providers

Post by alkhachatryan » 30 Nov 2022, 16:01

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

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

Re: Customize delivery and payment providers

Post by aimeos » 01 Dec 2022, 15:13

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

Post Reply