I want to remove a sidebar element for ALL checkout pages. So inside my local.xml I've got something like:
<checkout_default>
<remove name="left.cart"/>
</checkout_default>
but nothing happened... I've tried checkout, checkout_default, checkout_default_default... no bunga.
checkout_cart_index worked but only for the.. cart index page. I tried checkout_cart_default to see if that'd make it work for all cart pages but then it stopped working entirely.
What handle can I use to select ALL checkout pages?
No such handle exists/that's not how handles work.
Layout handles are sort of like events — only they apply strictly the the layout system. Every time you load a URL in the system, certain layout handles are generated. For example, using the online Commerce Bug demo on the cart index page
We can see the five handles generated are
default
STORE_default
THEME_frontend_default_commercebugdemo
checkout_cart_index
customer_logged_out
The checkout_cart_index handle is specific to that page (called the full action name handle), the others fire on all pages. There's no named layout handle that fires for all cart pages.
There are some tools to help you with code reuse. First, you'll need to identify the pages you want to target. Let's say that's checkout_cart_index and checkout_onepage_index.
Then, in you layout update XML file, do something like this
<layouts>
<checkout_cart_index>
<update handle="namespace_packagename_my_custom_handle_name"
</checkout_cart_index>
<checkout_onepage_index>
<update handle="namespace_packagename_my_custom_handle_name"/>
</checkout_onepage_index>
<namespace_packagename_my_custom_handle_name>
<remove name="left.cart"/>
<!-- other updates -->
</namespace_packagename_my_custom_handle_name>
</layouts>
What we've done here is create a custom handle named namespace_packagename_my_custom_handle_name. Then, in each full action name handle, we've told Magento to import the layout rules in our custom handle.
Sometimes Magento itself will do this. For example, Magento uses the customer_account handle to share information between different pages in the customer account section
<sales_order_history translate="label">
<label>Customer My Account Order History</label>
<update handle="customer_account"/>
<!-- ... -->
</sales_order_history>
<!-- ... -->
<sales_order_view translate="label">
<label>Customer My Account Order View</label>
<update handle="customer_account"/>
<!-- ... -->
</sales_order_view translate="label">
However, in the case of the cart pages, there is no such handle.
Related
How to hide category/menu bar on selected pages like login & registration using local.xml ?
I'm using magento 1.7.0.2
You need to remove block named 'catalog.topnav' for login and registration page handlers. The page handler similar to page URL, but all slashes replaced with '_'. For the login page it will be *customer_account_login* and for the registration page - *customer_account_create*. You can use
<remove name="[blockname]">
or
<action method="unsetChild"><block>[blockname]</block></action>
instructions, first allow you to remove block globally and the second one remove it from certain block.
The Layout update for default magento theme will looks like:
<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account_login>
<remove name="catalog.topnav" />
</customer_account_login>
<customer_account_create>
<remove name="catalog.topnav" />
</customer_account_create>
</layout>
There is some explanation about Magento layouts which can be useful - http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-4-magento-layouts-blocks-and-templates
Remove nodes will be processed after all layout handles are merged, and are a good way to remove a block regardless of which layout handle loaded the block; you just want to get rid of it entirely for some handles! It also removes recursively, so all you need to specify is the layout handle.
On the other hand, you may only want to remove a block from a reference in a specific layout handle, in which case you should use unsetChild. It is often used to remove a block from a reference, but then re-insert the same block with a different position. This would not have been possible with remove.
I want to show a sidebar in the left side of customer account login page. I have successfully placed the sidebar in the product page by calling the navigation bar in catlog.xml file.
But doing the same method with the customer.xml file is not showing the sidebar.
Note
By going through the post "Magento: Display Categories in Sidebar" I had changed my sidebar in product page. But its not working for customer login page.
You need to first tell Magento to use the 2 column template for the Customer Account Login page - as standard it uses the 1 column template file and as such wont have either the left or right structural blocks for your sidebar to go into.
Simple to do - best practice would be to add the layout instruction to an existing or create a local.xml file in your app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/ folder.
Using the handle <customer_account_login> so as to reference the login page, add the following to local.xml
<customer_account_login>
<reference name="root">
<action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
</reference>
</customer_account_login>
This will use the template with a left sidebar.
Then, also within the same <customer_account_login> handle call in your block to the left structural block...
<customer_account_login>
<reference name="root">
<action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
</reference>
<reference name="left"><!-- Tells Magento to place the following content in the left structural block-->
<!-- Your Block Goes Here -->
</reference>
</customer_account_login>
Done.
If you're not comfortable working in a local.xml file you can just amend the content of the <customer_account_login> handle in customers.xml to use the above mentioned "root" and "left" - you'll find it calls the page/1column.phtml file under root and of course wont yet have a <reference name="left">.
Please help me on this. I want to change template page layout of cart page in magento.
The following is the URL : http://www.wildgoosetrading.com/index.php/checkout/cart/
I want this to look like other pages of category.
Thanks in advance.
You'd set the template for the cart in your checkout.xml layout file.
In the checkout_cart_index section (straight after <default>) look for the following block and change the template the cart page is using;
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
EDIT
I know this is the accepted answer but soipo's answer is the better way. Apply the change to local.xml, don't modify the core layout files, override them using local.xml in your theme's layout. See http://www.classyllama.com/development/magento-development/the-better-way-to-modify-magento-layout
In your local.xml file you can just add the following:
<checkout_cart_index translate="label">
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template ></action >
</reference>
Just change the template to the one you need.
By using Magento's common setTemplate method, the inherent granularity introduced by Magento's own app/design/frontend/base/default/layout/checkout.xml is lost.
Magento deliberately created two methods for doing this: setCartTemplate and setEmptyTemplate. They handle two separate conditions.
One condition is when the cart has items, the other is when the cart is empty. By calling setTemplate, that granularity is lost. That means a cart with items and a cart with zero items will both display the same template, which might be not desired.
More on this can be found here: https://stackoverflow.com/a/33875491/2973534
I want to change my category page layout to 2columns-left.phtml. The default is a 3 column layout. I only want to set the category page layout to 2columns-left.phtml. The rest should keep the default page layout (3 columns). How can I do this?
You can do this for categories individually under the Design tab. You can do this for all categories by adding a local.xml to your custom theme's layout folder which contains the following:
<?xml version="1.0"?>
<layout>
<my_category_root_template>
<reference name="root">
<tpl>page/2columns-left.phtml</tpl>
</reference>
<my_category_root_template>
<catalog_category_layered>
<update handle="my_category_root_template" />
</catalog_category_layered>
<catalog_category_layered_nochildren>
<update handle="my_category_root_template" />
</catalog_category_layered_nochildren>
<catalog_category_default>
<update handle="my_category_root_template" />
</catalog_category_default>
<!-- EDIT: forgot about search results page -->
<catalogsearch_advanced_result>
<update handle="my_category_root_template" />
</catalogsearch_advanced_result>
<layout>
For further info, Magebase has a great Layout XML primer, and Alan Storm wrote the book on it.
I don't have much experience with magneto but i think it may work.
Go to admin->Catalog->Categories->Manage Categories
Then go to ->Custom Design
You will find Page Layout option there change that to whatever you like.
First to set up the categories: in the admin panel, select the Catalog menu. Then on the left, select the category that you wish to edit. On the right, the Custom Design tab contains the Page Layout property. If you want all categories to have the same layout, set the root category's Page Layout accordingly, and then the child categories' "Use Parent Category Settings" property to True.
The layout for all other pages will be determined by the CMS->Pages page. Click the page to modify, then on the left, select Design, and then on the right, the Layout property.
If you are wondering how to make sure that all subsequently created pages in the CMS admin area by default use a particular layout, so that you don't have to change it each time you create a new content page, I am not certain, as mine seems to default to 1column, even though the XML seems to configure the page to use 3-column (I'm referring to what is in /app/design/frontend///layout/page.xml).. I may misunderstand how that is linked to this, though, perhaps someone else can comment. My understanding is that the CMS pages have their layout settings and custom layout information stored in the database. Therefore, perhaps there is another setting in the database that choose the default when creating a new CMS page.
I have been trying to add a custom block to 'admin/sales_order_create/index' page with limited success.
The custom block does not show up after i choose a customer or clicking "create new customer". But when I refresh the page after the order loads, my custom block shows up.
I added the custom block with the following XML:
<adminhtml_sales_order_create_index>
<reference name="data">
<block type="fflshipment/adminhtml_orderlocator" name="order_ffl_locator" template="fflshipment/create_order_address.phtml"/>
</reference>
</adminhtml_sales_order_create_index>
Am I missing something?
Look again at the sales.xml file, as well as an adminhtml_sales_order_create_index handle there is an adminhtml_sales_order_create_load_block_data handle further down, this is sometimes loaded by AJAX. Your layout needs to modify both handles equally.