Customer manager save event
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!
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Customer manager save event
I need to export customer when it was saved. But not in all cases. In some case it must not do import. I have added logic to my custom customer manager saveItem() method. But problem is that I can't tell to manager when I don't need to make export or another action. I need make export of customer when it was saved on admin panel or front-end. I tried to add field 'makeExport' to manager or customer entity but it still makes export when I don't need it.... Can you, please, suggest me something.. ? I hope my problem is understandable )
Re: Customer manager save event
Add your decorator only for frontend and backend but not for command in your ./config/shop.php:
https://github.com/aimeos/aimeos-larave ... #L104-L108
https://github.com/aimeos/aimeos-larave ... #L104-L108
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
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: Customer manager save event
Thank you! But can you please clarify how this settings with decorator must look like:
And how the decorator must look like for this specific case ? Ideally it must catch the customer saving. So when customer saved from backend or frontend - my logic will do necessary things
Code: Select all
'frontend' => [
],
'backend' => [
],
Re: Customer manager save event
You have to implement the saveItem() and saveItems() method in your manager decorator:
https://aimeos.org/docs/Developers/Libr ... s#Easy_way
Configuration for frontend and backend would be:
https://aimeos.org/docs/Developers/Libr ... s#Easy_way
Configuration for frontend and backend would be:
Code: Select all
'frontend' => [
'customer' => [
'manager' => [
'decorators' => [
'local' => ['Myproject']
]
]
]
],
'backend' => [
'customer' => [
'manager' => [
'decorators' => [
'local' => ['Myproject']
]
]
]
],
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
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: Customer manager save event
Aimeos, thank you very much !!
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: Customer manager save event
One moment, it that documentation from your post, the class \Aimeos\MShop\Common\Manager\Decorator doesn't exist in newest versions of Aimeos. Which class should I use ? I guess \Aimeos\MShop\Common\Manager\Decorator\Base this one ?
My config looks like:
My decorator:
But when I save some customer in backend nothing happens..
What the problem ?
Versions of the components:
My config looks like:
Code: Select all
'backend' => [
'customer' => [
'manager' => [
'decorators' => [
'local' => ['Customer']
]
]
]
],
Code: Select all
namespace Aimeos\MShop\Customer\Manager\Decorator;
class Customer extends \Aimeos\MShop\Common\Manager\Decorator\Base
{
public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
{
die;
// do something before
$result = $this->getManager()->saveItem( $item, $fetch );
// do somthing afterwards
return $result;
}
}
What the problem ?
Versions of the components:
Code: Select all
aimeos/ai-admin-jqadm 2019.10.3 Aimeos ai-admin-jqadm extension
aimeos/ai-admin-jsonadm 2019.10.1 Aimeos ai-admin-jsonadm extension
aimeos/ai-client-html 2019.10.4 Aimeos ai-client-html extension
aimeos/ai-client-jsonapi 2019.10.1 Aimeos JSON API extension
aimeos/ai-controller-frontend 2019.10.2 Aimeos ai-controller-frontend extension
aimeos/ai-controller-jobs 2019.10.2 Aimeos ai-controller-jobs extension
aimeos/ai-gettext 2019.10.1 Aimeos Gettext extension
aimeos/ai-laravel 2019.10.1 Laravel adapter for Aimeos web shops and e-commerce solutions
aimeos/ai-payments 2019.10.1 Payment extension for Aimeos web shops and e-commerce solutions
aimeos/ai-swiftmailer 2019.10.1 SwiftMailer adapter for Aimeos web shops and e-commerce solutions
aimeos/aimeos-core 2019.10.2 Full-featured e-commerce components for high performance online shops
aimeos/aimeos-laravel 2019.10.1 Professional, full-featured and high performance Laravel e-commerce package for online shops and complex B2B projects
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: Customer manager save event
Are you sure that it works ? For me doesn't.. And I can't find documentation for this for 2019 version..
Re: Customer manager save event
Indeed, it's
Sorry for that, documentation is fixed.
Code: Select all
class Myproject extends \Aimeos\MShop\Common\Manager\Decorator\Base
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
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: Customer manager save event
My problem is because nothing happens when I save the customer from admin panel (back-end). But there is a die; I described my files in couple posts above..
This is my decorators path /var/www/schmuck/ext/labor/lib/custom/src/MShop/Customer/Manager/Decorator/Customer.php
And decorator looks like:
I can't understand what is the problem.. I also tried to set wrong decorator in settings like:
But no any errors....
Maybe because I extended customer manager and sqls for insert, update, search.. But it should not..
Thanks for the help !
This is my decorators path /var/www/schmuck/ext/labor/lib/custom/src/MShop/Customer/Manager/Decorator/Customer.php
And decorator looks like:
Code: Select all
namespace Aimeos\MShop\Customer\Manager\Decorator;
class Customer extends \Aimeos\MShop\Common\Manager\Decorator\Base
{
public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
{
die;
// do something before
$result = $this->getManager()->saveItem( $item, $fetch );
// do somthing afterwards
return $result;
}
}
Code: Select all
'backend' => [
'customer' => [
'manager' => [
'decorators' => [
'local' => ['CustomerNotExisting']
]
]
]
],
But no any errors....
Maybe because I extended customer manager and sqls for insert, update, search.. But it should not..
Thanks for the help !
Re: Customer manager save event
You forgot the "mshop" key in your config:MikaelNazarenko wrote: ↑05 Nov 2019, 16:58Code: Select all
'backend' => [ 'customer' => [ 'manager' => [ 'decorators' => [ 'local' => ['CustomerNotExisting'] ] ] ] ],
Code: Select all
'backend' => [
'mshop' => [
'customer' => [
'manager' => [
'decorators' => [
'local' => ['Customer']
]
]
]
]
],
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