Decorator to use when importing products via CSV
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Decorator to use when importing products via CSV
I would like to alter some product attributes after it is saved during a CSV import.
What is the best way to go about this? I have already implemented decorators on the jqadm/product config which works fine when updating products on the admin pages, but these decorators aren't used when importing via CSV.
What is the best way to go about this? I have already implemented decorators on the jqadm/product config which works fine when updating products on the admin pages, but these decorators aren't used when importing via CSV.
Re: Decorator to use when importing products via CSV
Maybe it's better to implement a decorator for the manager save() method as this covers admin and import cases.
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: Decorator to use when importing products via CSV
Okay that looks like it might work.
Is it possible to find out the method being used (CSV import or admin page save) when using the product manager decorator?
Also, is it possible to use the view access helper (https://aimeos.org/docs/2022.x/infrastr ... rs/#access) from a manager decorator?
Is it possible to find out the method being used (CSV import or admin page save) when using the product manager decorator?
Also, is it possible to use the view access helper (https://aimeos.org/docs/2022.x/infrastr ... rs/#access) from a manager decorator?
Re: Decorator to use when importing products via CSV
No, so this method is best when the data should be always transformed in the same way.
In a job controller for importing the CSV, there's no logged in user so this won't work.yeh wrote: ↑30 Aug 2022, 14:26 Also, is it possible to use the view access helper (https://aimeos.org/docs/2022.x/infrastr ... rs/#access) from a manager decorator?
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: Decorator to use when importing products via CSV
Thanks for the feedback. I have decided to look at overriding the
Aimeos\Controller\Common\Product\Import\Csv\Processor\*
classes as I also need to compare existing product data with what is being uploaded via CSV before making changes.
Basically I would like to set the product status to review if certain fields change.
Aimeos\Controller\Common\Product\Import\Csv\Processor\*
classes as I also need to compare existing product data with what is being uploaded via CSV before making changes.
Basically I would like to set the product status to review if certain fields change.