Saturday, November 22, 2014

Easy tips if overriding the core magento Blocks, Models or Controller through rewrite doesnot work.

In this tutorial i will go through the process of overwriting the magneto core and community files to your local folder.
As we all know it is the first thing that we all learn while working in magento is "Don't Ever Modify The Core Files". This statement is very true because it creates problem if we need to upgrade to another version and also to find out the modified files. That's why we override the core modules to our local files.Some times we need to override the modules from Community folder too.

We can override the modules block or models or controller by rewriting it config.xml file in our local module and then apply our changes there. But overriding the files using rewrite is not always easy.There may occur some problems and you may not be able to override those files.So what could we possibly do in these cases?
I also have faced this problems sometimes, when you think all your configuration is correct but the files in not overridden.
The solution i am going to tell is not the best way of doing it but it works and doesn't create other issues.
The solution is to make the same directory structure in your "local" folder as the files that you want to override and paste that file there. For example if you want to override "app/code/core/mage/adminhtml/block/customer/grid.php", you just need to create "app/code/local/mage/adminhtml/block/customer/grid.php".

And in this file you can make the changes.No need to do any other changes.

Now after that i have told the solution i want to tell what is going on. Actually we aren't overriding the file we are overwriting it.To understand this first you need to understand how magento reads the file.I will not explain the whole flow but for now it is that at first it searches file at "local" folder than "community" and at last in "core" folder.So if you create the same folder structure magento first look to your local folder and it finds it and execute it.
The problem with overwriting is you need to copy the whole file because inside it there may be many functions and if you delete any one function from there than magento will not look for that function in core and will display error. But overriding is a different case if you override the file than you can only add or modify those functions in your overridden file and no need to copy other unrelated functions in your file.

Now from above tutorial you will be able to overwrite the magento files and another thing is you may have understand the difference between overriding and overwriting.





Friday, November 14, 2014

Why should we blog?

Hi there,
This is my first post on this blog. From today onwards i am gonna take blogging quite seriously. Serious means not in that way but in the sense that having my views shared. I previously did some startup on blogging but i never continued it. Hope this time it will work out.
So first thing that comes in mind before blogging is why to blog?? This may be in most people mind. I also did think in that way and another thing that strikes into our mind is what to blog?? These two questions determine our motive and vision towards blogging.
So today i am gonna share my views about the question mentioned above and try to put forward some reasons that why we should start blogging and what should we blog about.
The answer for why should we blog could be many, some of them are listed below:
  • Blogging could be one way to express our feelings to others about something.
  • It is the expression of what we see or what we feel or what we know.
  • It provides a good feeling of sharing our knowledge to other which may help them.
  • It can increase our intellectual level and dig out our creativity.
  • We can learn many things in this phase of blogging
  • And last but not the least, you should blog because for FUN. That's the most important thing.You will get chance to write about the thing that will give you happiness or that will motivate you.
That's some point for why should we blog. Now you may have made your mind that "ok lets Blog!". But you most of us get confused about what to write?
 This is another difficult question with a simple answer.  Just blog what you like or what you know or what you want to share. It may be your feelings, your idea, your knowledge anything let it flow and this will bring a satisfaction in you. Ok let's take an instance that today you thought of something intresting or you learned something new just share it. Blogging is not only for professionals these are for all common people who may have that vision,wisdom and little knowledge of blogging I guess. You may be the expert in your field and you may have that knowledge that other may not have so share it.

That's all needed to start. Blogging is the great way to communicate with people worldwide and you can make it a habit. So best of luck to those who had just started blogging and at last i just wanna say Happy Blogging.