Custom gift voucher feature
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Custom gift voucher feature
Hello, I am currently trying to implement a gift voucher feature where every user will have a virtual wallet attached to their account.
I am trying to get an idea if there is a better way or a built in way to do this.
Note : We are using React.js on the frontend and using aimeos as a backend via the REST API.
My way of thinking is to create for example 4 products with a custom type "Voucher"
- 100 £ Voucher
- 50 £ Voucher
- 25 £ Voucher
- 10 £ Voucher
At first when the user purchases the gift voucher let's say for example a "100 £" voucher, during the purchase process, the user will not get asked to enter a shipping address and will not have the ability to pay for the voucher with their account balance.
For this I was thinking of implementing a separate process to pay for vouchers and not use the default cart behaviour process, so that the user can choose the voucher and directly pay for it.
After the payment process is complete, the user will get an email that contains the voucher code, he can then either apply the voucher to their account or send it to a friend.
For this I was thinking of creating a separate table in the database to store a randomly generated voucher code that we are going to generate on the backend and the voucher value and a boolean so that the code can only be used one time only.
After the voucher code is applied on an account, the account balance will change accordingly to the voucher value.
To hold the account balance I was thinking of creating another table in the database that is linked to the user id.
When the user tries to purchase products from the site, and if the account balance is greater or equal to the cart total, the user can use their account balance as a payment method and pay for their cart.
For this I was thinking of creating a custom payment service named for Example "Account Balance" so that when we create an order we set the payment method to that service.
I am trying to get an idea if there is a better way or a built in way to do this.
Note : We are using React.js on the frontend and using aimeos as a backend via the REST API.
My way of thinking is to create for example 4 products with a custom type "Voucher"
- 100 £ Voucher
- 50 £ Voucher
- 25 £ Voucher
- 10 £ Voucher
At first when the user purchases the gift voucher let's say for example a "100 £" voucher, during the purchase process, the user will not get asked to enter a shipping address and will not have the ability to pay for the voucher with their account balance.
For this I was thinking of implementing a separate process to pay for vouchers and not use the default cart behaviour process, so that the user can choose the voucher and directly pay for it.
After the payment process is complete, the user will get an email that contains the voucher code, he can then either apply the voucher to their account or send it to a friend.
For this I was thinking of creating a separate table in the database to store a randomly generated voucher code that we are going to generate on the backend and the voucher value and a boolean so that the code can only be used one time only.
After the voucher code is applied on an account, the account balance will change accordingly to the voucher value.
To hold the account balance I was thinking of creating another table in the database that is linked to the user id.
When the user tries to purchase products from the site, and if the account balance is greater or equal to the cart total, the user can use their account balance as a payment method and pay for their cart.
For this I was thinking of creating a custom payment service named for Example "Account Balance" so that when we create an order we set the payment method to that service.
Re: Custom gift voucher feature
We would suggest that solution:
- Create a new product type "voucher"
- Implement a decorator for the basket controller like the existing ones that handles the new voucher products (https://github.com/aimeos/ai-controller ... /Decorator)
- Generate the voucher codes in that decorator and add them as order product attributes
- Often, customers will have mixed baskets with voucher+articles so they should be able to buy them together
- Extend the payment related e-mail to show the voucher codes if the order has been payed (same as downloads)
- Add a new table e.g. "users_balance" that will contain the amounts that have been bought and redeemed (like a bank account with contains each "transaction"), the reason and the voucher code
- Implement some code so users can add vouchers resp. their amounts to their account balance. There you can check if a voucher has already been redeemed
- Implement a new payment service provider (e.g. AccountBalance) that calculates the latest balance
- Customers should be able to pay partly with their balance if the have not enough. This requires Aimeos 2018.01 because there it's possible to have multiple payments per order
- Create a pull request with your changes to get them into the Aimeos Core
- Create a new product type "voucher"
- Implement a decorator for the basket controller like the existing ones that handles the new voucher products (https://github.com/aimeos/ai-controller ... /Decorator)
- Generate the voucher codes in that decorator and add them as order product attributes
- Often, customers will have mixed baskets with voucher+articles so they should be able to buy them together
- Extend the payment related e-mail to show the voucher codes if the order has been payed (same as downloads)
- Add a new table e.g. "users_balance" that will contain the amounts that have been bought and redeemed (like a bank account with contains each "transaction"), the reason and the voucher code
- Implement some code so users can add vouchers resp. their amounts to their account balance. There you can check if a voucher has already been redeemed
- Implement a new payment service provider (e.g. AccountBalance) that calculates the latest balance
- Customers should be able to pay partly with their balance if the have not enough. This requires Aimeos 2018.01 because there it's possible to have multiple payments per order
- Create a pull request with your changes to get them into the Aimeos Core
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom gift voucher feature
At the moment I am trying to implement such a virtual wallet for users.
Therefore I created the new product type "balance".
Now I want that when buying such a product (after successful payment) the value is stored in the table user_balance.
Where is the best place to do that? Should I implement a special controller for the new product type?
Therefore I created the new product type "balance".
Now I want that when buying such a product (after successful payment) the value is stored in the table user_balance.
Where is the best place to do that? Should I implement a special controller for the new product type?
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
Re: Custom gift voucher feature
The gift card / voucher feature is part of the core since at least 2018.10, so you only have to create a product of type "Voucher" and run the job controller for "order/email/voucher" regularly:
https://aimeos.org/docs/Laravel/Configu ... jobs#Setup
https://aimeos.org/docs/Laravel/Configu ... jobs#Setup
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom gift voucher feature
I don't want to use the voucher feature.
Our customer needs a very special contingent/wallet feature.
To archive that I should know the place where I can execute code for a special product after successfully payment.
Our customer needs a very special contingent/wallet feature.
To archive that I should know the place where I can execute code for a special product after successfully payment.
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
Re: Custom gift voucher feature
You can either create a new job controller that loads the order and performs the actions to need. In that case you have to make sure that the actions are only performed once per order: https://aimeos.org/docs/Developers/Cont ... controller
The better alternative might be to create a delivery service decorator which receives the order item only once so you don't have to care about duplicate actions because the order/service/delivery job controller does that for you: https://aimeos.org/docs/Developers/Library/Service
The better alternative might be to create a delivery service decorator which receives the order item only once so you don't have to care about duplicate actions because the order/service/delivery job controller does that for you: https://aimeos.org/docs/Developers/Library/Service
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom gift voucher feature
But can I also use a decorator if the user select "Prepay" as payment method and the admin sets the payment status to "received" in the backend later?
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
Re: Custom gift voucher feature
Setting the order payment status in the backend doesn't call the payment provider and its decorators. It only marks the order for being ready to process by the delivery service provider and its decorators.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom gift voucher feature
Thanks for your help!
That solves my problem.
That solves my problem.
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3
Re: Custom gift voucher feature
Hello,
I have a question to the gift card / voucher feature: the voucher product(s) should not have a shipping cost, but when its mixed with a regular product the shipping cost should be 4,95€ (DHL).
How can I solve this?
thanks
I have a question to the gift card / voucher feature: the voucher product(s) should not have a shipping cost, but when its mixed with a regular product the shipping cost should be 4,95€ (DHL).
How can I solve this?
thanks