How to create static block for customer login in magento - magento-1.9

I want to create a static block on homepage in right side for user login. Please see the below screen short:-
enter image description here

Try to update a layout XML file app/design/frontend/*DEFAULT*/*DEFAULT*/layout/.
You also may create your own local.xml file and put it in the contents.
<layout version="0.1.0">
<default>
<reference name="right">
<block type="your/type" template="path/to/your/template.phtml" />
</reference>
</default>
</layout>

Related

Add a block to product page by custom module without editing magento default template

I am trying to add a block to product page by using my custom module.
I do not want to modify any magento default files for this. I know it's possible by modifying the code in view.phtml template. Below is what I tried so far. I have copied the default magento view.phtml file in all module template folder as below. I included layout file inside config.xml of my module and written code for the block.
view.phtml file I placed under each template of module folder.
app/desifn/frontend/default/default/template/mymodule/view.phtml
config.xml file of module -
<frontend>
<routers>
<modulename>
<use>standard</use>
<args>
<module>Module_name</module>
<frontName>modulefrontname</ntNafrome>
</args>
</modulename>
</routers>
<layout>
<updates>
<modulename module="module_name">
<file>module.xml</file>
</modulename>
</updates>
</layout>
</frontend>
This file is under -
app/desifn/frontend/default/default/layout/modulename.xml
<reference name="product.info">
<block type="module_name/product_view" name="product_list">
<action method="setTemplate" ifconfig="module_name/sp_category/status">
<template>modulename/product/view.phtml</template>
</action>
</block>
</reference>
Node modulename is invalid (wrong closing tag)
<updates>
<modulename module="module_name">
<file>module.xml</file>
</module>
</updates>
and also template paths do not match
/mymodule/view.phtml
and
modulename/product/view.phtml
But back to your initial Question:
view.phtml of default template does not contain getChildHtml without any parameters. So the only way to inject custom stuff is to use a block of type core/text_list, which is "product.info.simple.extra". All you need is to make use of before or after attributes in your xml layout.

in magento, how to clear user account dashboard?

It is required to totally clear the account dashboard page, to display custom layout which varies according to logged in customer's user group.
I did the following:
<customer_account_index translate="label">
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="MyModule/Dashboard" name="block_Dashboard" template="customer/Dashboard.phtml" />
</reference>
</customer_account_index>
I can see the output of 'customer/Dashboard.phtml', but how to remove all of these widgets?
Account Information
Contact Information
...
Can't find any layout handlers, nor the template reference for them in app/core/Mage/Customer/*
Where to dig ? Thanks!!!
It was inside the app/design/frontend/base/default/layout/customer.xml under the customer_account_index node.

Magento: Override phtml inside /base/default/template

I'm trying to override
app/design/frontend/base/default/template/contacts/form.phtml.
I followed several guides without success:
I can only post one link since I don't have enough reputation to post more :(
http://www.magento.scommerce-mage.co.uk/override-phtml-or-layout-core-files-in-magento.html
In fact I'm even more confused now since they are all using different approaches. At the moment I'm trying to do it like in the last guide since this is the most up to date one(2014) without success so far.
So here is what I got:
app/code/local/Namespace/MyModule/etc/config.xml
<config>
<frontend>
<layout>
<updates>
<contactredirect>
<file>contactredirect.xml</file>
</contactredirect>
</updates>
</layout>
</frontend>
</config>
app/design/frontend/base/default/layout/contactredirect.xml
<layout version="0.1.0">
<contacts_index_index translate="label">
<reference name="contacts.form">
<action method="setTemplate">
<template>contactredirect/form.phtml</template>
</action>
</reference>
</contacts_index_index>
</layout>
And finally the location of my form.phtml (the content probably doesn't matter):
app/design/frontend/base/default/template/contactredirect/form.phtml.
Any help is appreciated!
use "contactForm" in reference name ie code should be--
<reference name="contactForm">
<action method="setTemplate">
<template>contactredirect/form.phtml</template>
</action>
</reference>

Magento, how to add static url link in Block

I am stuck at adding a url link in block programmatically, I need to add a URL to customized page which edited under CMS/page and I want to add it in .xml file by adding something like below.
<action method="addLink"
translate="label title"
module="catalog">
<label>My Account</label>
<url helper="customer/getAccountUrl" />
<title>My Account</title>
</action>
Above sample retrieve url from module, but no idea what are the parameters should be used for static CMS/page url. Please help me out.
Let me take an example of top.links block to explain this.
<block type="page/template_links" name="top.links" as="topLinks"/>
The “addLink” function is defined in Mage_Page_Block_Template_Links. The definition of the function is
public function addLink($label, $url='', $title='', $prepare=false, $urlParams=array(),
$position=null, $liParams=null, $aParams=null, $beforeText='', $afterText='')
Also the phtml file where the html code for this is written is ‘page/template/links.phtml’.
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link">
<action method="addWishlistLink"></action>
</block>
</reference>
Answer to your question is pretty simple.
Suppose we need to add a new link to top links, lets say a link for a CMS page called Terms and Conditions. To do this open a layout file, let say customer.xml and add the below code:
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Terms and Condition</label>
<url>terms</url>
<title>Terms and Condition</title>
<prepare>true</prepare>
<position>2</position>
</action>
</reference>
</default>

Image Reference issue in MVC

I am creating a line chart in one view(myChartView) and saving it as _ChartFiles/chart01.jpg.
var filePathName = "_ChartFiles/chart01.jpg";
Which is saving at /views/myChartView/_ChartFiles/chart01.jpg . Now in the very next line making a reference it as
<img src="#filePathName" />
but this is not displaying the image. what would be correct way to refer it?
If you want some static files to be accessed directly by the client, you cannot store them in the ~/Views folder because by default (for security reasons) the server would not serve content from this folder.
See ~/Views/Web.Config:
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
Try to save the files in other directory like ~/Static.
You should save it in another folder than "Views" because in MVC this is a folder conventionned for HTML view and no other content, try to save it in "fonts" or whatever else,
and it would be :
<img src="fonts/yourimage.jpg" />
Try giving the image path as
filePathName = "../views/myChartView/_ChartFiles/chart01.jpg";
or
filePathName = "~/views/myChartView/_ChartFiles/chart01.jpg";
//try this one
filePathName = "myChartView/_ChartFiles/chart01.jpg";
<img src="#filePathName" />