show magento scope switcher in admin grid edit form - php

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>

Related

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>

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

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

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.

Magento Cart Template Update Not work when first visit a page

I want to override the exist cart template since I add some module in it. I use the XML below to update the layout.
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate">
<value>magefd/shipandpay/checkout/cart.phtml</value>
</action>
<action method="setEmptyTemplate">
<value>checkout/cart/noItems.phtml</value>
</action>
<action method="chooseTemplate"/>
<block type="fdshipandpay/checkout_cart_fee" name="magefd.shipandpay.cart.fee"
as="fee" template="magefd/shipandpay/checkout/cart/fee.phtml" />
</reference>
</checkout_cart_index>
However, the original template will be used when a new user visit the cart at first time. After they refresh, it work perfect. After session time out if the user refresh it, the same problem comes out. I don't know how it happened. Any one can help?
Just copy your .phtml file to all templates directories..eg, Default, and Base theme..Clean cache and try again..

Making a new page template for a different product page

I've been trying to figure this problem out for several hours now - I've made two page templates for the products one is named vxs-view.phtml and the other is view.phtml. There located in the same directory.
The solution I tried was to input
<reference name="product.info">
<action method="setTemplate"> <template>catalog/product/view/vxs-view.phtml</template></action>
</reference>
However this only works if that product is in a certain category. Is there a way I can add the pay layout to the template files in the design tab?
I've been adding this code to the front end system/custom design/ custom layout update box
Sorry I'm need to magento and still learning.
Thanks for any help
you are placing wrong reference type. Please try below code.
<module_page_action> <!- Enter your modulename_pagename_action e.g. catalog_product_info-->
<reference name="root">
<action method="setTemplate"> <template>catalog/product/view/vxs-view.phtml</template></action>
</reference>
<module_page_action>
Hope this will work for you!
Cheers!

Categories