Magento: local.xml doesn't show block - magento-1.5

So I have empty package where is stored local.xml
(Paths I don't describe here, all caches disabled, error logs turned on).
I've added static block in admin panel. It is named "two_level_links".
Then I added code to local.xml:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="header">
<remove name="top.links"/>
<block type="cms/block" name="topTwoLevelLinks">
<action method="setBlockId">
<block_id>two_level_links</block_id>
</action>
</block>
</reference>
</default>
</layout>
In the header phtml file call it:
<?php echo $this->getChildHtml('topTwoLevelLinks') ?>
top.links disappeared but topTwoLevelLinks didn't appear.
Then I looked at Mage_Core_Model_Layout_Update and set a var_dump for getFileLayoutUpdatesXml [$layoutXml]. The source has my block.
Cannot understand what I should do next. How to debug it? Or where I'm doing wrong?

everything looks fine, but let me suggest you to check next things:
Check in admin panel if your block is enabled.
If you have more than one store view, please check if you your block is associated to your current store view, that you see on the frontend
Check in which folder header.phtml file is placed. For example if you changed the header.phtml from your base theme folder "app/design/frontend/base/default", Magento never will know about it if you also have header.phtml in "app/design/frontend/custom_package/custom_theme/" ... if it is not clear enough, please read: http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy

Related

Automation Steps not firing for custom screen?

I have used automation steps to add an action menu to an existing screen, add approval automation and other automations to an existing screen, and control fields/values of existing screens. Each of those cases appear to work fine. However, I have added a new custom screen that does not require approvals, and automation steps seem to do nothing for me other than adding an action item to the menu.
What would prevent my custom screen from executing my simple automation steps? I have 1 view set as the data member for both the form and tab in a form/tab screen used to break up the data to keep the data simple for the end user to view. The only thing working is that the Action menu option "Convert to Repair" is added to the screen, although it is not disabled as intended nor the status updated when the hold checkbox is changed.
Automation Definition:
<?xml version="1.0" encoding="utf-8"?>
<Screens>
<Screen ScreenID="ZI302000">
<Step StepID="Hold -> Open" Description="Hold -> Open" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="False" Value2="False" Operator="And" />
<Filter FieldName="Status" Condition="Equals" Value="H" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="O" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
<Step StepID="On Hold" Description="On Hold" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="True" Value2="False" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="H" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair" IsDisabled="1">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
</Screen>
</Screens>
As it turns out, it seems the automation steps referenced a node id of an earlier version of the page. After experimenting with some formatting of the page, I removed it and started over. By not removing the old automation steps entirely, the system was firing automation for a page referenced by an outdated node id.
Solution: Delete the automation steps entirely and start over. In my case, I deleted the automation definition as well because I had tried deleting the automation steps before but not the automation definition with no success. I also deleted the site map to the page, the files from the customization project, the files from the OS, and recreated it all from scratch. Once confirmed that automation steps were working on the newly recreated page, I was able to go to a backup copy of the aspx file and paste the contents into my new page aspx file in the customization project to restore all my work on the layout and settings.

How to remove a specific block from right column which must be shown on rest of the pages?

I had created a static block containing images aligned vertically then I added an xml block for calling it in the right column in catalog.xml.
Now it is showing that block on all pages .
BUt I dont want just this specific block to be displayed on detail page . So how can I restrict it not to be shown on detail page while showing on rest of the pages.
I did tried to remove it by this:
<remove name="right.info" />
And this is the block I'm calling:
<block type="core/text_list" name="banners">
<block type="cms/block" name="right.info">
<action method="setBlockId"><block_id>right_logos</block_id></action>
</block>
</block>
<reference name="banners">
<action method="unsetChild"><name>right.info</name></action>
</reference>

Magento login and register form one page

I am trying to combine the login form and create account form in Magento into one page. The reason is i just think the fewer pages the better. I find Magento confusing and have limited understanding of its layout and template system. I decided the easiest way to do this would be to just add the login form to the register account page. I found the login form and register form in login.phtml and register.phtml in template/customer/form/.
I simply copied the PHTML code from login.phtml into the register.phtml file that is in the same directory. This is what I ended up with:
http://pastebin.com/fpkeBsxc
After I fill in the email and password of an account and click login, the page returns with validation errors referring to the register account form bellow it. Basically, I'm not sure if this is because my approach is completely stupid/wrong and I can't just copy and paste code like this, or is this a simple html problem that I can't see? I think might be wrong way, as register form works. I'll post a screenshot of this in a comment, it won't let me paste more than one link. Thanks for any advice.
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml" />
</block>
</reference>
by this u can put html where do u want to place in customer/form/login.phtml
<?php echo $this->getChildHtml('customer_form_register') ?>
In customer.xml within your theme you can move the account register block to within the login page.
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block> </reference>
</customer_account_login>
In order to merge the customer registration form with the default login form of Magento, just note the following steps:
1. Creating mini.register.phtml file
First you need to create a new template file: app/design/frontend/[your-interface]/[your-theme]/template/customer/form/mini.register.phtml
And copy the contents of default register file: app/design/frontend/base/default/template/customer/form/register.phtml to the mini.register.phtml and customize as per your requirement.
2. Including mini.register.phtml in login.phtml
First copy the file: app/design/frontend/base/default/template/customer/form/login.phtml to your current theme as:
app/design/frontend/[your-interface]/[your-theme]/template/customer/form/login.phtml
And now you need to modify the new login.phtml so that you can include the contents of mini.register.phtml.
For this, you have to use the following xml code in your layout xml file (preferably in app/design/frontend/[your-interface]/[your-theme]/layout/local.xml) as:
<customer_account_login translate="label">
<reference name="content">
<action method="unsetChild"><child>customer_form_login</child></action>
<block type="customer/form_login" name="customer_form_login2" template="customer/form/login.phtml" >
<block type="customer/form_register" name="customer_form_register2" template="customer/form/mini.register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" />
</block>
</block>
</reference>
<reference name="head">
<action method="setTitle" translate="title" module="customer"><title>Login or Create an Account</title></action>
</reference>
</customer_account_login>
Now you can simply include the mini.register.phtml in your new login.phtml file as:
<?php echo $this->getChildHtml('customer_form_register2'); ?>
You're done.
Now clear the cache and reload the customer login page: http://your-mage-store/customer/account/login
You should do it slightly different:
get to know the magento layout and how it works
use layout references to include both existing forms in to one template
let them submit to their existing controllers

How to disable a remove statement from local.xml in Magento

Is it possible to disable a <remove name="left"> statement defined in a default layout .xml file, from the local.xml file?
For example, in the checkout.xml in the <checkout_cart_index> section, the statement <remove name="left"/> is defined there, but can you disable that line from the local.xml file, so you still see the left menu on the checkout page?
By default Magento doesn't provide an <unremove /> tag for local.xml. However, the Layout system contains the right events, such that you can implement this yourself. And by "yourself", I mean I've created an experimental extension that adds such a tag. Feedback is welcome.
The two ways I do this are;
Use Alan Storm's excellent unremove plugin above.
Re insert the removed block in local.xml with a new name attribute but the same alias or 'as' attribute.
The name attribute needs to be different because Magento's <remove name="foo" /> is global - it removes all instances of <block name="foo" /> even if they are added after the remove instruction. To re add the left column, for example;
<reference name="root">
<block name="left.2" as="left" type="core/text_list">
<!-- New left column is empty, so you'll need to add your left-column blocks into it here. -->
</block>
</reference>
name="left.2" means the remove action won't kill this block, as="left" means that it will still be inserted into your template via <?php echo $this->getChildHtml('left') ?>.
Unfortunately, your newly inserted left column is empty. So you'd have to re insert any blocks in there that you want to show as well. Making Alan Storm's plugin all the more useful, I think.
When a block is removed it is not destroyed, only ignored. You might be able to 're-enable' it with:
<checkout_cart_index>
<reference name="root">
<action method="append"><block>left</block></action>
</reference>
</checkout_cart_index>
I've never used this myself and wouldn't want to, if you are making a custom theme then copy the base layout files and edit them directly just as the other answers recommend.
your answer is not to disable the removal but to add it again in your local.xml
Rather than trying to reconstruct the entire set of blocks, comment the remove inside the original XML. This will be less of a maintenance headache than trying to reconstruct the blocks and worrying about precedence of the XML files, etc.
Turn this
<remove name="left" />
Into
<!-- disabling remove because X -->
<!-- <remove name="left" /> -->

Magento Layout.xml <remove ...> tag not having desired effect

I have a "auth-redirect" module that is in the beginning of all my page layout files (1column, 2column, etc). This works to make sure that before rendering any page, if the user is not authenticated properly then it redirects to a login page.
The way that I allow the login page to render is in my customer.xml file I declare the following:
<customer_account_login>
<remove name="auth-redirect"/>
...
</customer_account_login>
This works fabulously.
However I recently created another module custom module and when I go to the urls that engage that module's controller and render the modules layout the auth-redirect stays in the page and thus I always get redirected.
The custom module layout looks like this:
<shipment_management_index>
<remove name="auth-redirect"/>
<reference name="content">
<block type="custom/vendor_shipment_info" template="custom/vendor/shipment/info.phtml" name="info"/>
</reference>
</shipment_management_index>
Now, I've gone to the page and using Alan Storm's showLayout module gotten the output from ?showLayout=page. You can see that the element for auth-redirect is in the page, down below the body, but at the top auth-redirect is still in the page. What am I missing?
<layout><block name="formkey" type="core/template" template="core/formkey.phtml"/>
<block type="page/html" name="root" output="toHtml" template="page/1column.phtml">
<block type="page/html" name="auth-redirect" as="auth-redirect" template="page/html/auth-redirect.phtml" ignore="1"/>
<block type="page/html_head" name="head" as="head">
...
</block>
...
<remove name="auth-redirect"/>
<reference name="content">
<block type="custom/vendor_shipment_info" template="custom/vendor/shipment/info.phtml" name="info"/>
</reference>
</reference></layout>
Is your last piece of code in the same file ? If so, why not trying to comment/delete the first
<block type="page/html" name="auth-redirect" as="auth-redirect" template="page/html/auth-redirect.phtml" ignore="1"/>
If not, maybe the code below will work if the "auth-redirect" block you want to remove is nested into the "formkey" block.
<reference name="formkey">
<action method="unsetChild"><name>auth-redirect</name></action>
</reference>

Resources