Magento: How to add promo code form on one page checkout page? - magento-1.8

I want to add a promo code form programmatically on one page checkout page of Magento 1.8 CE. This has to be added under payment review section.
Added following snippet to layout/checkout.xml of active theme:
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
then added following php code to template/checkout/onepage.phtml
But its not working, please help!
<?php echo $this->getChildHtml('coupon') ?>

In checkout.xml layout file add as following,
<block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
...
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
...
</block>
And put the following code in app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/checkout/onepage/review/info.phtml
<?php echo $this->getChildHtml('coupon') ?>

Related

How to Hide Or Remove URL Rewrite Management in Sub Menu in Magento

Can anyone help me on how to remove or rather hide a sub menu in any of the menus in magento.
The image below may describe what I need in a clearer manner.
I want to, let's say hide the URL Rewrite Management.
How will I do it.
Thanks for the help.
//Working example code for remove catalog->url rewrite management sub menu.(As per below screenshot)
//Create a file called adminhtml.xml under /etc folder of your module:
<?xml version="1.0" encoding="utf-8"?>
<config>
<menu>
<catalog>
<children>
<urlrewrite> <!-- Same as <convert> -->
<depends>
<module>HideMe</module> <!-- Fake dependance to hide menu item -->
</depends>
</urlrewrite>
</children>
</catalog>
</menu>
</config>
More details

Breadcrumb menu in wordpress

I am stuck on how to create a breadcrumb menu in my wordpress so that when I select the main menu, the path shows its first inner menu. For example I have a main menu About us and Company Profile as its child. When I am select the About us, I want to get the Compony profile page and also the breadcrumb like About us / Company profile. Is there any way to do so? any plugins? I currently using Breadcrumb NavXT plugin for creating breadcrumb
You can add breadcrumb without using any plugin like this. Please add below code into your themes functions.php file.
function breadcrumbs($id = null){
?>
<div id="breadcrumbs">
Home</span> >
<?php if(!empty($id)): ?>
<a href="<?php echo get_permalink( $id ); ?>" ><?php echo get_the_title( $id ); ?></a> >
<?php endif; ?>
<span class="breadcrumb_last"><?php the_title(); ?></span>
</div>
<?php }
Now whenever you want to add breadcrumb just call this function like this.
<?php breadcrumbs(); ?>
As you mentioned above you have to add about page id into this function and call this to company profile page if this page is child page of about page than this works.
<?php breadcrumbs($id); ?>

Magento: local.xml doesn't show block

So I have empty package where is stored local.xml
(Paths I don't describe here, all caches disabled, error logs turned on).
I've added static block in admin panel. It is named "two_level_links".
Then I added code to local.xml:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="header">
<remove name="top.links"/>
<block type="cms/block" name="topTwoLevelLinks">
<action method="setBlockId">
<block_id>two_level_links</block_id>
</action>
</block>
</reference>
</default>
</layout>
In the header phtml file call it:
<?php echo $this->getChildHtml('topTwoLevelLinks') ?>
top.links disappeared but topTwoLevelLinks didn't appear.
Then I looked at Mage_Core_Model_Layout_Update and set a var_dump for getFileLayoutUpdatesXml [$layoutXml]. The source has my block.
Cannot understand what I should do next. How to debug it? Or where I'm doing wrong?
everything looks fine, but let me suggest you to check next things:
Check in admin panel if your block is enabled.
If you have more than one store view, please check if you your block is associated to your current store view, that you see on the frontend
Check in which folder header.phtml file is placed. For example if you changed the header.phtml from your base theme folder "app/design/frontend/base/default", Magento never will know about it if you also have header.phtml in "app/design/frontend/custom_package/custom_theme/" ... if it is not clear enough, please read: http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy

Magento login and register form one page

I am trying to combine the login form and create account form in Magento into one page. The reason is i just think the fewer pages the better. I find Magento confusing and have limited understanding of its layout and template system. I decided the easiest way to do this would be to just add the login form to the register account page. I found the login form and register form in login.phtml and register.phtml in template/customer/form/.
I simply copied the PHTML code from login.phtml into the register.phtml file that is in the same directory. This is what I ended up with:
http://pastebin.com/fpkeBsxc
After I fill in the email and password of an account and click login, the page returns with validation errors referring to the register account form bellow it. Basically, I'm not sure if this is because my approach is completely stupid/wrong and I can't just copy and paste code like this, or is this a simple html problem that I can't see? I think might be wrong way, as register form works. I'll post a screenshot of this in a comment, it won't let me paste more than one link. Thanks for any advice.
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml" />
</block>
</reference>
by this u can put html where do u want to place in customer/form/login.phtml
<?php echo $this->getChildHtml('customer_form_register') ?>
In customer.xml within your theme you can move the account register block to within the login page.
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block> </reference>
</customer_account_login>
In order to merge the customer registration form with the default login form of Magento, just note the following steps:
1. Creating mini.register.phtml file
First you need to create a new template file: app/design/frontend/[your-interface]/[your-theme]/template/customer/form/mini.register.phtml
And copy the contents of default register file: app/design/frontend/base/default/template/customer/form/register.phtml to the mini.register.phtml and customize as per your requirement.
2. Including mini.register.phtml in login.phtml
First copy the file: app/design/frontend/base/default/template/customer/form/login.phtml to your current theme as:
app/design/frontend/[your-interface]/[your-theme]/template/customer/form/login.phtml
And now you need to modify the new login.phtml so that you can include the contents of mini.register.phtml.
For this, you have to use the following xml code in your layout xml file (preferably in app/design/frontend/[your-interface]/[your-theme]/layout/local.xml) as:
<customer_account_login translate="label">
<reference name="content">
<action method="unsetChild"><child>customer_form_login</child></action>
<block type="customer/form_login" name="customer_form_login2" template="customer/form/login.phtml" >
<block type="customer/form_register" name="customer_form_register2" template="customer/form/mini.register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" />
</block>
</block>
</reference>
<reference name="head">
<action method="setTitle" translate="title" module="customer"><title>Login or Create an Account</title></action>
</reference>
</customer_account_login>
Now you can simply include the mini.register.phtml in your new login.phtml file as:
<?php echo $this->getChildHtml('customer_form_register2'); ?>
You're done.
Now clear the cache and reload the customer login page: http://your-mage-store/customer/account/login
You should do it slightly different:
get to know the magento layout and how it works
use layout references to include both existing forms in to one template
let them submit to their existing controllers

Relative URLs in Sharepoint master page

I have a master page with tabs. The tabs are defined by the following sitemap file:
<siteMap>
<siteMapNode title="Home" url="~/" >
<siteMapNode title="Schedule" url="~/Pages/Tab2.aspx"/>
<siteMapNode title="Deliverables" url="~/Pages/Tab3.aspx"/>
<siteMapNode title="My Items" url="~/Pages/Tab4.aspx"/>
<siteMapNode title="Management" url="~/Pages/Tab5.aspx"/>
<siteMapNode title="Working Docs" url="~/Pages/Tab6.aspx"/>
</siteMapNode>
</siteMap>
The problem is that on my subsites, clicking on a tab keeps taking me back to the root. For example, I want the schedule link to go to http://Server/Subsite/Pages/Tab2.aspx. Instead, what I am getting is http://Server/Pages/Tab2.aspx. I read that having a tilde at the beginning of the link would solve this problem but it doesn't.
I spent HOURS looking for the answer to this question, and it turns out there IS one, it's just annoying. You can use the ProjectProperty tag in WSS sites AND MOSS sites, and one of the possible parameters for ProjectProperty gives you the subsite's URL.
<SharePoint:ProjectProperty Property="Url" runat="server"/>
That outputs a string literal with the value of the subsite URL. So, for example, you can do this (note that you need to use single-quotes for the src='' or href='' attribute of the actual HTML tag):
<a href='<SharePoint:ProjectProperty Property="Url" runat="server"/>/pages/Tab2.aspx'>
Hope it helps! For a listing of other possible values for ProjectProperty, check out this guy's page (which is where i found my original answer!)
I was looking for an answer to do this for a long time... I want to package my site as a Site Template and having absolute URLs was not an option... I need them to be relative to what ever the site URL is... whether it is at the root of MOSS or a sub-site deep down in the structure...
I found the following to work:
Script Tags:
<script type="text/javascript" src='<asp:Literal runat="server"
Text="<% $SPUrl:~Site/appBin/js/jquery.min.js %>" />'></script>
Style sheet (Method suggested above by user385947):
<link rel="stylesheet" type="text/css"
href="<% $SPUrl:~Site/appBin/css/jquery-ui.css %>" />
Hope this helps others...
You're looking for the ~site token, here's a list of the URL tokens custom to WSS.

Resources