Magento show sidebar in the customer login page - magento

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">.

Related

Move Shop By content to Right Sidebar in Magento

I have 2columns-right.phtml. how to move Shop By contents [which is in left sidebar] to Right Sidebar
In <catalog_category_layered> handle you need to put layer navigation block in 'Right' block as below:
<catalog_category_layered>
<reference name="right">
<block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
</reference>
</catalog_category_layered>
Add the above xml code in your theme layout local.xml file.
Turn on the Template Path Hint by going to the admin then navigating to System > Configuration > Developer > Debug section. When you are in the configuration page, select the store you are working in by using the top left website/store selector. Wait for the page to reload, and then select the Developer tab.
Select ”Yes” in the select box for Template Path Hints. Click Save. Go back to the store front, and reload. It says so in the template path. The immediate directory name following “template” is the name of the module through which a template is introduced. Copy the corresponding xml file from the base package to your custom design package.
In the layout updates search for .phtml file. You will find an area that looks like this: Change it to say the following instead
(Note that all you are doing is changing left to right)
<reference name="left">
to
<reference name="right">

How link a menu group in magento (via blocks/.phtml files)

I have created a mega menu group. but i stuck at relating it to file.
All i can see form a default one is
<block type="core/text_list" name="megamenu_left" as="megamenu_left" translate="label">
<label>Left Megamenu</label>
</block>
In Home page(Backend > Design Section):
<reference name="megamenu_left">
<block type="megamenu/list" name="megamenu.list.theme" as="megaMenuLeft" template="sm/megamenu/megamenu-left.phtml">
<action method="setConfig">
<values>
<group_id>2</group_id>
<theme>2</theme>
</values>
</action>
</block>
</reference>
And in home page Front view:
<?php echo $this->getChildHtml('megamenu_left') ?>
Things i didn't get is name="megamenu.list.theme" and how this is rendering.
EDITED
how is 'megamenu_left' from xml above is linked with a menu group i created on the backend. The menu group i created on backend just have a name and 'enable/disable' option.
I'm not sure if I understand the question correctly, but the second XML bit is going to look for the reference "megamenu_left" found in the first XML part, and insert the block at that position.
The block itself has the full name "megamenu.list.theme" in the layout, with the optional shortname "megaMenuLeft". It will render the template file "sm/megamenu/megamenu-left.phtml" which will be positioned in the active theme folder such as "app/design/frontend/theme/..".
The template will be using the PHP block from module "megamenu/Block/List.php" so any $this->functionName() calls or variables accessed from within the function comes from that block.
The frontpage will load the block by name from the first part of XML, which in turn will get the content from the second part XML since it's a reference, meaning it will insert itself in the first XML.

Adding a block to magento category page using local.xml

Before posting this, i have looked in to the following, but all of them did not helped me and i was not able to add the block.
magento - adding and positioning a block using local.xml
Magento - Add phtml file to layout block
Magento 1.7:Show category image on category page in full width in a 2 column template
I want to add the category image on top of the page. Currently it is displayed under the product list view, and i want it to be above the left navigation, so that it takes full page width.
I created a template file in mytheme/template/catalog/category/image.phtml and i just added some text "I am here".
After that i add the following xml to my local.xml file under catalog_category_default
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
But it is still not working and the text is not displayed there. When this text is displayed, then i will display the category image, but for now i just want to make the block working and display it on top of the page.
Thank you
Maybe your category does not load the layout handle catalog_category_default. There are 2 handles for categories _default and _layered.
To make sure you cover both cases and so you won't duplicate markup try this approach.
define your custom handle.
<my_awsome_category_handle>
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
</my_awsome_category_handle>
Then include that handle in both category handles.
<catalog_category_default>
<update handle="my_awsome_category_handle" />
</catalog_category_default>
<catalog_category_layered>
<update handle="my_awsome_category_handle" />
</catalog_category_layered>

How to remove 'add to cart' button from one cms page only?

I have created a web store with custom CMS page which has custom layout too. This page will show all the products of the store.
On that CMS page all the product is displaying but
I want to remove 'add to cart' button, 'add to wishlist' link and 'add to compare' link from products
I want to remove these links from that specific CMS page only.
I tried
<remove name="" />
in Layout Update XML of that CMS page but I can't get specific names to remove and while searching I tried every possible name but no success.
Any suggestions?
If you have used a custom layout and you are displaying all products on that page then you must have used block type to display all products in content of that page.
Something like
{{block type="catalog/product_list_random" name="product" template="catalog/product/list.phtml"}}
Simply make a new file and save it on same loction where list.phtml is saved (obviously with different name say new.phtml
Put that new.phtml instead of list.phtml
And delete whatever you don't want to display on that page from new.phtml
You only can remove whole blocks with layout updates like that, but those links and buttons are not separate blocks but get rendered within the Mage_Catalog_Block_Product_List block. You will have to replace the template of this block with your own:
copy /app/design/frontend/base/default/template/catalog/product/list.phtml to /app/design/frontend/YOUR/THEME/template/WHATEVER/catalog/product/list.phtml (use your theme directory and a directory name under template that refers to your CMS page)
edit this copy and remove the links and buttons
in the layout update handle for your CMS page, add:
XML:
<reference name="product_list">
<action method="setTemplate" template="WHATEVER/catalog/product/list.phtml" />
</reference>
(assuming that the product list block is called product_list)
Then, depending on what you want to remove, you can put between the "default" tags the following lines:
<remove name="cart_sidebar" /> "
<remove name="catalog.compare.sidebar" /> "
http://www.hostknox.com/tutorials/magento/remove-default-blocks/manual-removal

Add image to left column on homepage

How do I add an image to the left column on the homepage?
There's a simpler way of doing this:
in the admin go to CMS->Manage Pages
select the home page to edit it
on the left select the second tab(own layout)
as the layout choose either 3 colum or 2 column with left bar
in the xml changes field add this:
<reference name="left">
<block type="core/template" name="unique.id" template="callouts/left_col.phtml">
<action method="setImgSrc"><src>imageUrl</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>alternative text</alt></action>
</block>
</reference>
6. in the xml field change "imageUrl" to the address of your image, "alternative text" to the alternative description and unique.id to a unique id like advertisement.banner.left.
Go to the magento admin site, choose System->Configuration->Advanced->Developer and turn on template tag hints. (Make sure your store name is selected in the Current Configuration Scope dropdown)
You can then go back to your store homepage and you will be able to see which template is used for the left column.
Modify the .phtml template file and add your image there.

Resources