shopware5 / shopware

Shopware 5 core
https://shopware.com
Other
1.32k stars 804 forks source link

Core sArticles deprecated #56

Closed terwey closed 11 years ago

terwey commented 11 years ago

Hi,

according to annotation in the sArticle Class: https://github.com/ShopwareAG/shopware-4/blob/master/engine/core/class/sArticles.php#L35 it's been deprecated. However it's still being actively used by code and I wanted to modify this file itself. However since it doesn't (to me anyway, considering the only docs I could find on Shopware Extending were in German (which I understand most of the time :p)) seem to follow the other Classes in naming/extending I'm not totally sure how to Extend this file. I need to do this cause I want to take function sGetCategoryProperties https://github.com/ShopwareAG/shopware-4/blob/master/engine/core/class/sArticles.php#L1247 And replace it with a modified version. I now for testing purposes just hacked it in and it works flawlessly but I'd like to release it as a Plugin :)

So two questions: 1) What will replace sArticles 2) How do I currently extend upon sArticles in a way I can release it as a Plugin? Referring me to docs is absolutely not an issue. I might have overlooked/not found the correct one.

Thank you

dnoegel commented 11 years ago

Hi terwey,

1) Currently there is no replacement for the core classes and right now I can not tell you, when and how this will happen. So working with the core classes is perfectly fine until we have a transition plan. 2) You might be interested in this tutorial about our Hook System: http://wiki.shopware.de/_detail_981.html#Hooks There is even an example of replacing a method in sArticle with a custom method.

A (very) stripped down example of such a plugin can be found here: http://wiki.shopware.de/_detail_934_487.html Just download the archive (the link is titled "Download: Gepackte Beispiel Plugins aus der Entwicklerschulung") and navigate to /Core/EventsHookExample3.

Right now most of our developer-docs are still german - I hope this will change over time :)

Best regards

terwey commented 11 years ago

Hi @dnoegel,

thank you for your reply. I've managed to build a Plugin now instead of hacking on top of Core code :) This is a bit slower (cause it loops twice through data now) but eventually more "Plug 'n Play".

If your interested it's here: https://github.com/terwey/YTCategoryProperties A license I have not picked yet.

Concerning the docs, yes it's a shame most of them are now in German. It makes sense with Shopware being a German company and all but on a global market it's a bit of a shame cause Shopware is a LOT more modern then the alternatives (which either lack docs or have none at all either haha).