Magento Add Instructions to Purchase Order Method on Onepage Checkout - magento

Magento 1.9.1 allows for payment instructions for Bank Transfer and Cash on Delivery, however, there isn't an instructions option for Purchase Order. I'd like to have the same box type below the Purchase Order Number field when the user selects Purchase Order on the checkout. How can I add Instructions in the following places:
Admin Configuration (Purchase Order)
One Page Checkout Payment Type: Purchase Order
Order Review - Payment Method
Receipt / Invoice Page
Purchase Order (No Instructions)
Bank Transfer (Instructions)
Bank Transfer (Payment Method Instructions)
Admin Configuration

I ultimately solved this by going to app/design/frontend/base/default/template/payment/form/purchaseorder.phtml and edidted the source code here.
From this:
<ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
<li>
<label for="po_number" class="required"><em>*</em><?php echo $this->__('Purchase Order Number') ?></label>
<div class="input-box">
<input type="text" id="po_number" name="payment[po_number]" title="<?php echo $this->__('Purchase Order Number') ?>" class="input-text required-entry" value="<?php echo $this->escapeHtml($this->getInfoData('po_number')) ?>" />
</div>
</li>
</ul>
To this:
<ul class="form-list checkout-agreements" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
<li>
<label for="po_number" class="required"><em>*</em><?php echo $this->__('Purchase Order Number') ?></label>
<div class="input-box">
<input type="text" id="po_number" name="payment[po_number]" title="<?php echo $this->__('Purchase Order Number') ?>" class="input-text required-entry" value="<?php echo $this->escapeHtml($this->getInfoData('po_number')) ?>" />
</div>
</li>
<li>
<div class="<?php echo $this->getMethodCode() ?>-instructions-content agreement-content"><?php echo $this->__('your text here') ?>
</div>
</li>
</ul>
Make sure to add checkout-agreements to the ul class.

Related

Custom contact form gives me 404 error

I've created a custom contact form for each magento product, I've set up all the files and inserted this code inside a Magento static block:
{{block type="core/template" form_action="/PersonalizzazioniEmail/index/post/" template="catalog/product/view/form-personalizzazione.phtml"}}
Here's the form-personalizzazione.phtml
<?php $productId=$this->getRequest()->getParams();
$model = Mage::getModel('catalog/product');
$_product = $model->load($productId["id"]);
?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->toHtml() ?></div>
<div class="page-title">
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
</div>
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
<input type="hidden" id="product" name="product" value="<?php echo $_product->getName() ?>" />
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Email')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
<li>
<label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Telephone')) ?>" value="" class="input-text" type="text" />
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
</div>
<div class="fieldset privacy">
<ul class="form-list">
<?php if (Mage::helper('privacy')->isPrivacyEnabled()): ?>
<li>
<?php echo $this->getChildHtml('privacy.include.contacts'); ?>
</li>
<?php endif;?>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
But I get a 404 error when I submit the form, what could be the reason?
Thanks
Create a Custom Contact Form in Magento,Kindly visit below URLs.
http://inchoo.net/magento/magento-email/magento-custom-email-contact-form-with-notification-system/
http://ignaciogondra.com/2015/08/24/how-to-create-a-custom-contact-form-in-magento/
If you don't want to use custom code,You can use this paid extension.
https://www.magentocommerce.com/magento-connect/custom-contact-forms.html
You can also use this Product Question,It's might be fulfilled your requirement. This is free extension.
https://www.magentocommerce.com/magento-connect/product-question-1.html
Hope It's helpful for you.

Magento Save Value in Custom Attribute of Customer from one page checkout (billing.phtml)

I have made one attribute for customer registration. It is working fine on registration. I am getting problem on one page checkout. Like normal registration, i am also taking value from customer during one step checkout registration but problem is that it doesn't store the value in attribute. thank you in advance
code of billing.phtml which display textbox for attribute to take value from user
<li class="fields">
<div class="field">
<label for="<?php echo $attribute->getAttributeCode(); ?>" <?php if($attribute->getIsRequired()):?>class="required"><em>*</em> <?php else :?>><?php endif;?><?php echo $this->__($frontEndLabel) ?></label>
<div class="input-box">
<?php if($attribute->getFrontendInput()== 'text'):?>
<input type="text" name="billing[test]" id="billing:<?php echo $attribute->getAttributeCode(); ?>" title="<?php echo $this->__($frontEndLabel); ?>" class="input-text <?php echo $fieldRequiredClass; ?> <?php echo $fieldFrontendClass ;?>" />
<?php endif ?>
</div>
</div>
<?php endif ?>
<?php endforeach ?>
</li>
Just Update following code in your config.xml and check it
<fieldsets>
<checkout_onepage_quote>
<attributename>
<to_customer>*</to_customer>
</attributename>
</checkout_onepage_quote>
</fieldsets>

How to edit "design/frontend/base/default/ template/customer/address/edit.phtml" in magento?

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license#magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* #category design
* #package base_default
* #copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
* #license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Edit customer address template
*
* #see Mage_Customer_Block_Address_Edit
*/
?>
<?php if($this->getTitle()): ?>
<div class="page-title">
<h1><?php echo $this->getTitle() ?></h1>
</div>
<?php endif; ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
<div class="fieldset">
<?php echo $this->getBlockHtml('formkey')?>
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
<h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<?php echo $this->getNameBlockHtml() ?>
</li>
<li class="wide">
<label for="company"><?php echo $this->__('Company') ?></label>
<div class="input-box">
<input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
</div>
</li>
<li class="fields">
<div class="field">
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
<div class="input-box">
<input type="text" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
</div>
</div>
<div class="field">
<label for="fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" />
</div>
</div>
</li>
</ul>
</div>
<div class="fieldset">
<h2 class="legend"><?php echo $this->__('Address') ?></h2>
<ul class="form-list">
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
<li class="wide">
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
<div class="input-box">
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
</div>
</li>
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
<li class="wide">
<div class="input-box">
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
</div>
</li>
<?php endfor; ?>
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
<li class="wide">
<label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
<div class="input-box">
<input type="text" name="vat_id" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
</div>
</li>
<?php endif; ?>
<li class="fields">
<div class="field">
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" name="city" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
</div>
</div>
<div class="field">
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
<div class="input-box">
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
</select>
<script type="text/javascript">
//<![CDATA[
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
//]]>
</script>
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
</div>
</div>
</li>
<li class="fields">
<div class="field">
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
<div class="input-box">
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
</div>
</div>
<div class="field">
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
<div class="input-box">
<?php echo $this->getCountryHtmlSelect() ?>
</div>
</div>
</li>
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
<?php if($this->isDefaultBilling()): ?>
<strong><?php echo $this->__('Default Billing Address') ?></strong>
<?php elseif($this->canSetAsDefaultBilling()): ?>
<input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
<?php else: ?>
<input type="hidden" name="default_billing" value="1" />
<?php endif; ?>
</li>
<li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
<?php if($this->isDefaultShipping()): ?>
<strong><?php echo $this->__('Default Shipping Address') ?></strong>
<?php elseif($this->canSetAsDefaultShipping()): ?>
<input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
<?php else: ?>
<input type="hidden" name="default_shipping" value="1" />
<?php endif; ?>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<p class="back-link"><small>« </small><?php echo $this->__('Back') ?></p>
<button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var dataForm = new VarienForm('form-validate', true);
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
//]]>
</script>``
i want to when i click on button then it create pop up box with ok button and when i am click on ok button the default procedure of magento will be continue.
and all that by using different model in local code pool.
it is possible??
You could use something like that http://www.miniscript.it/demopages/confirmjquerydialog/demo.php and manage this action with jquery.
Easy, just add hidden block to the template, change default confirmation button to fake button and enable action:
<button onclick="document.getElementById('hiddendivid').style.display = 'block'; return false;">
Fake button opens div with true button
</button>
<div id="hiddendivid" style="display: none;">
this is popup div
<input type="submit" name="truemagentosubmit" value="This will real submit the form" />
<input type="submit" value="Or close thos window" onclick="document.getElementById('hiddendivid').style.display = 'none'; return false;" />
</div>
all will work in the same form like a standard submit.

Add terms and condition to the new account registration

How can i add the checkbox and Content of the terms and condition when a user create new account.
The file we are talking about is register.phtml
<li class="control">
<div class="input-box">
<input type="checkbox" id="privacy_policy" name="privacy_policy" value="1" title="<?php echo $this->__('Accept the privacy policy') ?>" class="checkbox required-entry">
</div>
<label for="is_subscribed"><?php echo $this->__('Accept the privacy policy') ?> (<?php echo $this->__('privacy policy'); ?>)</label>
</li>
This works great, thanks!
My solution for register page:
<li class="control">
<div class="input-box">
<input type="checkbox" id="privacy_policy" name="privacy_policy" value="1" title="<?php echo $this->__('Accept the privacy policy') ?>" class="checkbox required-entry">
</div>
<label for="is_subscribed"><?php echo $this->__('Accept the privacy policy') ?> (<?php echo $this->__('privacy policy'); ?>)</label>
</li>
I add this into the register.phtml and works ok.
<input type="checkbox" id="something" name="something" value="1" title="something" class="checkbox required-entry">
Create a CMS page for Terms and conditions and then include this in register.phtml.
echo $this->getLayout()->createBlock('cms/block')->setBlockId('my-new-block')->toHtml();

Number of countries for billing and Shipping to be different in Magento

I want to display some countries in shipping address and some other countries in the billing address.
I have followed the suggestion provided here .But after doing that my state/province input box doesn't appear.
Like this ->
look at line 78 ish in (path_to_magento)\app\design\frontend\default(my_skin_name)\template\checkout\onepage\shipping.phtml
and it should be like this. Maybe you deleted something -
<div class="field">
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
<div class="input-box">
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
</select>
<script type="text/javascript">
//<![CDATA[
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
//]]>
</script>
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
</div>
</div>

Resources