web20matrix Posted June 28, 2012 Share Posted June 28, 2012 I need to parse any variable passed to any static page in Prestashop and replace anything that starts with "http" (in plain text) with "a href"s. I already have the regular expression but I need to know how can I do that using a module without modifying the core functions and without using override directory for classes or controllers. The variables needs to be parsed BEFORE sending the result to tpl files; I already found a solution overriding ObjectModel class but I need to do this inside a module. The problem is that it is not clear to me how I can do that because ObjectModel grabs data from database using its constructor. Somehow I need to override ObjectModel constructor within my module and be able to parse the database values before sending data to any tpl included on page. Link to comment Share on other sites More sharing options...
bellini13 Posted June 29, 2012 Share Posted June 29, 2012 can't you just override ObjectModel, and do whatever you want in the constructor function? Link to comment Share on other sites More sharing options...
web20matrix Posted June 29, 2012 Author Share Posted June 29, 2012 yes I did override the constructor but I was wondering if I can do that within the module somehow... perhaps using hooks ? Link to comment Share on other sites More sharing options...
web20matrix Posted June 29, 2012 Author Share Posted June 29, 2012 simply put, I am trying to develop a standalone module that grabs all data from database before it is displayed and replaces text based on a regular expression. Overriding ObjectModel is not a solution because someone else might override it too Link to comment Share on other sites More sharing options...
bellini13 Posted June 30, 2012 Share Posted June 30, 2012 Module does not extend the ObjectModel, so the answer is no. i think anyway you cut it, you will have to override some core class Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now