i have two custom modules that export some data to csv. In some parts they are identical, for example there are many functions that both modules need. So to avoid double-code my first idea was to extend the module from a module/class that holds the functions.
Then i saw the modules/functions.php file.
I would prefer method 1 tho.
What would be the best way for doing this in OXID?
thanks for your advice, rafael. but it would be very nice to know what would be the best way if i have some custom (own) functions that i want to use in 2 or more different modules.
Thanks, Rafael. Seems that i should take a closer look at oxid own things.
Could i extend a module (like mymodule => mysecondmodule) or instead of using mymodule_parent just use a class with all functions i need in it? (just an idea)
you can extend modules, but not the way you describe it, and there is actually no need for extending modules.
e.g. you’ve got a car, “car” is a class, and it can drive, tun around, switch the lights on and off.
now you can get a module “tuning” which contains some additional functions like playing music, some lowrider funtionality but it can also make your car drive faster (its called function override)
technically this module says to the oxid shop “take all my functions and put them into the parent class”, you have to write inside the module section in backend which class you want to exted, like “myCar => tuning”.
you can create an own class with all your functions, but the shop’s module system is already the easiest way to keep an eye on changes you have done in the shop and also keep them after a shop update.