show delivery service if basket contains voucher

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
gizmo
Posts: 24
Joined: 18 Jan 2021, 20:42

show delivery service if basket contains voucher

Post by gizmo » 30 Oct 2021, 10:04

In the shopI have a voucher (with a voucher product) and if the customer buys it, aimeos generates a voucher code and sends it via e-mail. This works as expected.

The challenge arises if the customer buys a physical product and a voucher at the same time. Then the shipping costs have to be added since there is at least one physical product in the basket.

I've created three delivery services. One to show only if the basket contains the categories of the physical products. Second one that only shows if non of the physical products categories are in the basket (category.exclude) and the voucher product category is in the basket (category.include). The third delivery service should show if there is a at least one phyiscal product and at least one voucher in the basket. The third one is set to show if the product category voucher is in the basket (category.include). But now the third option also shows up if the customer only has a voucher in the basket.

Is there a way to check if the basket contains a voucher? I checked the "download" provider, but since the voucher product does not contain a downloadable product it does not work.

I'm using:
TYPO3 10.4.21
Aimeos 21.7.2
PHP 7.4
Apache Webserver

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

Re: show delivery service if basket contains voucher

Post by aimeos » 01 Nov 2021, 11:35

You can use the Weight decorator to show only two shipping options, one for physical (+voucher) products and one for virtual (voucher) products only. This requires to add a weight to each product.

If that isn't an option, you can always write your own service decorator in implement isAvailable() with the conditions you need.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

gizmo
Posts: 24
Joined: 18 Jan 2021, 20:42

Re: show delivery service if basket contains voucher

Post by gizmo » 23 Nov 2021, 09:54

Thank you for the answer, I will give this a try and else I try to write my own decorator

Post Reply