Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3606 by alfredlaggner
07 Nov 2016, 17:53
I have a store pick up delivery system. I want to avoid bogus orders from unverified users because it would create unnecessary work for getting orders ready that get never picked up.
One solution I am considering is a simple verification process where a user needs to verify they got the order verification email by clicking a link in the email. (Like when you sign up for a service on the internet).
I could not find anything like that in aimeos.
For it to function, I would have to create a random number when the user gets inserted into the user database. This random number would the be part of URL the user has to click in the 'thank you for your order' email. After clicking the link user will be set to 'verified' by setting a verified column in the user database.
After verification, the delivery status should be set to the next status (either to pending or progress I am not sure right now).
What would be the simplest way to program this in Aimeos/Laravel? Or can you think of a solution the fits better with Aimeos?
#3611 by aimeos
08 Nov 2016, 14:21
If you want to do it every time, you can create a hash over selected address and product data and add that link to the confirmation e-mail. After the customer clicked the link, your own action can verify the hash by hashing the same data again and set the delivery status of that order to "in progress".

Also, it may be only necessary to send a verification link once to the customer when they create the account. There's already a "verification date" column in the users/customer table:
- https://github.com/aimeos/aimeos-laravel/blob/master/src/database/migrations/2015_03_06_000000_aimeos_users_table.php#L36
- https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Customer/Item/Iface.php#L128

You can create a hash over the customer data and add it to the account creation e-mail:
https://github.com/aimeos/ai-client-html/blob/2016.10/client/html/templates/email/account/html-intro-body-default.php
In your own action, you can then update the verification date field if the customer clicked on the link and you've verified the hash.
#3724 by alfredlaggner
08 Dec 2016, 01:27
I have been able to set the delivery status to "in progress" by having the customer click on a link in their confirmation email. But every time they do that the system creates an empty screen on their browser.
How can I avoid that? Is AJAX the solution? If yes, how do I put the code in 'html-intro-body-default.php"? What I want is that status change happens in the background. The change of status then triggers a confirmation email which already works.
Thank you.
#3727 by aimeos
08 Dec 2016, 15:15
You can't do that in the context of an e-mail. Clicking on the link will always open a browser and it will display the page returned by the web server. Your controller/action updating the status should display a page with "Thank you for your confirmation. You will be notified as soon as you can pick up your order"