I'd like to create my own version of the product Excel import program.
I see that the file \Libraries\Nop.Services\ExportImport\ImportManager.cs has the ImportProductsFromXlsx method.
Should I just clone that program and change it to suit my needs or should I create a plugin and use that program in the plugin?
Any ideas that anyone has to accomplish this would be gratefully appreciated.
Thanks, Tony
You should create a plugin and override / extend existing behavior.
I wouldn't recommend it, but if what you're trying to accomplish is proprietary and you're alright with remembering this change for upgrades, you could modify / override the source method, or create a new partial ImportManager.
Thanks for your help. I think I will create a plugin.
AdamK wrote:
I wouldn't recommend it, but if what you're trying to accomplish is proprietary and you're alright with remembering this change for upgrades, you could modify / override the source method, or create a new partial ImportManager.
I'm not sure of what you mean by this. I think I know what proprietary means, but can you explain in another way what you are telling me?
This plugin, that I want to develop, is specific to me and it will only be for my website.
Can you advise me on how to create this plugin? Should I create a simple plugin with install and configure and have a button in the configure method to call the import method from the configure screen?
Any ideas or help that you can provide would be gratefully appreciated.
This plugin, that I want to develop, is specific to me and it will only be for my website.
Can you advise me on how to create this plugin? Should I create a simple plugin with install and configure and have a button in the configure method to call the import method from the configure screen?
Any ideas or help that you can provide would be gratefully appreciated.
If you'd like to modify the behavior of the existing function globally, you'd create a service that extends "ImportManager" and override the appropriate function.
I have worked through most of the plugin development tutorials and have a good idea of how to create a plugin.
AdamK wrote:
Adam, If you'd like to modify the behavior of the existing function globally, you'd create a service that extends "ImportManager" and override the appropriate function.
I am still learning c#, nopCommerce source, plugins and object oriented programming terminology. Can you give me more detail about what you are saying? Specifically "create a service that extends" and "override the appropriate function".
Thanks for your help, but I'm sorry I am not so literate with the terms that you use.
So, if I create a derived class inheriting the class ImportManager, I can override any method or property in that base class. Specifically the virtual method ImportProductsFromXlsx.
However, I don't see how that helps me. I want to change some of the assignment statements in the ImportProductsFromXlsx. method. For instance, price. If I want to calculate a price in my derived class, how would I do that and still have the base class do all of the other processing?
So, if I create a derived class inheriting the class ImportManager, I can override any method or property in that base class. Specifically the virtual method ImportProductsFromXlsx.
However, I don't see how that helps me. I want to change some of the assignment statements in the ImportProductsFromXlsx. method. For instance, price. If I want to calculate a price in my derived class, how would I do that and still have the base class do all of the other processing?