How can I add banner to product page? (magento) - php

I have my homepage redirected to a product page, but I still want my banners from the home page to show up.
Anyone have any clue how I can add banners to my product page ? Pretty new to Magento... Certainly not as easy as Joomla.

There are handles in Magento who decide what block to show when specific controller is called.
Take a look at this file
/magento/app/design/frontend/base/default/layout/catalog.xml and find following lines
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate">
<template>page/2columns-right.phtml</template>
</action>
</reference>
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<!-- Some more code -->
</block>
</reference>
<!-- Some more code -->
</catalog_product_view>
catalog_product_view is the handle you may want to use for displaying the banner on product page.
Pick that handle and write the block specific code.
If you want to use an extension to simplify your task here is the one.

You can call banner code on products page. Or if you want to go with simple technique, use iframe

Related

Add Filtered Layered Navigation to 1 Column Category Pages in Magento

I'm running Magento 1.9.1.0 with the RWD theme. When setting the page layout to 2 columns with left bar I can see the filters in the left sidebar correctly (sort by price etc). How can I get this working in the 1 column page layout (for categories only)? I'd like to create a full-width version of this at the top of my products using something like the Catalin SEO catalog layered navigation (for the slide price bar etc).
The 1column.phtml template does not have the left block, which is where the layer view block is usually injected. One way to do this in your local.xml is to put the block in the content (or after_body_start or before_body_end, or any core/text_list child block):
<catalog_category_default>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
<block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
</block>
</reference>
</catalog_category_default>
In your css, you can hide the layer block html if you don't want it to show but still want it to load:
.category-mycategory .block-layered-nav {
display: none;
}
mycategory is your category name.

Magento - Category Custom Layout Update

I want to add a custom CMS Block into my category per category. So I created a Custom CMS Block:
Title: TestBlock
Identifier: testblock
Then I enter into my category and under Custom Design Tab - in the Custom Layout Update textarea, I add the following
<reference name="left">
<block type="cms/block" name="TestBlock" after="catalog.compare.sidebar">
<action method="setBlockId"><block_id>testblock</block_id></action>
</block>
</reference>
This adds the content of my custom CMS Block in the sidebar, but the positioning is wrong. Instead of adding it at the bottom of the sidebar (last block is the Compare Products), it ends up at the top. Any ideas how to position it properly? I'm using Magento CE 1.9.0.1
Try not using "after" in your block, it may work.
You may try as per following.
<reference name="left">
<block type="cms/block" name="TestBlock" after="-">
<action method="setBlockId"><block_id>testblock</block_id></action>
</block>
</reference>

show magento scope switcher in admin grid edit form

I'm working on a module in magento admin where I would like to show the scope selector as in manage products, manage categories, system configuration for my grid edit form.
Can anyone help me how could I add that and store values in database specific to the scope selected?
By searching on the store switcher, you can see Magento adds it by adding it in the layout file:
<your_layout_handle_here>
<reference name="left">
<block type="adminhtml/store_switcher" name="store_switcher" template="store/switcher.phtml" />
</reference>
</your_layout_handle_here>
For not show the confirm alert add an action in this block as in a core
<block type="adminhtml/store_switcher" name="store_switcher" before="-">
<action method="setUseConfirm"><params>0</params></action>
</block>

Remove left hand column on product listings page in Magento

How do you remove the left hand column on product listings page in Magento?
I've looked in the local.xml file but I'm not sure which code I should edit.
You can change template of product listing in admin:
- Catalog->Manage Categories->Your category - tab Custom Design - field - Page Layout
OR
in your design layout xml (local.xml or something else) :
<catalog_category_layered>
<reference name="root">
<action method="unsetChild"><name>left</name></action>
</reference>
</catalog_category_layered>
OR
<catalog_category_default>
<reference name="root">
<action method="unsetChild"><name>left</name></action>
</reference>
</catalog_category_default>
also you can set anpother template in xml:
<catalog_category_layered>
<reference name="root">
<action method="setTemplate"><name>page/1column.phtml</name></action>
</reference>
</catalog_category_layered>
see template/page/ for templates.
Using local.xml (read 5 Useful Tricks For Your Magento local.xml)
<catalog_category_default translate="label">
<remove name="left"/>
</catalog_category_default>
Why do you need to remove the "left column" why don't you just change the product listing page to a different layout. i.e 2column-right.phtml, 1column.phtml, or 3column.phtml there is no need to physically remove the left column under 99% of most situations just change the layout.
First you need to create or update your local.xml file IF you do not have a local.xml file you can create one in
app->frontend->[Package Name]->[Theme Name]->layout->local.xml
Once this is created you can copy exactly what I have in this post into that file for a start of how to use one.
DO ALL UPDATES THROUGH A LOCAL.XML file not through catalog.xml !! This will make upgrades significantly easier later down the road. Additionally, you will be able to quickly see all changes you have made to your site in one file.
The below example will set the product listing page to 1column
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<catalog_product_view translate="label">
<reference name="root">
<action method="setTemplate">
<template>page/1column.phtml</template>
<!-- Below are examples of different layouts you can use
<template>page/2columns-right.phtml</template>
<template>page/2columns-left.phtml</template>
<template>page/3columns.phtml</template> -->
</action>
</reference>
</catalog_product_view>
</layout>
Hope this helps and is a guide to some newbies out there.

Magento - Trouble getting Sidebar navigation to show on category pages

This is perplexing me somewhat.
I'm on magento 1.7.
I have a left sidebar on all pages, and I'm trying to add a vertical navigation block to this side bar, to appear on all pages. So far, through editing catalog.xml, I can get it to appear on the front page, and the individual product pages, but it disappears when I visit a category page (the one that lists all the products in a category). When I try to add this block in via the "Custom Design" option for the category in the backend, it inserts the block into the sidebar 5 times, one on top of the other.
In catalog xml, right under < !-- Mage_Catalog -->
<block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/vert_nav.phtml" before="cart_sidebar" />
I think I've tried placing this is every place in catalog.xml that seemed to make sense, but I just can't figure out why I can't target the categories, and why the multiple blocks problem is happening.
I have also tried to add the block to page.xml, and although that works for the front page, it doesn't for the categories.
Thanks in advance
Please check if you have done as follows correctly.
On catalog.xml search Catalog Category (Non-Anchor) and locate <reference name="left">
by default it is
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
Change it to
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
<block type="catalog/navigation" name="catalog.vert_nav" template="catalog/navigation/vert_nav.phtml" before="catalog.leftnav" />
</reference>
Do same for Catalog Category (Anchor)
Hope above helps.

Categories