Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Understanding Models in Custom Modules for Magento
 
ikk0
Jr. Member
 
Total Posts:  16
Joined:  2008-07-28
 

Hi everybody,

I am trying to understand how custom modules in magento work.
So, the models are for MySQL 4 and 5. But I don’t understand some things happening in it.
I looked at the CatalogSearch module under /code/core/Mage/CatalogSearch/

1. Are MySQL 4 and 5 so different that we need two different models?
2. Why are MySQL 5 models all in one directory as .php files, and MySQL 4 models in different directories each?
3. If you look at the CatalogSearch example - I _DON’T_ understand how these models work. The helper uses function from the MySQL 4 and 5 models?

Are there any tutorials or explanations out there which can tell me how to use these models, understanding them?

Hope somebody can help me smile

Greetings
ikk0

 
Magento Community Magento Community
Magento Community
Magento Community
 
ikk0
Jr. Member
 
Total Posts:  16
Joined:  2008-07-28
 

..bump? :-(

 
Magento Community Magento Community
Magento Community
Magento Community
 
ylibrach
Sr. Member
 
Total Posts:  78
Joined:  2008-07-06
 

The Mysql4/5 classes are definitely a little confusing. I am guessing Magento assumes that most databases will be v5, so it uses this as the default. However, I’ve noticed than in many, many instances, the Mysql4 classes are used, despite the fact that Mysql 5 is installed. I’m not sure why this happens and it is definitely slightly ambiguous. I asked some people in the IRC channel and everyone seems mystified by this as well.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ikk0
Jr. Member
 
Total Posts:  16
Joined:  2008-07-28
 

Yes, I asked people in IRC, too, and nobody knew what’s the sense of them.
It’s very confusing. Does nobody know what’s the sense behind this? How can we get the Magento team to answer this?

Greetings

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Just as a note, for many modules, you won’t need to create these mysql php files in order unless you are doing changes to the DB that was not thought of by Magento (Not that this post is really helpful, but I thought I’d share my perspective on custom modules - I’m with you on being very confused by the Models in Magento rasberry )

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top