hacking protected functions with dev console

OXID loves using protected functions in it’s model classes.

E.g. there is getCustomerAlsoBoughtThisProducts() function in oxArticle, which returns articles even if they are not active anymore. Isn’t that cool?

lets try to debug this crazy stuff.

This function gets it’s sql query for loading also-bought articles from another protected function and returns the article list.
So there is no way for you to see the sql query generated by the protected function. Well, fuck!

What you was used to do:

To debug that little piece of shop you had to insert custom var_dump into the protected function. Oh, you are using encoded PE or EE? Sorry for that 🙂 In this case you had to create new module and extend oxarticle with a custom public function calling this particular protected function and returning its response.

What you can do now:

Basically its the same stuff as you would do without dev console, but you don’t need to create a whole module and install/register it in your shop. Its dead simple:

Holy cow, it works!

so i got this output:

apparently this query does not check if the parent article of the bought variant is active or not. E.G. if you have a deactivated parent article but it’s variants are still active, this function will load and display the articles. But when someone clicks on the article link in frontend, he will be redirected to the start page, because of deactivated parent article. Yep, i love OXID.


you can get dev-console here:

you can get the whole devutils package from my github account: https://github.com/vanilla-thunder/vt-devutils. For more description and installation instructions visit this page: http://marat.ws/vt-devutils/



0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *