Restrict delivery

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!
MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Restrict delivery

Post by MikaelNazarenko » 06 Nov 2019, 07:53

I need two implementation to checkout:

1. I have two delivery methods,and for one of them I need to make it impossible to select if order sum greater than specific value. So this method must be uncheckable in this case.

2. And the second implementation is that I need to make checkout impossible if order weight greater than specific value. So I need to show message and checkout must not be possible to be finished.

Please, give me ideas how to do it better ?

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

Re: Restrict delivery

Post by aimeos » 06 Nov 2019, 12:40

MikaelNazarenko wrote: 06 Nov 2019, 07:53 1. I have two delivery methods,and for one of them I need to make it impossible to select if order sum greater than specific value. So this method must be uncheckable in this case.
Create a service decorator that implements the isAvailable() method and which returns "false" if the sum is smaller, otherwise "true": https://aimeos.org/docs/Developers/Libr ... _decorator

Afterwards, create a pull request on Github for that so we can integrate it into the core :-)
MikaelNazarenko wrote: 06 Nov 2019, 07:53 2. And the second implementation is that I need to make checkout impossible if order weight greater than specific value. So I need to show message and checkout must not be possible to be finished.
Use the weight service decorator:
https://aimeos.org/docs/User_Manual/Adm ... ors#Weight
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: Restrict delivery

Post by MikaelNazarenko » 06 Nov 2019, 13:08

Aimeos, thank you for the great support!

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: Restrict delivery

Post by MikaelNazarenko » 06 Nov 2019, 13:18

Only problem is that if isAvailable returns false - the delivery method not showed at all.. But I would like to make it uncheckable, and add small text why user can't use this method..

Also weight decorator is not what I want. I need to make checkout process impossible on specific condition and show some text when user goes to checkout ...

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

Re: Restrict delivery

Post by aimeos » 06 Nov 2019, 13:23

That will be more work to implement because for this the system isn't designed. You would have to overwrite the service frontend controller to return all options, set status for the non-available options to "false" and change the delivery template in the checkout to display the disabled options as such. You can add texts to the service items with a new type (e.g. "disabled") which you render for disabled options.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: Restrict delivery

Post by MikaelNazarenko » 06 Nov 2019, 13:35

Ok thank you! Now it is clear for me

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: Restrict delivery

Post by MikaelNazarenko » 06 Nov 2019, 17:10

But I can't find a way how to make checkout process impossible by specific condition.. Please, give me idea for it

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

Re: Restrict delivery

Post by aimeos » 08 Nov 2019, 10:34

The check() method of the basket is called at the end of the checkout process (summary page):
https://github.com/aimeos/aimeos-core/b ... rd.php#L71

You can register a basket plugin that checks if customers should be able to proceed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply