Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] New product order notification via e-mail #38

Closed
mironcat opened this issue Mar 2, 2019 · 5 comments
Closed

[Q] New product order notification via e-mail #38

mironcat opened this issue Mar 2, 2019 · 5 comments

Comments

@mironcat
Copy link

mironcat commented Mar 2, 2019

Is it possible to receive an email when a new product order? I didn't find anything about it in the documentation.
Thank you for this interesting project!

@mironcat mironcat changed the title new product order notification via e-mail [Q] New product order notification via e-mail Mar 2, 2019
@fulopattila122
Copy link
Member

You have to add a listener in your application's EventServiceProvider, that listens to the OrderWasCreated event. See an example here: https://github.com/vanilophp/framework/blob/master/src/Providers/EventServiceProvider.php

Please let me know if it worked or if you need more guidance.

@mironcat
Copy link
Author

mironcat commented Mar 5, 2019

Thank you! I will try and write this if it worked or not

@mironcat
Copy link
Author

mironcat commented Mar 6, 2019

I'm a absolutely newbie at the Laravel. I create and register the file of lisener:

\app\Listeners\OrderListener.php but now I have an error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR)
Argument 1 passed to App\Listeners\OrderListener::handle() must be an instance of App\Events\Vanilo\Order\Events\OrderWasCreated, instance of Vanilo\Order\Events\OrderWasCreated given

at the listener:

//  \app\Listeners\OrderListener.php

class OrderListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
 
    /**
     * Handle the event.
     *
     * @param  OrderWasCreated  $event
     * @return void
     */
    public function handle(OrderWasCreated $event)
    {
        //
        $order = $event->getOrder();
        dd($order);
    }
}

@mironcat mironcat closed this as completed Mar 6, 2019
@mironcat mironcat reopened this Mar 6, 2019
@mironcat mironcat closed this as completed Mar 6, 2019
@mironcat mironcat reopened this Mar 6, 2019
@fulopattila122
Copy link
Member

Add

use Vanilo\Order\Events\OrderWasCreated;

to the list of use clauses in the OrderListener.php file

@mironcat
Copy link
Author

mironcat commented Mar 6, 2019

Thank you! It works!

@mironcat mironcat closed this as completed Mar 6, 2019
@Romik90 Romik90 mentioned this issue Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants