Magento > remove custom action method from layout - magento

I'm using a module that contains the action method 'SearchAutocomplete'. Could i remove this method somehow, just like with removeItem?
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<block type="searchautocomplete/layout" name="search.block">
<action method="SearchAutocomplete" ifconfig="searchautocomplete/general/enabled" />
</block>
</default>
</layout>
Right now the only solution i have is to make the changes in the xml file, which is not update-safe. Is there a better way?

According this XML you can disable this method in module configuration. Just find configuration and in General section should be selector for disable this.

Related

How do I add a new block to my layout in magento 1.9?

I have a beginner question on layouts ...After reading a lot about layouts, i am more confused than where i started. I want to add a banner block that will be displayed on my home page and a few other pages. I decided that it cannot be a part of the header.
I want to add this right below the header. I am trying to create my layout via bootstrap. I see in some themes that this is done inside the cms.xml file and i am not sure why i need to edit that. Clearly, i am confused..
Any help would be appreciated.
Go to your theme
app/design/frontend/Your-Package/Your-Theme/layout/local.xml
add below code:
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index>
<reference name="content">
<block type="core/template" name="banner" before="-" template="banner/banner.phtml" />
</reference>
</cms_index_index>
</layout>
add banner.phtml file to
app/design/frontend/Your-Package/Your-Theme/template/banner/banner.phtml
add your banner in above file
To add a block to any other page replace <cms_index_index> with <routname_controllername_actionname> For example, <catalog_product_view>.

Two layouts configuration in config.xml

I am trying to use two layout files, one for taking data from user and saving it into database and other to display content from it.I don't know how to configure config.xml for adding two layout files in magento.
Here is my layout configurations in config.xml
<layout>
<updates>
<helloworld>
<file>displaydata.xml</file>
</helloworld>
<helloworld>
<file>helloworld.xml</file>
</helloworld>
</updates>
</layout>
You can use your single layout file to define multiple handlers.
http://code.tutsplus.com/tutorials/custom-layouts-and-templates-with-magento--cms-21419
In this tutorial, at last it is specified how to use our custom layout for extension.
You can add new handler like follows.
<?xml version="1.0"?>
<layout version="0.1.0">
<mymodule_index_index>
<reference name="content">
<block type="mymodule/mymodule" name="mymodule" template="mymodule/mymodule.phtml" />
</reference>
</mymodule_index_index>
<!-- this is new handler -->
<mymodule_index_test>
<reference name="content">
<block type="mymodule/mymodule" name="mymodule" template="mymodule/test.phtml" />
</reference>
</mymodule_index_test>
</layout>
And in controller you can add relevant action for this new handler

Magento design update to replace list.phtml on search results page only

How would I issue a design update to Magento to replace the list.phtml template only for the search results page? Is there more than one way to do it? It would be ideal if there was a way to do it through the admin panel like I can for individual categories, but if not then editing an xml file is okay too.
You should create the file: app/design/frontend/YOURPACKAGE/YOURTHEME/layout/local.xml having the content:
<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<catalogsearch_result_index>
<reference name="search_result_list">
<action method="setTemplate"><template>custom/list.phtml</template></action>
</reference>
</catalogsearch_result_index>
</layout>
and to create your custom template like app/design/frontend/YOURPACKAGE/YOURTHEME/template/custom/list.phtml

Magento Google Analytics Content Experiments

What is the simplest way to implement Google Analytics Content Experiment into Magento CE?
I want to test home page content.
Adding the Testing Code to CMS pages does not work. Testing Tag is after Analytics Tag.
Does Magento support adding the Testing Tag via admin Interface?
Or is there a simple way to add the tag via XML Layout Update?
Would it be possible to use Google Tag Manager to add the codes we need?
Tags could be installed after body like:
Add to local.xml in your layout folder following code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Last loaded layout file
-->
<layout>
<default>
<reference name="after_body_start">
<block type="cms/block" name="tags-first-in-body" before="-">
<action method="setBlockId"><block_id>tags-first-in-body</block_id></action>
</block>
</reference>
</default>
</layout>
and add a static block called tags-first-in-body.
Insert code to this block.

Nesting of layout tag in Magento xml

I am not sure where to keep my layout xml in the custom module. Does it go in the config.xml of the module or a separate layout.xml is needed. How does Magento picks up the layout xml?
Right now I am using it like this, which doesn't work. A bit clueless here, any pointers? Code samples work great for me :)
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Ashfame_Adminoverrider>
<version>1.0.0</version>
</Ashfame_Adminoverrider>
</modules>
<global>
<layout>
<adminhtml_sales_order_create_index>
<reference name="root">
<reference name="form">
<reference name="data">
<block type="ashfame_adminoverrider/sales_order_create_shipping_address" as="shipping_address" template="ashfame/adminoverrider/sales/order/create/form/address.phtml" />
</reference>
</reference>
</reference>
</adminhtml_sales_order_create_index>
</layout>
</global>
</config>
Config XML and layout XML are two different things.
The config.xml files can be used to tell Magento to load a new layout xml file. Search for catalog.xml in
app/code/core/Mage/Catalog/etc/config.xml
for the correct place to put the nodes in your own XML files. You're looking for something like this
<catalog>
<file>catalog.xml</file>
</catalog>
<map>
<file>catalog_msrp.xml</file>
</map>
One you're there, place your globally uniquely named xml file in the base design package's layout folder and/or your theme's layout folder.
That should be enough to get you googling. Good luck.

Resources