tags:

views:

400

answers:

3

Hi,

I am following the book "Php Architects Guide to Programming Magento" where i try to incorporate rewards feature in magento.

My problem is that the rewardpoints.xml file is not being parsed. What triggers Magento to parse the xml files(updates) from the Layout folder? Why is it not parsing rewardpoints.xml file? I know it is not parsing because i left an error in the xml file and it is not showing up

Here is the rewardpoints.xml with the error(closing tag

rewardpoints/dashboard_points.phtml

Any explanation will help. Thank You Margots

+3  A: 

A few quick guesses. If this doesn't work, let me know and we can try other things.

First, make sure you tell Magento that the layout exists. In your module config, make sure the following XML exists. You may need to change from <frontend> to <adminhtml> if you are currently developing the backend. Make sure that the layout file is in the corresponding layout directory (adminhtml or frontend).

<config>
    <frontend>
        <layout>
            <updates>
            <rewardpoints>
                <file>rewardpoints.xml</file>
            </rewardpoints>
            </updates>
        </layout>
    </frontend>
</config>

Next, make sure that the problem isn't a cached file. Head to your admin panel and click System > Cache Management. Either refresh or disable the cache for "Layouts". When developing a module, it often helps to disable the cache entirely so that you can immediately see your changes.

Finally, significantly less likely, but make sure that Magento can read your file. You don't specify anything about your environment, so I can't give specific commands, but make sure that your webserver has permission to read the layout file.

Hope that helps.

Thanks, Joe

Joseph Mastey
+1 - Those are the three places to look. I'm guessing caching.
Laizer
Joe, your first suggestion did it. I wonder why would I have to explicitly tell magento this time when i didn't do other times? I was trying to answer to this question myself by adding router info in config file(without your above code) to see if layout xml will be parsed. Nope, it did not, so when does magento automatically parses layout file and when i have to explicitly tell about my layout xml file in config.xml? Thanks again for answering my questions and helping me learn
Margots
Magento exclusively uses the XML list of files to decide which files to parse for layout information. If you check again, it's likely that somewhere in your Magento installation those files are included for layouts (many tutorials include them but never explain why you are adding them).Thanks,Joe
Joseph Mastey
I see...that also explains, perhaps, why there was times I had to give up never able to make work some of my new modules. This is very helpful. Thank you again.This is my first post here, is there point system in place where you get points for helping. Please let me know if i can do that or there is other way i can thank
Margots
Absolutely no problem. I believe convention is to uptick my response above. Best of luck!
Joseph Mastey
A: 

Sorry Joe, It looks like I do not have enough reputations to vote at this time but will keep you in mind in case I get there one day.

Best, Margots

latvian
A: 

I'm trying to do a similar thing, but the layout only works if I put into one of the following directories:

app/design/frontend/base/defaut/layout/[MYMODULE].xml
app/design/frontend/[PACKAGE]/defaut/layout/[MYMODULE].xml

I don't want to put it into the former because I read that base/default should stay the same, always. I don't want to put it into the latter because it's my theme package folder, which is not the correct place for an unrelated module.

I'm running 1.4.1.1. Where should I put this file?

EDIT: Got an answer on #magento

<Groenleer> mattalexx: you should not modify wiles in app/design/frontend/base  i (personally) see no problems in adding XML files. Hence it is the only directory you can trust on is present on the user system.
<rooty> mattalexx: place it in base (or default if your still coding 1.3)
<mattalexx> rooty, 1.4.1.1
<rooty> it will bubble up
<mattalexx> I've heard I should completely not touch that folder, as if it were part of the core.
<rooty> well thats true if your writing a customer module
<rooty> but if its a community module your planning on releasing to everyone
<rooty> thats the place to put it in
<mattalexx> rooty, I like to write customer modules as if I am to be releasing it to the world later. Usually it means that they're more portable
<mattalexx> Hm, okay, that's great. Thanks rooty 
<Groenleer> then go with the base/default
<Groenleer> but don't change any existing files to make yours work.

TL;DR: Use app/design/frontend/base/defaut/layout/[MYMODULE].xml

mattalexx