Why is Magento not picking up my theme template file for transactional email order? - email

I made some template changes to Magento's New Order transactional email template in the backend. The textual changes at the top of the email (in the "thanks for your order..." section) worked fine. But when I change the templates for the order details, they are not appearing in my email.
I have created two files within my template which I thought would override the email:
app/design/frontend/default/mythemehere/template/email/order/items.phtml
app/design/frontend/default/mythemehere/template/email/order/items/order/default.phtml
These are referenced in my sales.xml file in app/design/frontend/default/mythemehere/layout
<sales_email_order_items>
<block type="sales/order_email_items" name="items" template="email/order/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
<block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="2" align="right" style="padding:3px 9px"</value></action>
<action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
<action method="setIsPlaneMode"><value>1</value></action>
</block>
</block>
</block>
<block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>
However, when I place my order, I get the base template in the email.
If I commit the Cardinal Sin in Magento of overriding base template files (app/design/frontend/base/default/template/email/order ...), lo and behold, I see my changes! Seems Magento is very keen to use its base template.
I have overridden other templates in the sales section (eg: sales/order/view.phtml, sales/order/print.phtml), and various posts on Magento's forums indicate I'm doing the right thing in concept. But alas! It's just not working for me.

To use your custom theme file for order email "app/design/frontend/default/mythemehere/template/email/order/items.phtml"
In the admin go to System->configuration->design
Select your website from the top left
Now in the themes template uncheck the checkbok and add the theme name.

I had the same problem. I discovered that the emails will use the /app/design/frontend/default/default templates before the 'base' templates. So if you copy the base templates into the default/default folder your files will not be overwritten on update.
However it is still not ideal as this is still outside your theme folder, however it is better than using 'base' files. I still haven't found a true solution.

This kind of situation happens because if we mention wrong values under System>Configuration>General -> Design section
We can have following two scenarios.
1) Default package with custom design
2) Custom package
If we do not fill correct values under Current Package Name field then issue mentioned in the question will occur.
It happened with me when I was using a custom package but had given value as
default under Current Package Name field.
We should configure the theme properly so that Magento can follow theme fallback properly.

Overwriting templates in base/default and default/default is strongly discouraged, because updating Magento will overwrite those directories.
What worked for me (with emails) is to put the modified files under app/design/frontend/your_design_package/default/templates/.

Related

How can I use a custom package structure in a GWT project?

I'm using the regular GWT project structure that is generated when creating a new GWT project via the Eclipse GWT plugin, e.g. com.mycompany.mygwtmodule.client for all the client stuff that is GWT-compiled into JavaScript.
Now I want to add some client code with a custom package structure, e.g. org.othercompany.somepackage...
Is that doable? And, if so, how?
I don't need a workaround, if it's not doable. However, it may still be helpful for you to know, why I want to do this: The custom package structure is from a 3rd-party GWT module that is used by my GWT project. I just need a small set of classes from it which I copied into my project instead of including the whole module which contains lots of stuff I don't care about. Those classes are using each other. As I do not want to touch their code at all, I am keeping their original package structure.
What I tried is to add <source path='my-eclipse-project-path/src/org/othercompany/somepackage'/> to my gwt.xml, but in hosted mode I'm getting the error: "No source code is available for type org.othercompany.somepackage.SomeClass; did you forget to inherit a required module?"
No, I didn't ;-) The code is all there, but I couldn't make GWT find it.
Thanks for any helpful comments!
Its Better you create two separate modules ,since you are taking the code from some other 3rd party jar.
First create module which contain the package structure
- com.mycompany.mygwtmodule (one module)
Second create another module
-org.othercompany.somepackage (another module)
Inherit the second module in first module.gwt.xml
<inherits name="org.othercompany.somepackage" />
You need to add the other source package in your sources.
This is done in your module.gwt.xml. There is an element source, that will list all source packages to be included for client:
<source path="client" />
<source path="shared" />
will include all packages in client and shared into the frontend code.
Details can be found here: http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuidePathFiltering
Update: if your packages have no common package you need to create two seperate modules and one inherits the other.
We use this a lot, it works out very nice.

umbraco tiny mce absolute urls

i'm having a issue on tiny mce on umbraco 6.
When i add a image or link on tinymce the urls are converted from
http://domainx.com/images/someimage.png
to
domainx.com/images/someimage.png
i've added a few configurations to tinyMceConfig.config
<config key="relative_urls">false</config>
<config key="convert_urls">false</config>
<config key="remove_script_host">false</config>
but now url's are created without the http or https wich results in wrong path and we can't see the images on the tinymce.
Did you configure any hostname on any node? If so, add the missing part.
What you are describing is a function of TinyMCE and not Umbraco itself. I don't have enough "Rep" to comment, otherwise I would ask what version of TinyMCE is installed/running in your version of Umbraco.
However, while it would appear as though you are on the correct path with your configurations, the documentation (http://wiki.moxiecode.com/index.php/TinyMCE:FAQ) says you need to simply add "convert_urls = false" to the customConfig section of tinyMceConfig.config (like below), the Umbraco community appears to be reporting it as a bug (http://issues.umbraco.org/issue/U4-374).
<customConfig>
<config key="convert_urls">false</config>
...
</customConfig>
Have you tried using //www.example.com rather than http://www.example.com as a possible workaround?
It is possible to do custom configuration settings for TinyMCE in umbraco (documentation).
I couldn't find a correct documentation for changing settings, which are of the type boolean, to false.
After a while and changing some settings I needed, i've found a way to do it! Just leave the value empty in the customConfig-section:
<customConfig>
<config key="convert_urls"></config>
</customConfig>
This resulted in being able to enter (almost) anything as a link, without it being converted.

Mapping ui:field in GWT to generated code

I'm trying to get some automated UI testing going on a GWT application and I'm having trouble finding a way to track UI elements.
For example, I have the following:
<g:Button text="Submit" ui:field="submitButton" enabled="true" />
which generates:
<button class="gwt-Button" type="button">Submit</button>
Its a compiler error to set both ui:field and id (id is considered deprecated anyway) so the problem is that I have no easy way to select my submit button using something like selenium.
Is anyone aware of a way I can map the
ui:field="sumbitButton"
to the generated HTML?
After further investigation I've discovered that you can enable debugIds which are ment for testing purposes. If you add:
<inherits name="com.google.gwt.user.Debug"/>
to your *.gwt.xml file you can then set debugId on your ui elements as such:
<g:Button text="Submit" ui:field="submitButton" enabled="true" debugId="submitButton"/>
and also in the codebehind by using the ensure debug id method
submitButton.ensureDebugId("submitButton");

The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>

Here is my form:
<form action="j_security_check">
<h:panelGrid columns="2" bgcolor="#eff5fa" cellspacing="5" frame="box" styleClass="center">
<h:outputLabel value="User ID:"/>
<h:inputText id="j_username" tabindex="1" />
<h:outputLabel value="Password:"/>
<h:inputSecret id="j_password"/>
<h:outputLabel value=""/>
<h:commandButton id="login" value="Login"/>
</h:panelGrid>
</form>
It work fine with Glassfish 3.0.1, but since Glassfish 3.1 b2 it shows this warning as a FacesMessage in the JSF page:
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
If I change the <form action="j_security_check"> to <h:form>, it does not fix it, I have to place the <h:form> inside the <h:panelGrid>.
This is just a Warning not an Error. Warnings are usually there to inform the developer about unforeseen situations/conditions which might not immediately cause technical errors/problems. Anything may just work flawlessly, but the behaviour/results may probably not be as the developer intented. A newbie developer may for example accidently have used <form> instead of <h:form>. Warnings like this are then helpful.
In your particular case, you are simply forced to use <form> because of the need to submit to a non-JSF service. You as a more experienced developer know that it's legitimately valid. You can just ignore this warning. This warning will only appear when javax.faces.PROJECT_STAGE is set to Development anyway and not appear when it is set to Production.
However, that it still displays the warning when there's another component like panelgrid in between the form and its input children, is a bug to me. I'd report it to the Mojarra guys. It look like as if it is checking the immediate parent only and not all of the parents. Update: it has been fixed as per Mojarra 2.1.3/2.2, see also issue 2147.
This is by the way not Glassfish specific. The newer GF version of course ships with a newer Mojarra version which has those warnings implemented. See also issue 1663.
Related questions:
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
This was suggested to me by Oleg from the PrimeFaces forum and works:
<h:form id="login" prependId="false"
onsubmit="document.getElementById('login').action='j_security_check';">
Regards,
Brendan.
It only shows if you are in JSF Development based on your web config.
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
When you change it to Production it wont show anymore
If anyone will find this usefull one day,
i had same error and the problem was that i have primefaces component
<p:something ....
and that component was not inside <h:form> element
I'm using Mojarra 2.1.27 and find out that this is my mistakes. However its just very hard to find what the mistakes was. Hopefully someone from Mojarra could add component id to the warning messages.
Here is what I did to found out the component: (which also posted to https://code.google.com/p/primefaces/issues/detail?id=1586#c48)
I trace it by downloading the Mojarra source code and adding break point to com.sun.faces.context.FacesContextImpl class in method:
public void addMessage(String clientId, FacesMessage message).
when the break point catch, open the Debugging window or call stack window to find out that it was called by class
com.sun.faces.application.view.FormOmittedChecker
in method
private static void addFormOmittedMessage(FacesContext context)
which is previously called by method
public static void check(FacesContext context).
inside the check method there is parameter variable component.
You can get the component id from Watch or variable window and then trace it back to your html page and code.
Its a hard way, but hope you can find the root of the problems. It will be much more simpler if the warning message also display the problematic component id
In my case, this warning message was displayed in p:messages which I've put in dialog to show validation errors, so I've just included severity="error"in p:messages and warning message was gone.

JSF Validation not finding custom ResourceBundle class

I have a custom ResourceBundle class org.example.web.UILabels.java which works well in running code but the JSF editor in Eclipse is not finding it, I assume the editor/validator is only looking for properties files by the name. This also means I no longer get type ahead find on the resources which was very nice to have.
Any ideas how this could be rectified?
<f:loadBundle basename="org.example.web.UILabels" var="uiLabels"/>
...
<h:outputText value="#{uiLabels.someTextValue}" />
...
I am getting the error message (in the problems error list)
Resource bundle org.example.web.UILabels cannot be found on classpath
Type=JSF Problem
Eclipse3.4.0 with WebStandardTools Versions
Version:1.4.0.v200802280619-13-7w311917141518
Version:1.5.1.v200802280619-1407w311917141519
Version:3.0.0.v200806092130-7A-8Y8QqN2lf4VSWrI2ek5Pf4k7s
For more about why I am using a ResourceBundle class instead of just a properties file see Question 653682 how-to-override-some-resources-from-a-propertyresourcebundle
Thanks for your time, David Waters
The resource-bundle element is more efficient than the f:loadBundle action since the bundle can be created once for teh entire application. However its a JSF 1.2 feature and if u want to be compatible with JSF 1.1 you must use JSF 1.1. Heres an example if your using JSF 1.2:
Define it in your faces-config.xml like this:
<application>
<resource-bundle>
<base-name>org.example.web.UILabels</basename>
<var>uiLabels</var>
</resource-bundle>
</application>
Sorry for not answering your question, but I dont have first hand experience with Eclipse. I also misunderstood your question first, therefor Ive edited my original answer.
I had the same problem, I finally find this sollution :
Eclipse search only the default properties, your project has to have a properties with no locale, for example, with :
<f:loadBundle basename="i18n.messages" var="msg" />
Eclipse will only search "i18n/messages.properties".