Unique information per product

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
chiefatlarge
Posts: 1
Joined: 07 Apr 2023, 14:46

Unique information per product

Post by chiefatlarge » 10 Apr 2023, 19:52

Hello forum.

I'm wanting to include unique text/QR code per product such that when purchased this unique text/QR code is either sent along with the confirmation email or as a separate email. The information will be different for every product even if the product is the same type. Any suggestions on where to begin to do this is greatly appreciated.

Linux
PHP 8.1.2
Aimeos 2022.10

Cheers,
Richard

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

Re: Unique information per product

Post by aimeos » 11 Apr 2023, 08:50

You can create a decorator for the delivery service provider to dynamically extend the ones you currently use:
https://aimeos.org/docs/latest/provider ... ecorators/

There, you can implement the process() and processBatch() methods to add your QR-Code to the order as order service attribute:
https://github.com/aimeos/aimeos-core/b ... /Iface.php

Note: In 2023.04+, the methods have been merged and renamed to push():
https://github.com/aimeos/aimeos-core/b ... /Iface.php

The method(s) will be called when you run the order/service/delivery job controller and are used to send the orders per e-mail to the shop owner or to an ERP system and the job updates the delivery status. If the delivery status changes, an e-mail can be sent to the customer using the order/email/delivery job controller which can contain the QR code.

It would be also possible to implement a decorator for the payment service provider and implement the updateSync() and updatePush() methods but they can be called more than once by the payment service provider.

When you've generated the QR code, you can add it to the order as order service attribute using this method:
https://github.com/aimeos/aimeos-core/b ... #L490-L514
2023.04+:
https://github.com/aimeos/aimeos-core/b ... #L240-L257
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply