Magento not showing Custom Template Page content - magento

I have created 4 CMS Page templates to use for non-product content. I have uploaded the template files to:
app/design/frontend/default/MYTHEME/template/page/ dir. The files I have uploaded are copies of the existing 1column.phtml file, but when I choose that page template from the Design->Layout pulldown menu and try to preview the page I get a blank page, no error, nothing. If I select the 1column page option the content shows properly.
Here is my config file
code/local/FL/CorporateTemplates/etc/config.xml
<?xml version="1.0"?>
<config>
<global>
<page>
<layouts>
<corporate_template_lithograph>
<label>Corporate Template - Lithograph</label>
<template>page/corp-lithograph.phtml</template>
</corporate_template_lithograph>
<corporate_template_wideformat>
<label>Corporate Template - Wide Format</label>
<template>page/corp-wideformat.phtml</template>
</corporate_template_wideformat>
<corporate_template_packaging>
<label>Corporate Template - Packaging</label>
<template>page/corp-packaging.phtml</template>
</corporate_template_packaging>
<corporate_template_photography>
<label>Corporate Template - Photography</label>
<template>page/corp-photograph.phtml</template>
</corporate_template_photography>
</layouts>
</page>
</global>
</config>
Here is my etc/module file
<config>
<modules>
<FL_CorporateTemplates>
<active>true</active>
<codePool>local</codePool>
</FL_CorporateTemplates>
</modules>
</config>

You need to define a layout_handle for each:
<global>
<!-- snip -->
<page>
<layouts>
<corporate_template_lithograph>
<label>Corporate Template - Lithograph</label>
<template>page/corp-lithograph.phtml</template>
<layout_handle>corporate_template_lithograph</layout_handle> <!-- arbitrary value -->
</corporate_template_lithograph>
<layouts>
<page>
<global>
That allows you to define the layout update which will be used in conjunction with this page layout setting in your module's layout XML file. See app/design/frontend/base/default/layout/page.xml for examples.

Related

Magento 1.9.1.0 - Upload PDF File Type in Wysiwyg Editor and show PDF Icon

I made a custom module allowing user to upload .PDF file type in CMS > Pages. The code used is below:
app/etc/modules
<?xml version="1.0"?>
<config>
<modules>
<Pdf_WysiwygFiles>
<active>true</active>
<codePool>local</codePool>
</Pdf_WysiwygFiles>
</modules>
</config>
app/code/local/Pdf/WysiwygFiles/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Pdf_WysiwygFiles>
<version>1.0.0</version>
</Pdf_WysiwygFiles>
</modules>
<adminhtml>
<cms>
<browser>
<extensions>
<allowed>
<jpg>1</jpg>
<jpeg>1</jpeg>
<png>1</png>
<gif>1</gif>
<pdf>1</pdf>
</allowed>
</extensions>
</browser>
</cms>
</adminhtml>
</config>
This works in CE-1.9 and does allow to upload PDF file when you click on Insert Image button and does not allow to link it.
Also, how to add a pdf preview icon for each file uploaded ? The result would be like below image
Use a link icon from editor to link the uploaded PDF.
Suggestion: Add a PDF icon from insert image and link the PDF after uploading from editor.

Remove layout handle from xml

I have a layout defined in some xml file found in a community module. Somehow I want to add a condition (ifconfig) by which the content of the block to be rendered or completely remove that handle and create one by myself so that I can have access to the block.
To be more specific, this is the handle I have in udprod.xml
<_udprod_catalog_product_edit>
<reference name="content">
<block type="core/template" template="udprod/product_edit.phtml" />
</reference>
</_udprod_catalog_product_edit>
<adminhtml_catalog_product_edit>
<update handle="_udprod_catalog_product_edit" />
</adminhtml_catalog_product_edit>
As you can see, the block has no name I can rely on. Is there any way I can remove the <_udprod_catalog_product_edit> handle from an xml file?
Thank you
I am not sure that is possible, but I have a work around which I use to fix buggy 3rd party extensions:
Create a new module
A very simple one, only 2 files are required.
app/etc/modules/Namespace_Fixer.xml:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Fixer>
<active>true</active>
<codePool>local</codePool>
<depends>
<Broken_Module/>
</depends>
</Namespace_Fixer>
</modules>
</config>
Note the depends, this is very important so that it is loaded after.
app/code/local/Namespace/Fixer/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Fixer>
<version>0.1.0</version>
</Namespace_Fixer>
</modules>
<global>
</global>
<frontend>
<layout>
<updates>
<broken_module> <!-- update this -->
<file>namespace/module_fixed.xml</file>
</broken_module>
</updates>
</layout>
</frontend>
</config>
Override the layout file to point to our new one.
Duplicate the layout XML
You want to point at the new XML, in there you can do the right thing and add a name to the block and call it where ever you want.

My custom CMS Layout Template in Magento is not loaded

I have created custom CMS layout for Magento according this tutorial. On my localhost(XAMPP on Win7) it is working, but when I have uploaded all 3 files to my web:
app/code/local/Lorinc/cmsLayout/etc/config.xml
app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
app/etc/modules/Lorinc_cmsLayout.xml
And it is not working there.
Here is the code of config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<version>0.1.0</version>
</Lorinc_cmsLayout>
</modules>
<global>
<page>
<layouts>
<cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And here is Lorinc_cmsLayout.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Lorinc_cmsLayout>
</modules>
</config>
I have tried everything. I have changed files and folder permissions (files 0644, folders 0755), i have used magento-cleanup.php, my cache is disabled, I have tried to logout and login again and nothing works. Any ideas what is wrong there?
just looked at your question and the first thing I saw is that you have a wrong folder structure:
The path app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
has to be changed to
app/design/frontend/default/sportsfans01/template/page/cmsLayout.phtml
Don't know if its just a typo of yours!
Furthermore you could check the logs of magento:
var/log/exception.log
var/log/system.log
Hope this will help
Regards
Vince
Please try this. I found it in App/code/core/Mage/Page/etc/config.xml for the 1column.phtml layout
<global>
<page>
<layouts>
<cmsLayout module="page" translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>page_cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
If this won't help please try with changing different theme folder.Be sure to avoid typo mistake.
Problem finally solved. I already had one custom layout (called HomeLayout) on that page so I just merged that 2 layouts. Here is the code of app/code/local/Lorinc/HomeLayout/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_HomeLayout>
<version>0.1.0</version>
</Lorinc_HomeLayout>
</modules>
<global>
<page>
<layouts>
<Lorinc_HomeLayout translate="label">
<label>HomeLayout</label>
<template>page/HomeLayout.phtml</template>
<layout_handle>HomeLayout</layout_handle>
</Lorinc_HomeLayout>
<Lorinc_cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</Lorinc_cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And it works perfect.

want to over-ride adminhtml in Magento [duplicate]

This question already has answers here:
Magento - Override adminhtml template file
(4 answers)
Closed 8 years ago.
I have set up a custom theme in Magento admin panel under "Design" tab
I can now put my custom code in
\app\design\frontend\default\MYTHEME\template
instead of
\app\design\frontend\base\default\template
I would like to do the same for the admin panel code. In other words, I would like to selectively replace vanilla code in this directory
\app\design\adminhtml\default\default\template
with custom code, likely in this directory
\app\design\adminhtml\default\MYTHEME\template
Magento does not seem to recognize this automatically.
edit - - -
For the sake of maintainability it would be beneficial to have a global over-ride like we have in 'frontend'. Over-riding module by module in the module layout may not be obvious to next person that looks at the code.
Try
In /app/code/local/MageIgniter/AdminThemeAndMod/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<version>0.1.0</version>
</MageIgniter_AdminThemeAndMod>
</modules>
<stores>
<admin>
<design>
<theme>
<default>mageigniter</default>
</theme>
</design>
</admin>
</stores>
</config>
In /app/etc/modules/MageIgniter_AdminThemeAndMod.xml
<!-- /app/etc/modules/MageIgniter_AdminThemeAndMod.xml -->
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<active>true</active>
<codePool>local</codePool>
</MageIgniter_AdminThemeAndMod>
</modules>
</config>
Then add your newly add/update files to
/app/design/adminhtml/default/mageigniter/layout/
/app/design/adminhtml/default/mageigniter/template/
/skin/adminhtml/default/mageigniter/
for "/app/etc/modules/MageIgniter_AdminThemeAndMod.xml", you mean -
<?xml version="1.0"?>
<!-- /app/etc/modules/MageIgniter_AdminThemeAndMod.xml -->
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<active>true</active>
<codePool>local</codePool>
</MageIgniter_AdminThemeAndMod>
</modules>
</config>

Magento Module for new CMS layout, but in version 1.7.0.2

I'm trying to simply create a new layout option for a CMS page in Magento. I've followed the instructions here on the Magento wiki to create a module and it does not work. When I make the same addition to the actual core config.xml file, it works fine, but not as a custom module. Based on some research it looks like this would have worked in Magento 1.6, but does not work on 1.7, I'm trying to figure out why. I have the following:
app/etc/modules/Fruit_Banana.xml
<?xml version="1.0"?>
<config>
<modules>
<Fruit_Banana>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Fruit_Banana>
</modules>
</config>
app/code/local/Fruit/Banana/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Fruit_Banana>
<version>0.1.0</version>
</Fruit_Banana>
</modules>
<global>
<page>
<layouts>
<homepage_middle translate="label">
<label>Homepage</label>
<template>page/homepage.phtml</template>
<layout_handle>homepage_one</layout_handle>
</homepage_middle>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
Any ideas why it doesn't seem to be working as a module? I am using version 1.7.0.2
The local modules should be in the code directory
app/code/local/Fruit/Banana/etc/config.xml
and not in the core directory as you mentioned
app/code/core/local/Fruit/Banana/etc/config.xml
Well seems like I messed up! It does in fact work in 1.7, my problem was I had the filename for config.xml spelled confix.xml
Once I adjusted that, the custom layout popped right up! Thanks to those that chimed in.

Resources