Creating own modules (general)

Hi,
I’m new to OXID module development.

First:
I already read the tutorials on http://wiki.oxidforge.org/Tutorials#How_to_Extend_OXID_eShop_With_Modules_.28Part_1.29 but they didn’t gace me enough information to start developing.

Everything is installed correctly and the extending rules in the backend are set correctly.
So here my three questions. I hope somebody could help:

In general in understand modules/plugins/extensions like you could install them and use them without any changes to the core files. In the tutorials it sounds like you have to make changes to the .tpl files if you want to display something and I didnÄt found a way to do this without editing the core-tpl files.
So first question: Is there a way that I don’t see?

Is it possible to change/overwrite private methods in the core classes?
I want to change “private function _getitems()” to public in the basket class. I tried it with

public function _getitems() {
	parent::_getitems();
}

but it seems like it does not work. Someone have an idea?

Is there a way to install a module via backend? Idea: provide a .zip archiv or so that the customer only have to upload via backend and oxid does the automatic installation? Further: Is there a way to provide an “install”-script that does e.g. changes to the database or copy file from a to b or so?

Looking forward to read your ideas!

Regards,
Christopher

I’ll try to answer one by one…

[QUOTE=cbiel;62559]In the tutorials it sounds like you have to make changes to the .tpl files if you want to display something and I didnÄt found a way to do this without editing the core-tpl files.
So first question: Is there a way that I don’t see?
[/QUOTE]
There are ways to keep the modified tpl files outside the standard directories, first way is a custom theme folder that extends an existing theme and contains only modified files, second way is a custom theme folder that contains a whole new theme, third way is a new template block mechanism, with this mechanism special blocks can be changed by database entries without touching the tpl files. This block mechanism will probably be usable from 4.5.1 onwards, in the current 4.5.0 only very few blocks are available.
http://wiki.oxidforge.org/Tutorials#Understanding_theme_management_in_OXID_eShop_from_4.5.0
http://wiki.oxidforge.org/Screencasts/Smarty_Template_Handling

You cannot change protected to public, but you can make a public wrapper function:

public function getitems() {
	return parent::_getitems();
}

No, it’s all done manually. Most modules use folders “copy_this” (new files), “changed_full” (modified files), and an sql-file. You could of course provide your own installer, but without the new block mechanism it will not make too much sense imho, because template changes will still have to be applied manually.

Thanks very much at first!
Your post solves some question.

Do you know a good tutorial for that?

This is explained in the first link i gave you: http://wiki.oxidforge.org/Tutorials/Understanding_theme_management_in_OXID_eShop_from_4.5.0#Custom_themes
In short:

  1. create your theme directory in /out
  2. copy theme.php and theme.jpg from existing theme into it
  3. Adjust theme.php according to the tutorial
  4. Activate your custom theme in backend
  5. copy each file you want to modify to your custom theme folder, keeping the directory structure

(In versions below 4.5 custom theme is not activated in backend, but set via sCustomTheme option in config.inc.php. The theme.php and theme.jpg files are not needed for older versions)

thanks very much :slight_smile:

Do you have an example for overwriting a private method properly?

It is not possible to overwrite a private method. If you want to change the default behavior of a private method, you have to overwrite the method that is calling the private method and call your own method instead. The quoted example only works for protected methods, you can not access a private method this way.