Version Notes
Makes address fields (e.g. state and telephone) not required. This can be configured in adminpanel.
Download this release
Release Info
| Developer | magecloud |
| Extension | Magecloud_Addressfieldsconfigurable |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Magecloud/Notmandatory/Helper/Data.php +5 -0
- app/code/community/Magecloud/Notmandatory/Model/Address/Abs.php +41 -0
- app/code/community/Magecloud/Notmandatory/Model/Address/Abstract.php +59 -0
- app/code/community/Magecloud/Notmandatory/Model/Address/Mandatory.php +372 -0
- app/code/community/Magecloud/Notmandatory/Model/Mysql4/Setup.php +4 -0
- app/code/community/Magecloud/Notmandatory/Model/Quote/Address.php +64 -0
- app/code/community/Magecloud/Notmandatory/etc/config.xml +56 -0
- app/code/community/Magecloud/Notmandatory/etc/system.xml +31 -0
- app/code/community/Magecloud/Notmandatory/sql/notmandatory_setup/mysql4-install-1.0.0.php +12 -0
- app/design/frontend/default/default/template/checkout/onepage/billing.phtml +214 -0
- app/design/frontend/default/default/template/checkout/onepage/shipping.phtml +154 -0
- app/design/frontend/default/default/template/customer/Address/edit.phtml +154 -0
- app/design/frontend/default/default/template/persistent/checkout/onepage/billing.phtml +214 -0
- app/design/frontend/default/default/template/persistent/checkout/onepage/shipping.phtml +154 -0
- app/etc/modules/Magecloud_Notmandatory.xml +9 -0
- package.xml +18 -0
app/code/community/Magecloud/Notmandatory/Helper/Data.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Magecloud_Notmandatory_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
}
|
app/code/community/Magecloud/Notmandatory/Model/Address/Abs.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Magecloud_Notmandatory_Model_Address_Abs extends Magecloud_Notmandatory_Model_Address_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function validate()
|
| 5 |
+
{
|
| 6 |
+
//echo "Hiiiiiiiiiiiiiiiiiiiiiiiiiiii";
|
| 7 |
+
$errors = array();
|
| 8 |
+
$this->implodeStreetAddress();
|
| 9 |
+
if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
|
| 10 |
+
$errors[] = Mage::helper('customer')->__('Please enter the first name.');
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
|
| 14 |
+
$errors[] = Mage::helper('customer')->__('Please enter the last name.');
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
|
| 18 |
+
$errors[] = Mage::helper('customer')->__('Please enter the street.');
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
|
| 22 |
+
$errors[] = Mage::helper('customer')->__('Please enter the city.');
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
|
| 26 |
+
if (!in_array($this->getCountryId(), $_havingOptionalZip)
|
| 27 |
+
&& !Zend_Validate::is($this->getPostcode(), 'NotEmpty')
|
| 28 |
+
) {
|
| 29 |
+
$errors[] = Mage::helper('customer')->__('Please enter the zip/postal code.');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
|
| 33 |
+
$errors[] = Mage::helper('customer')->__('Please enter the country.');
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (empty($errors) || $this->getShouldIgnoreValidation()) {
|
| 37 |
+
return true;
|
| 38 |
+
}
|
| 39 |
+
return $errors;
|
| 40 |
+
}
|
| 41 |
+
}
|
app/code/community/Magecloud/Notmandatory/Model/Address/Abstract.php
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Magecloud_Notmandatory_Model_Address_Mandatory extends Mage_Customer_Model_Address
|
| 3 |
+
{
|
| 4 |
+
public function validate()
|
| 5 |
+
{
|
| 6 |
+
$errors = array();
|
| 7 |
+
$this->implodeStreetAddress();
|
| 8 |
+
if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
|
| 9 |
+
$errors[] = Mage::helper('customer')->__('Please enter the first name.');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
|
| 13 |
+
$errors[] = Mage::helper('customer')->__('Please enter the last name.');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
|
| 17 |
+
$errors[] = Mage::helper('customer')->__('Please enter the street.');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
|
| 21 |
+
$errors[] = Mage::helper('customer')->__('Please enter the city.');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
if(Mage::getStoreConfig('customer/address/telephone_show') == 1)
|
| 25 |
+
{
|
| 26 |
+
if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty'))
|
| 27 |
+
{
|
| 28 |
+
$errors[] = Mage::helper('customer')->__('Please enter the telephone number.');
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
|
| 33 |
+
if (!in_array($this->getCountryId(), $_havingOptionalZip)
|
| 34 |
+
&& !Zend_Validate::is($this->getPostcode(), 'NotEmpty')
|
| 35 |
+
) {
|
| 36 |
+
$errors[] = Mage::helper('customer')->__('Please enter the zip/postal code.');
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
|
| 40 |
+
$errors[] = Mage::helper('customer')->__('Please enter the country.');
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
if(Mage::getStoreConfig('customer/address/region_show') == 1)
|
| 44 |
+
{
|
| 45 |
+
|
| 46 |
+
if ($this->getCountryModel()->getRegionCollection()->getSize()
|
| 47 |
+
&& !Zend_Validate::is($this->getRegionId(), 'NotEmpty')
|
| 48 |
+
&& Mage::helper('directory')->isRegionRequired($this->getCountryId()))
|
| 49 |
+
{
|
| 50 |
+
$errors[] = Mage::helper('customer')->__('Please enter the state/province.');
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if (empty($errors) || $this->getShouldIgnoreValidation()) {
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
return $errors;
|
| 58 |
+
}
|
| 59 |
+
}
|
app/code/community/Magecloud/Notmandatory/Model/Address/Mandatory.php
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Magecloud_Notmandatory_Model_Address_Mandatory extends Mage_Customer_Model_Address
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Possible customer address types
|
| 6 |
+
*/
|
| 7 |
+
const TYPE_BILLING = 'billing';
|
| 8 |
+
const TYPE_SHIPPING = 'shipping';
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Prefix of model events
|
| 12 |
+
*
|
| 13 |
+
* @var string
|
| 14 |
+
*/
|
| 15 |
+
protected $_eventPrefix = 'customer_address';
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Name of event object
|
| 19 |
+
*
|
| 20 |
+
* @var string
|
| 21 |
+
*/
|
| 22 |
+
protected $_eventObject = 'customer_address';
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Directory country models
|
| 26 |
+
*
|
| 27 |
+
* @var array
|
| 28 |
+
*/
|
| 29 |
+
static protected $_countryModels = array();
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Directory region models
|
| 33 |
+
*
|
| 34 |
+
* @var array
|
| 35 |
+
*/
|
| 36 |
+
static protected $_regionModels = array();
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Get full customer name
|
| 40 |
+
*
|
| 41 |
+
* @return string
|
| 42 |
+
*/
|
| 43 |
+
public function getName()
|
| 44 |
+
{
|
| 45 |
+
$name = '';
|
| 46 |
+
$config = Mage::getSingleton('eav/config');
|
| 47 |
+
if ($config->getAttribute('customer_address', 'prefix')->getIsVisible() && $this->getPrefix()) {
|
| 48 |
+
$name .= $this->getPrefix() . ' ';
|
| 49 |
+
}
|
| 50 |
+
$name .= $this->getFirstname();
|
| 51 |
+
if ($config->getAttribute('customer_address', 'middlename')->getIsVisible() && $this->getMiddlename()) {
|
| 52 |
+
$name .= ' ' . $this->getMiddlename();
|
| 53 |
+
}
|
| 54 |
+
$name .= ' ' . $this->getLastname();
|
| 55 |
+
if ($config->getAttribute('customer_address', 'suffix')->getIsVisible() && $this->getSuffix()) {
|
| 56 |
+
$name .= ' ' . $this->getSuffix();
|
| 57 |
+
}
|
| 58 |
+
return $name;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* get address street
|
| 63 |
+
*
|
| 64 |
+
* @param int $line address line index
|
| 65 |
+
* @return string
|
| 66 |
+
*/
|
| 67 |
+
public function getStreet($line=0)
|
| 68 |
+
{
|
| 69 |
+
$street = parent::getData('street');
|
| 70 |
+
if (-1 === $line) {
|
| 71 |
+
return $street;
|
| 72 |
+
} else {
|
| 73 |
+
$arr = is_array($street) ? $street : explode("\n", $street);
|
| 74 |
+
if (0 === $line || $line === null) {
|
| 75 |
+
return $arr;
|
| 76 |
+
} elseif (isset($arr[$line-1])) {
|
| 77 |
+
return $arr[$line-1];
|
| 78 |
+
} else {
|
| 79 |
+
return '';
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
public function getStreet1()
|
| 85 |
+
{
|
| 86 |
+
return $this->getStreet(1);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
public function getStreet2()
|
| 90 |
+
{
|
| 91 |
+
return $this->getStreet(2);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
public function getStreet3()
|
| 95 |
+
{
|
| 96 |
+
return $this->getStreet(3);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
public function getStreet4()
|
| 100 |
+
{
|
| 101 |
+
return $this->getStreet(4);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
public function getStreetFull()
|
| 105 |
+
{
|
| 106 |
+
return $this->getData('street');
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
public function setStreetFull($street)
|
| 110 |
+
{
|
| 111 |
+
return $this->setStreet($street);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* set address street informa
|
| 116 |
+
*
|
| 117 |
+
* @param unknown_type $street
|
| 118 |
+
* @return unknown
|
| 119 |
+
*/
|
| 120 |
+
public function setStreet($street)
|
| 121 |
+
{
|
| 122 |
+
if (is_array($street)) {
|
| 123 |
+
$street = trim(implode("\n", $street));
|
| 124 |
+
}
|
| 125 |
+
$this->setData('street', $street);
|
| 126 |
+
return $this;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Create fields street1, street2, etc.
|
| 131 |
+
*
|
| 132 |
+
* To be used in controllers for views data
|
| 133 |
+
*
|
| 134 |
+
*/
|
| 135 |
+
public function explodeStreetAddress()
|
| 136 |
+
{
|
| 137 |
+
$streetLines = $this->getStreet();
|
| 138 |
+
foreach ($streetLines as $i=>$line) {
|
| 139 |
+
$this->setData('street'.($i+1), $line);
|
| 140 |
+
}
|
| 141 |
+
return $this;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
/**
|
| 145 |
+
* To be used when processing _POST
|
| 146 |
+
*/
|
| 147 |
+
public function implodeStreetAddress()
|
| 148 |
+
{
|
| 149 |
+
$this->setStreet($this->getData('street'));
|
| 150 |
+
return $this;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/**
|
| 154 |
+
* Retrieve region name
|
| 155 |
+
*
|
| 156 |
+
* @return string
|
| 157 |
+
*/
|
| 158 |
+
public function getRegion()
|
| 159 |
+
{
|
| 160 |
+
$regionId = $this->getData('region_id');
|
| 161 |
+
$region = $this->getData('region');
|
| 162 |
+
|
| 163 |
+
if ($regionId) {
|
| 164 |
+
if ($this->getRegionModel($regionId)->getCountryId() == $this->getCountryId()) {
|
| 165 |
+
$region = $this->getRegionModel($regionId)->getName();
|
| 166 |
+
$this->setData('region', $region);
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
if (!empty($region) && is_string($region)) {
|
| 171 |
+
$this->setData('region', $region);
|
| 172 |
+
}
|
| 173 |
+
elseif (!$regionId && is_numeric($region)) {
|
| 174 |
+
if ($this->getRegionModel($region)->getCountryId() == $this->getCountryId()) {
|
| 175 |
+
$this->setData('region', $this->getRegionModel($region)->getName());
|
| 176 |
+
$this->setData('region_id', $region);
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
elseif ($regionId && !$region) {
|
| 180 |
+
if ($this->getRegionModel($regionId)->getCountryId() == $this->getCountryId()) {
|
| 181 |
+
$this->setData('region', $this->getRegionModel($regionId)->getName());
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
return $this->getData('region');
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/**
|
| 189 |
+
* Return 2 letter state code if available, otherwise full region name
|
| 190 |
+
*
|
| 191 |
+
*/
|
| 192 |
+
public function getRegionCode()
|
| 193 |
+
{
|
| 194 |
+
$regionId = $this->getData('region_id');
|
| 195 |
+
$region = $this->getData('region');
|
| 196 |
+
|
| 197 |
+
if (!$regionId && is_numeric($region)) {
|
| 198 |
+
if ($this->getRegionModel($region)->getCountryId() == $this->getCountryId()) {
|
| 199 |
+
$this->setData('region_code', $this->getRegionModel($region)->getCode());
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
elseif ($regionId) {
|
| 203 |
+
if ($this->getRegionModel($regionId)->getCountryId() == $this->getCountryId()) {
|
| 204 |
+
$this->setData('region_code', $this->getRegionModel($regionId)->getCode());
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
elseif (is_string($region)) {
|
| 208 |
+
$this->setData('region_code', $region);
|
| 209 |
+
}
|
| 210 |
+
return $this->getData('region_code');
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
public function getRegionId()
|
| 214 |
+
{
|
| 215 |
+
$regionId = $this->getData('region_id');
|
| 216 |
+
$region = $this->getData('region');
|
| 217 |
+
if (!$regionId) {
|
| 218 |
+
if (is_numeric($region)) {
|
| 219 |
+
$this->setData('region_id', $region);
|
| 220 |
+
$this->unsRegion();
|
| 221 |
+
} else {
|
| 222 |
+
$regionModel = Mage::getModel('directory/region')
|
| 223 |
+
->loadByCode($this->getRegionCode(), $this->getCountryId());
|
| 224 |
+
$this->setData('region_id', $regionModel->getId());
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
return $this->getData('region_id');
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
public function getCountry()
|
| 231 |
+
{
|
| 232 |
+
/*if ($this->getData('country_id') && !$this->getData('country')) {
|
| 233 |
+
$this->setData('country', Mage::getModel('directory/country')
|
| 234 |
+
->load($this->getData('country_id'))->getIso2Code());
|
| 235 |
+
}
|
| 236 |
+
return $this->getData('country');*/
|
| 237 |
+
$country = $this->getCountryId();
|
| 238 |
+
return $country ? $country : $this->getData('country');
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/**
|
| 242 |
+
* Retrive country model
|
| 243 |
+
*
|
| 244 |
+
* @return Mage_Directory_Model_Country
|
| 245 |
+
*/
|
| 246 |
+
public function getCountryModel()
|
| 247 |
+
{
|
| 248 |
+
if(!isset(self::$_countryModels[$this->getCountryId()])) {
|
| 249 |
+
self::$_countryModels[$this->getCountryId()] = Mage::getModel('directory/country')
|
| 250 |
+
->load($this->getCountryId());
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
return self::$_countryModels[$this->getCountryId()];
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/**
|
| 257 |
+
* Retrive country model
|
| 258 |
+
*
|
| 259 |
+
* @return Mage_Directory_Model_Country
|
| 260 |
+
*/
|
| 261 |
+
public function getRegionModel($region=null)
|
| 262 |
+
{
|
| 263 |
+
if(is_null($region)) {
|
| 264 |
+
$region = $this->getRegionId();
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
if(!isset(self::$_regionModels[$region])) {
|
| 268 |
+
self::$_regionModels[$region] = Mage::getModel('directory/region')->load($region);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
return self::$_regionModels[$region];
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
/**
|
| 275 |
+
* @deprecated for public function format
|
| 276 |
+
*/
|
| 277 |
+
public function getHtmlFormat()
|
| 278 |
+
{
|
| 279 |
+
return $this->getConfig()->getFormatByCode('html');
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/**
|
| 283 |
+
* @deprecated for public function format
|
| 284 |
+
*/
|
| 285 |
+
public function getFormated($html=false)
|
| 286 |
+
{
|
| 287 |
+
return $this->format($html ? 'html' : 'text');
|
| 288 |
+
//Mage::getModel('directory/country')->load($this->getCountryId())->formatAddress($this, $html);
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
public function format($type)
|
| 292 |
+
{
|
| 293 |
+
if(!($formatType = $this->getConfig()->getFormatByCode($type))
|
| 294 |
+
|| !$formatType->getRenderer()) {
|
| 295 |
+
return null;
|
| 296 |
+
}
|
| 297 |
+
Mage::dispatchEvent('customer_address_format', array('type' => $formatType, 'address' => $this));
|
| 298 |
+
return $formatType->getRenderer()->render($this);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
/**
|
| 302 |
+
* Retrive address config object
|
| 303 |
+
*
|
| 304 |
+
* @return Mage_Customer_Model_Address_Config
|
| 305 |
+
*/
|
| 306 |
+
public function getConfig()
|
| 307 |
+
{
|
| 308 |
+
return Mage::getSingleton('customer/address_config');
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
protected function _beforeSave()
|
| 312 |
+
{
|
| 313 |
+
parent::_beforeSave();
|
| 314 |
+
$this->getRegion();
|
| 315 |
+
return $this;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
/**
|
| 319 |
+
* Validate address attribute values
|
| 320 |
+
*
|
| 321 |
+
* @return bool
|
| 322 |
+
*/
|
| 323 |
+
public function validate()
|
| 324 |
+
{
|
| 325 |
+
$errors = array();
|
| 326 |
+
$this->implodeStreetAddress();
|
| 327 |
+
if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
|
| 328 |
+
$errors[] = Mage::helper('customer')->__('Please enter the first name.');
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
|
| 332 |
+
$errors[] = Mage::helper('customer')->__('Please enter the last name.');
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
|
| 336 |
+
$errors[] = Mage::helper('customer')->__('Please enter the street.');
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
|
| 340 |
+
$errors[] = Mage::helper('customer')->__('Please enter the city.');
|
| 341 |
+
}
|
| 342 |
+
if(Mage::getStoreConfig('customer/address/telephone_show') == 1)
|
| 343 |
+
{
|
| 344 |
+
if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
|
| 345 |
+
$errors[] = Mage::helper('customer')->__('Please enter the telephone number.');
|
| 346 |
+
}}
|
| 347 |
+
|
| 348 |
+
$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
|
| 349 |
+
if (!in_array($this->getCountryId(), $_havingOptionalZip)
|
| 350 |
+
&& !Zend_Validate::is($this->getPostcode(), 'NotEmpty')
|
| 351 |
+
) {
|
| 352 |
+
$errors[] = Mage::helper('customer')->__('Please enter the zip/postal code.');
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
|
| 356 |
+
$errors[] = Mage::helper('customer')->__('Please enter the country.');
|
| 357 |
+
}
|
| 358 |
+
if(Mage::getStoreConfig('customer/address/region_show') == 1)
|
| 359 |
+
{
|
| 360 |
+
if ($this->getCountryModel()->getRegionCollection()->getSize()
|
| 361 |
+
&& !Zend_Validate::is($this->getRegionId(), 'NotEmpty')
|
| 362 |
+
&& Mage::helper('directory')->isRegionRequired($this->getCountryId())
|
| 363 |
+
) {
|
| 364 |
+
$errors[] = Mage::helper('customer')->__('Please enter the state/province.');
|
| 365 |
+
}}
|
| 366 |
+
|
| 367 |
+
if (empty($errors) || $this->getShouldIgnoreValidation()) {
|
| 368 |
+
return true;
|
| 369 |
+
}
|
| 370 |
+
return $errors;
|
| 371 |
+
}
|
| 372 |
+
}
|
app/code/community/Magecloud/Notmandatory/Model/Mysql4/Setup.php
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
?php
|
| 2 |
+
class Magecloud_Notmandatory_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
|
| 3 |
+
{
|
| 4 |
+
}
|
app/code/community/Magecloud/Notmandatory/Model/Quote/Address.php
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Magecloud_Notmandatory_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* Validate address attribute values
|
| 7 |
+
*
|
| 8 |
+
* @return bool
|
| 9 |
+
*/
|
| 10 |
+
public function validate()
|
| 11 |
+
{
|
| 12 |
+
$errors = array();
|
| 13 |
+
$helper = Mage::helper('customer');
|
| 14 |
+
$this->implodeStreetAddress();
|
| 15 |
+
if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
|
| 16 |
+
$errors[] = $helper->__('Please enter the first name.');
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
|
| 20 |
+
$errors[] = $helper->__('Please enter the last name.');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
|
| 24 |
+
$errors[] = $helper->__('Please enter the street.');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
|
| 28 |
+
$errors[] = $helper->__('Please enter the city.');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if(Mage::getStoreConfig('customer/address/telephone_show') == 1)
|
| 32 |
+
{
|
| 33 |
+
if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty'))
|
| 34 |
+
{
|
| 35 |
+
$errors[] = Mage::helper('customer')->__('Please enter the telephone number.');
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
|
| 40 |
+
if (!in_array($this->getCountryId(), $_havingOptionalZip) && !Zend_Validate::is($this->getPostcode(), 'NotEmpty')) {
|
| 41 |
+
$errors[] = $helper->__('Please enter the zip/postal code.');
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
|
| 45 |
+
$errors[] = $helper->__('Please enter the country.');
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if(Mage::getStoreConfig('customer/address/region_show') == 1)
|
| 49 |
+
{
|
| 50 |
+
|
| 51 |
+
if ($this->getCountryModel()->getRegionCollection()->getSize()
|
| 52 |
+
&& !Zend_Validate::is($this->getRegionId(), 'NotEmpty')
|
| 53 |
+
&& Mage::helper('directory')->isRegionRequired($this->getCountryId()))
|
| 54 |
+
{
|
| 55 |
+
$errors[] = Mage::helper('customer')->__('Please enter the state/province.');
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if (empty($errors) || $this->getShouldIgnoreValidation()) {
|
| 60 |
+
return true;
|
| 61 |
+
}
|
| 62 |
+
return $errors;
|
| 63 |
+
}
|
| 64 |
+
}
|
app/code/community/Magecloud/Notmandatory/etc/config.xml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Magecloud_Notmandatory>
|
| 5 |
+
<version>1.0.0</version>
|
| 6 |
+
</Magecloud_Notmandatory>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<layout>
|
| 10 |
+
<updates>
|
| 11 |
+
<Magecloud_Notmandatory>
|
| 12 |
+
<file>notmandatory.xml</file>
|
| 13 |
+
</Magecloud_Notmandatory>
|
| 14 |
+
</updates>
|
| 15 |
+
</layout>
|
| 16 |
+
</frontend>
|
| 17 |
+
<global>
|
| 18 |
+
<models>
|
| 19 |
+
<sales>
|
| 20 |
+
<rewrite>
|
| 21 |
+
<quote_address>Magecloud_Notmandatory_Model_Quote_Address</quote_address>
|
| 22 |
+
</rewrite>
|
| 23 |
+
</sales>
|
| 24 |
+
<customer>
|
| 25 |
+
<rewrite>
|
| 26 |
+
<address>Magecloud_Notmandatory_Model_Address_Mandatory</address>
|
| 27 |
+
</rewrite>
|
| 28 |
+
</customer>
|
| 29 |
+
</models>
|
| 30 |
+
<resources>
|
| 31 |
+
<notmandatory_setup>
|
| 32 |
+
<setup>
|
| 33 |
+
<module>Magecloud_Notmandatory</module>
|
| 34 |
+
</setup>
|
| 35 |
+
<connection>
|
| 36 |
+
<use>core_setup</use>
|
| 37 |
+
</connection>
|
| 38 |
+
</notmandatory_setup>
|
| 39 |
+
<notmandatory_write>
|
| 40 |
+
<connection>
|
| 41 |
+
<use>core_write</use>
|
| 42 |
+
</connection>
|
| 43 |
+
</notmandatory_write>
|
| 44 |
+
<notmandatory_read>
|
| 45 |
+
<connection>
|
| 46 |
+
<use>core_read</use>
|
| 47 |
+
</connection>
|
| 48 |
+
</notmandatory_read>
|
| 49 |
+
</resources>
|
| 50 |
+
<helpers>
|
| 51 |
+
<notmandatory>
|
| 52 |
+
<class>Magecloud_Notmandatory_Helper</class>
|
| 53 |
+
</notmandatory>
|
| 54 |
+
</helpers>
|
| 55 |
+
</global>
|
| 56 |
+
</config>
|
app/code/community/Magecloud/Notmandatory/etc/system.xml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<customer translate="label">
|
| 5 |
+
<groups>
|
| 6 |
+
<address translate="label">
|
| 7 |
+
<fields>
|
| 8 |
+
<region_show translate="label">
|
| 9 |
+
<label>State/Province Mandatory</label>
|
| 10 |
+
<frontend_type>select</frontend_type>
|
| 11 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 12 |
+
<sort_order>62</sort_order>
|
| 13 |
+
<show_in_default>1</show_in_default>
|
| 14 |
+
<show_in_website>1</show_in_website>
|
| 15 |
+
<show_in_store>1</show_in_store>
|
| 16 |
+
</region_show>
|
| 17 |
+
<telephone_show translate="label">
|
| 18 |
+
<label>Telephone Mandatory</label>
|
| 19 |
+
<frontend_type>select</frontend_type>
|
| 20 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 21 |
+
<sort_order>63</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>1</show_in_store>
|
| 25 |
+
</telephone_show>
|
| 26 |
+
</fields>
|
| 27 |
+
</address>
|
| 28 |
+
</groups>
|
| 29 |
+
</customer>
|
| 30 |
+
</sections>
|
| 31 |
+
</config>
|
app/code/community/Magecloud/Notmandatory/sql/notmandatory_setup/mysql4-install-1.0.0.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$installer = $this;
|
| 3 |
+
$installer->startSetup();
|
| 4 |
+
|
| 5 |
+
$installer->run("
|
| 6 |
+
UPDATE {$this->getTable('eav_attribute')} SET is_required = 0 WHERE attribute_code = 'telephone';
|
| 7 |
+
UPDATE {$this->getTable('eav_attribute')} SET is_required = 0 WHERE attribute_code = 'region';
|
| 8 |
+
");
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
$installer->endSetup();
|
app/design/frontend/default/default/template/checkout/onepage/billing.phtml
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form id="co-billing-form" action="">
|
| 2 |
+
<fieldset>
|
| 3 |
+
<ul class="form-list">
|
| 4 |
+
<?php if ($this->customerHasAddresses()): ?>
|
| 5 |
+
<li class="wide">
|
| 6 |
+
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
| 7 |
+
<div class="input-box">
|
| 8 |
+
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
| 9 |
+
</div>
|
| 10 |
+
</li>
|
| 11 |
+
<?php endif; ?>
|
| 12 |
+
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
|
| 13 |
+
<fieldset>
|
| 14 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
| 15 |
+
<ul>
|
| 16 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
| 17 |
+
<li class="fields">
|
| 18 |
+
<div class="field">
|
| 19 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
| 20 |
+
<div class="input-box">
|
| 21 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
| 22 |
+
</div>
|
| 23 |
+
</div>
|
| 24 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
| 25 |
+
<div class="field">
|
| 26 |
+
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
| 27 |
+
<div class="input-box">
|
| 28 |
+
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
<?php endif; ?>
|
| 32 |
+
</li>
|
| 33 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
| 34 |
+
<li class="wide">
|
| 35 |
+
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
| 36 |
+
<div class="input-box">
|
| 37 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
| 38 |
+
</div>
|
| 39 |
+
</li>
|
| 40 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
| 41 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
| 42 |
+
<li class="wide">
|
| 43 |
+
<div class="input-box">
|
| 44 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
| 45 |
+
</div>
|
| 46 |
+
</li>
|
| 47 |
+
<?php endfor; ?>
|
| 48 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
| 49 |
+
<li class="wide">
|
| 50 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
| 51 |
+
<div class="input-box">
|
| 52 |
+
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
| 53 |
+
</div>
|
| 54 |
+
</li>
|
| 55 |
+
<?php endif; ?>
|
| 56 |
+
<li class="fields">
|
| 57 |
+
<div class="field">
|
| 58 |
+
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
| 59 |
+
<div class="input-box">
|
| 60 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="field">
|
| 64 |
+
<?php if(Mage::getStoreConfig('customer/address/region_show') != 1):?>
|
| 65 |
+
<label for="billing:region_id"><?php echo $this->__('State/Province') ?></label>
|
| 66 |
+
<div class="input-box">
|
| 67 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 68 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 69 |
+
</select>
|
| 70 |
+
<script type="text/javascript">
|
| 71 |
+
//<![CDATA[
|
| 72 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 73 |
+
//]]>
|
| 74 |
+
</script>
|
| 75 |
+
<input type="text" id="billing:region" name="billing[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') ?>" style="display:none;" />
|
| 76 |
+
</div>
|
| 77 |
+
<?php else:?>
|
| 78 |
+
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
| 79 |
+
<div class="input-box">
|
| 80 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 81 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 82 |
+
</select>
|
| 83 |
+
<script type="text/javascript">
|
| 84 |
+
//<![CDATA[
|
| 85 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 86 |
+
//]]>
|
| 87 |
+
</script>
|
| 88 |
+
<input type="text" id="billing:region" name="billing[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') ?>" style="display:none;" />
|
| 89 |
+
</div>
|
| 90 |
+
<?php endif;?>
|
| 91 |
+
</div>
|
| 92 |
+
</li>
|
| 93 |
+
<li class="fields">
|
| 94 |
+
<div class="field">
|
| 95 |
+
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
| 96 |
+
<div class="input-box">
|
| 97 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="field">
|
| 101 |
+
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
| 102 |
+
<div class="input-box">
|
| 103 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</li>
|
| 107 |
+
<li class="fields">
|
| 108 |
+
<?php if(Mage::getStoreConfig('customer/address/telephone_show') != 1):?>
|
| 109 |
+
<div class="field">
|
| 110 |
+
<label for="billing:telephone"><?php echo $this->__('Telephone') ?></label>
|
| 111 |
+
<div class="input-box">
|
| 112 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
<?php else:?>
|
| 116 |
+
<div class="field">
|
| 117 |
+
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
| 118 |
+
<div class="input-box">
|
| 119 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
<?php endif;?>
|
| 123 |
+
<div class="field">
|
| 124 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
| 125 |
+
<div class="input-box">
|
| 126 |
+
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</li>
|
| 130 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
| 131 |
+
|
| 132 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
| 133 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
| 134 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
| 135 |
+
<li class="fields">
|
| 136 |
+
<?php if ($_dob->isEnabled()): ?>
|
| 137 |
+
<div class="field">
|
| 138 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 139 |
+
</div>
|
| 140 |
+
<?php endif; ?>
|
| 141 |
+
<?php if ($_gender->isEnabled()): ?>
|
| 142 |
+
<div class="field">
|
| 143 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 144 |
+
</div>
|
| 145 |
+
<?php endif ?>
|
| 146 |
+
</li>
|
| 147 |
+
<?php endif ?>
|
| 148 |
+
|
| 149 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
| 150 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
| 151 |
+
<li>
|
| 152 |
+
<?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 153 |
+
</li>
|
| 154 |
+
<?php endif ?>
|
| 155 |
+
|
| 156 |
+
<li class="fields" id="register-customer-password">
|
| 157 |
+
<div class="field">
|
| 158 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
| 159 |
+
<div class="input-box">
|
| 160 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="field">
|
| 164 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
| 165 |
+
<div class="input-box">
|
| 166 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
</li>
|
| 170 |
+
<?php endif; ?>
|
| 171 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
| 172 |
+
<li class="control">
|
| 173 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
| 174 |
+
</li>
|
| 175 |
+
<?php else:?>
|
| 176 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
| 177 |
+
<?php endif; ?>
|
| 178 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
| 179 |
+
</ul>
|
| 180 |
+
</fieldset>
|
| 181 |
+
</li>
|
| 182 |
+
<?php /* Extensions placeholder */ ?>
|
| 183 |
+
<?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
|
| 184 |
+
<?php if ($this->canShip()): ?>
|
| 185 |
+
<li class="control">
|
| 186 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
| 187 |
+
<li class="control">
|
| 188 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
| 189 |
+
</li>
|
| 190 |
+
<?php endif; ?>
|
| 191 |
+
</ul>
|
| 192 |
+
<?php if (!$this->canShip()): ?>
|
| 193 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
| 194 |
+
<?php endif; ?>
|
| 195 |
+
<div class="buttons-set" id="billing-buttons-container">
|
| 196 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 197 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
| 198 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
| 199 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
| 200 |
+
</span>
|
| 201 |
+
</div>
|
| 202 |
+
</fieldset>
|
| 203 |
+
</form>
|
| 204 |
+
<script type="text/javascript">
|
| 205 |
+
//<![CDATA[
|
| 206 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
| 207 |
+
var billingForm = new VarienForm('co-billing-form');
|
| 208 |
+
|
| 209 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
| 210 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
| 211 |
+
|
| 212 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
| 213 |
+
//]]>
|
| 214 |
+
</script>
|
app/design/frontend/default/default/template/checkout/onepage/shipping.phtml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form action="" id="co-shipping-form">
|
| 2 |
+
<ul class="form-list">
|
| 3 |
+
<?php if ($this->customerHasAddresses()): ?>
|
| 4 |
+
<li class="wide">
|
| 5 |
+
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
| 6 |
+
<div class="input-box">
|
| 7 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
| 8 |
+
</div>
|
| 9 |
+
</li>
|
| 10 |
+
<?php endif ?>
|
| 11 |
+
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
|
| 12 |
+
<fieldset>
|
| 13 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
| 14 |
+
<ul>
|
| 15 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
| 16 |
+
<li class="fields">
|
| 17 |
+
<div class="fields">
|
| 18 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
| 19 |
+
<div class="input-box">
|
| 20 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
</li>
|
| 24 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
| 25 |
+
<li class="wide">
|
| 26 |
+
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
| 27 |
+
<div class="input-box">
|
| 28 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 29 |
+
</div>
|
| 30 |
+
</li>
|
| 31 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
| 32 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
| 33 |
+
<li class="wide">
|
| 34 |
+
<div class="input-box">
|
| 35 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 36 |
+
</div>
|
| 37 |
+
</li>
|
| 38 |
+
<?php endfor; ?>
|
| 39 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
| 40 |
+
<li class="wide">
|
| 41 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
| 42 |
+
<div class="input-box">
|
| 43 |
+
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
| 44 |
+
</div>
|
| 45 |
+
</li>
|
| 46 |
+
<?php endif; ?>
|
| 47 |
+
<li class="fields">
|
| 48 |
+
<div class="field">
|
| 49 |
+
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
| 50 |
+
<div class="input-box">
|
| 51 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="field">
|
| 55 |
+
<?php if(Mage::getStoreConfig('customer/address/region_show') != 1):?>
|
| 56 |
+
<label for="shipping:region"><?php echo $this->__('State/Province') ?></label>
|
| 57 |
+
<div class="input-box">
|
| 58 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 59 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 60 |
+
</select>
|
| 61 |
+
<script type="text/javascript">
|
| 62 |
+
//<![CDATA[
|
| 63 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 64 |
+
//]]>
|
| 65 |
+
</script>
|
| 66 |
+
<input type="text" id="shipping:region" name="shipping[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') ?>" style="display:none;" />
|
| 67 |
+
</div>
|
| 68 |
+
<?php else:?>
|
| 69 |
+
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
| 70 |
+
<div class="input-box">
|
| 71 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 72 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 73 |
+
</select>
|
| 74 |
+
<script type="text/javascript">
|
| 75 |
+
//<![CDATA[
|
| 76 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 77 |
+
//]]>
|
| 78 |
+
</script>
|
| 79 |
+
<input type="text" id="shipping:region" name="shipping[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') ?>" style="display:none;" />
|
| 80 |
+
</div>
|
| 81 |
+
<?php endif;?>
|
| 82 |
+
</div>
|
| 83 |
+
</li>
|
| 84 |
+
<li class="fields">
|
| 85 |
+
<div class="field">
|
| 86 |
+
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
| 87 |
+
<div class="input-box">
|
| 88 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="field">
|
| 92 |
+
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
| 93 |
+
<div class="input-box">
|
| 94 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</li>
|
| 98 |
+
<li class="fields">
|
| 99 |
+
<?php if(Mage::getStoreConfig('customer/address/telephone_show') != 1):?>
|
| 100 |
+
<div class="field">
|
| 101 |
+
<label for="shipping:telephone"><?php echo $this->__('Telephone') ?></label>
|
| 102 |
+
<div class="input-box">
|
| 103 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
<?php else:?>
|
| 107 |
+
<div class="field">
|
| 108 |
+
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
| 109 |
+
<div class="input-box">
|
| 110 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
<?php endif;?>
|
| 114 |
+
<div class="field">
|
| 115 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
| 116 |
+
<div class="input-box">
|
| 117 |
+
<input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</li>
|
| 121 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
| 122 |
+
<li class="control">
|
| 123 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
| 124 |
+
<?php else:?>
|
| 125 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
| 126 |
+
<?php endif;?>
|
| 127 |
+
</ul>
|
| 128 |
+
</fieldset>
|
| 129 |
+
</li>
|
| 130 |
+
<li class="control">
|
| 131 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
| 132 |
+
</li>
|
| 133 |
+
</ul>
|
| 134 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
| 135 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 136 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
| 137 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
| 138 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
| 139 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
| 140 |
+
</span>
|
| 141 |
+
</div>
|
| 142 |
+
</form>
|
| 143 |
+
<script type="text/javascript">
|
| 144 |
+
//<![CDATA[
|
| 145 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
| 146 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
| 147 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
| 148 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
| 149 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
| 150 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
| 151 |
+
|
| 152 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
| 153 |
+
//]]>
|
| 154 |
+
</script>
|
app/design/frontend/default/default/template/customer/Address/edit.phtml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if($this->getTitle()): ?>
|
| 2 |
+
<div class="page-title">
|
| 3 |
+
<h1><?php echo $this->getTitle() ?></h1>
|
| 4 |
+
</div>
|
| 5 |
+
<?php endif; ?>
|
| 6 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 7 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
|
| 8 |
+
<div class="fieldset">
|
| 9 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
| 10 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
| 11 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
| 12 |
+
<h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
|
| 13 |
+
<ul class="form-list">
|
| 14 |
+
<li class="fields">
|
| 15 |
+
<?php echo $this->getNameBlockHtml() ?>
|
| 16 |
+
</li>
|
| 17 |
+
<li class="wide">
|
| 18 |
+
<label for="company"><?php echo $this->__('Company') ?></label>
|
| 19 |
+
<div class="input-box">
|
| 20 |
+
<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') ?>" />
|
| 21 |
+
</div>
|
| 22 |
+
</li>
|
| 23 |
+
<li class="fields">
|
| 24 |
+
<div class="field">
|
| 25 |
+
<?php if(Mage::getStoreConfig('customer/address/telephone_show') != 1):?>
|
| 26 |
+
<label for="telephone"><?php echo $this->__('Telephone') ?></label>
|
| 27 |
+
<div class="input-box">
|
| 28 |
+
<input type="text" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="telephone" />
|
| 29 |
+
</div>
|
| 30 |
+
<?php else:?>
|
| 31 |
+
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
| 32 |
+
<div class="input-box">
|
| 33 |
+
<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" />
|
| 34 |
+
</div>
|
| 35 |
+
<?php endif;?>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="field">
|
| 38 |
+
<label for="fax"><?php echo $this->__('Fax') ?></label>
|
| 39 |
+
<div class="input-box">
|
| 40 |
+
<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') ?>" />
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</li>
|
| 44 |
+
</ul>
|
| 45 |
+
</div>
|
| 46 |
+
<div class="fieldset">
|
| 47 |
+
<h2 class="legend"><?php echo $this->__('Address') ?></h2>
|
| 48 |
+
<ul class="form-list">
|
| 49 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
| 50 |
+
<li class="wide">
|
| 51 |
+
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
|
| 52 |
+
<div class="input-box">
|
| 53 |
+
<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 ?>" />
|
| 54 |
+
</div>
|
| 55 |
+
</li>
|
| 56 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
| 57 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
| 58 |
+
<li class="wide">
|
| 59 |
+
<div class="input-box">
|
| 60 |
+
<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 ?>" />
|
| 61 |
+
</div>
|
| 62 |
+
</li>
|
| 63 |
+
<?php endfor; ?>
|
| 64 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
| 65 |
+
<li class="wide">
|
| 66 |
+
<label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
|
| 67 |
+
<div class="input-box">
|
| 68 |
+
<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') ?>" />
|
| 69 |
+
</div>
|
| 70 |
+
</li>
|
| 71 |
+
<?php endif; ?>
|
| 72 |
+
<li class="fields">
|
| 73 |
+
<div class="field">
|
| 74 |
+
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
| 75 |
+
<div class="input-box">
|
| 76 |
+
<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" />
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="field">
|
| 80 |
+
<?php if(Mage::getStoreConfig('customer/address/region_show') != 1):?>
|
| 81 |
+
<label for="region_id"><?php echo $this->__('State/Province') ?></label>
|
| 82 |
+
<div class="input-box">
|
| 83 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>">
|
| 84 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 85 |
+
</select>
|
| 86 |
+
<script type="text/javascript">
|
| 87 |
+
//<![CDATA[
|
| 88 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 89 |
+
//]]>
|
| 90 |
+
</script>
|
| 91 |
+
<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') ?>" />
|
| 92 |
+
</div>
|
| 93 |
+
<?php else:?>
|
| 94 |
+
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
| 95 |
+
<div class="input-box">
|
| 96 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 97 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 98 |
+
</select>
|
| 99 |
+
<script type="text/javascript">
|
| 100 |
+
//<![CDATA[
|
| 101 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 102 |
+
//]]>
|
| 103 |
+
</script>
|
| 104 |
+
<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') ?>" />
|
| 105 |
+
</div>
|
| 106 |
+
<?php endif;?>
|
| 107 |
+
</div>
|
| 108 |
+
</li>
|
| 109 |
+
<li class="fields">
|
| 110 |
+
<div class="field">
|
| 111 |
+
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
| 112 |
+
<div class="input-box">
|
| 113 |
+
<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') ?>" />
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
<div class="field">
|
| 117 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
| 118 |
+
<div class="input-box">
|
| 119 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</li>
|
| 123 |
+
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
|
| 124 |
+
<?php if($this->isDefaultBilling()): ?>
|
| 125 |
+
<strong><?php echo $this->__('Default Billing Address') ?></strong>
|
| 126 |
+
<?php elseif($this->canSetAsDefaultBilling()): ?>
|
| 127 |
+
<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>
|
| 128 |
+
<?php else: ?>
|
| 129 |
+
<input type="hidden" name="default_billing" value="1" />
|
| 130 |
+
<?php endif; ?>
|
| 131 |
+
</li>
|
| 132 |
+
<li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
|
| 133 |
+
<?php if($this->isDefaultShipping()): ?>
|
| 134 |
+
<strong><?php echo $this->__('Default Shipping Address') ?></strong>
|
| 135 |
+
<?php elseif($this->canSetAsDefaultShipping()): ?>
|
| 136 |
+
<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>
|
| 137 |
+
<?php else: ?>
|
| 138 |
+
<input type="hidden" name="default_shipping" value="1" />
|
| 139 |
+
<?php endif; ?>
|
| 140 |
+
</li>
|
| 141 |
+
</ul>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="buttons-set">
|
| 144 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 145 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
| 146 |
+
<button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
|
| 147 |
+
</div>
|
| 148 |
+
</form>
|
| 149 |
+
<script type="text/javascript">
|
| 150 |
+
//<![CDATA[
|
| 151 |
+
var dataForm = new VarienForm('form-validate', true);
|
| 152 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
|
| 153 |
+
//]]>
|
| 154 |
+
</script>
|
app/design/frontend/default/default/template/persistent/checkout/onepage/billing.phtml
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form id="co-billing-form" action="">
|
| 2 |
+
<fieldset>
|
| 3 |
+
<ul class="form-list">
|
| 4 |
+
<?php if ($this->customerHasAddresses()): ?>
|
| 5 |
+
<li class="wide">
|
| 6 |
+
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
| 7 |
+
<div class="input-box">
|
| 8 |
+
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
| 9 |
+
</div>
|
| 10 |
+
</li>
|
| 11 |
+
<?php endif; ?>
|
| 12 |
+
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
|
| 13 |
+
<fieldset>
|
| 14 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
| 15 |
+
<ul>
|
| 16 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
| 17 |
+
<li class="fields">
|
| 18 |
+
<div class="field">
|
| 19 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
| 20 |
+
<div class="input-box">
|
| 21 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
| 22 |
+
</div>
|
| 23 |
+
</div>
|
| 24 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
| 25 |
+
<div class="field">
|
| 26 |
+
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
| 27 |
+
<div class="input-box">
|
| 28 |
+
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
<?php endif; ?>
|
| 32 |
+
</li>
|
| 33 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
| 34 |
+
<li class="wide">
|
| 35 |
+
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
| 36 |
+
<div class="input-box">
|
| 37 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
| 38 |
+
</div>
|
| 39 |
+
</li>
|
| 40 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
| 41 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
| 42 |
+
<li class="wide">
|
| 43 |
+
<div class="input-box">
|
| 44 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
| 45 |
+
</div>
|
| 46 |
+
</li>
|
| 47 |
+
<?php endfor; ?>
|
| 48 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
| 49 |
+
<li class="wide">
|
| 50 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
| 51 |
+
<div class="input-box">
|
| 52 |
+
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
| 53 |
+
</div>
|
| 54 |
+
</li>
|
| 55 |
+
<?php endif; ?>
|
| 56 |
+
<li class="fields">
|
| 57 |
+
<div class="field">
|
| 58 |
+
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
| 59 |
+
<div class="input-box">
|
| 60 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="field">
|
| 64 |
+
<?php if(Mage::getStoreConfig('customer/address/region_show') != 1):?>
|
| 65 |
+
<label for="billing:region_id"><?php echo $this->__('State/Province') ?></label>
|
| 66 |
+
<div class="input-box">
|
| 67 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 68 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 69 |
+
</select>
|
| 70 |
+
<script type="text/javascript">
|
| 71 |
+
//<![CDATA[
|
| 72 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 73 |
+
//]]>
|
| 74 |
+
</script>
|
| 75 |
+
<input type="text" id="billing:region" name="billing[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') ?>" style="display:none;" />
|
| 76 |
+
</div>
|
| 77 |
+
<?php else:?>
|
| 78 |
+
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
| 79 |
+
<div class="input-box">
|
| 80 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 81 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 82 |
+
</select>
|
| 83 |
+
<script type="text/javascript">
|
| 84 |
+
//<![CDATA[
|
| 85 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 86 |
+
//]]>
|
| 87 |
+
</script>
|
| 88 |
+
<input type="text" id="billing:region" name="billing[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') ?>" style="display:none;" />
|
| 89 |
+
</div>
|
| 90 |
+
<?php endif;?>
|
| 91 |
+
</div>
|
| 92 |
+
</li>
|
| 93 |
+
<li class="fields">
|
| 94 |
+
<div class="field">
|
| 95 |
+
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
| 96 |
+
<div class="input-box">
|
| 97 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="field">
|
| 101 |
+
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
| 102 |
+
<div class="input-box">
|
| 103 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</li>
|
| 107 |
+
<li class="fields">
|
| 108 |
+
<?php if(Mage::getStoreConfig('customer/address/telephone_show') != 1):?>
|
| 109 |
+
<div class="field">
|
| 110 |
+
<label for="billing:telephone"><?php echo $this->__('Telephone') ?></label>
|
| 111 |
+
<div class="input-box">
|
| 112 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
<?php else:?>
|
| 116 |
+
<div class="field">
|
| 117 |
+
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
| 118 |
+
<div class="input-box">
|
| 119 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
<?php endif;?>
|
| 123 |
+
<div class="field">
|
| 124 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
| 125 |
+
<div class="input-box">
|
| 126 |
+
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</li>
|
| 130 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
| 131 |
+
|
| 132 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
| 133 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
| 134 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
| 135 |
+
<li class="fields">
|
| 136 |
+
<?php if ($_dob->isEnabled()): ?>
|
| 137 |
+
<div class="field">
|
| 138 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 139 |
+
</div>
|
| 140 |
+
<?php endif; ?>
|
| 141 |
+
<?php if ($_gender->isEnabled()): ?>
|
| 142 |
+
<div class="field">
|
| 143 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 144 |
+
</div>
|
| 145 |
+
<?php endif ?>
|
| 146 |
+
</li>
|
| 147 |
+
<?php endif ?>
|
| 148 |
+
|
| 149 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
| 150 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
| 151 |
+
<li>
|
| 152 |
+
<?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
| 153 |
+
</li>
|
| 154 |
+
<?php endif ?>
|
| 155 |
+
|
| 156 |
+
<li class="fields" id="register-customer-password">
|
| 157 |
+
<div class="field">
|
| 158 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
| 159 |
+
<div class="input-box">
|
| 160 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="field">
|
| 164 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
| 165 |
+
<div class="input-box">
|
| 166 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
</li>
|
| 170 |
+
<?php endif; ?>
|
| 171 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
| 172 |
+
<li class="control">
|
| 173 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
| 174 |
+
</li>
|
| 175 |
+
<?php else:?>
|
| 176 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
| 177 |
+
<?php endif; ?>
|
| 178 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
| 179 |
+
</ul>
|
| 180 |
+
</fieldset>
|
| 181 |
+
</li>
|
| 182 |
+
<?php /* Extensions placeholder */ ?>
|
| 183 |
+
<?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
|
| 184 |
+
<?php if ($this->canShip()): ?>
|
| 185 |
+
<li class="control">
|
| 186 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
| 187 |
+
<li class="control">
|
| 188 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
| 189 |
+
</li>
|
| 190 |
+
<?php endif; ?>
|
| 191 |
+
</ul>
|
| 192 |
+
<?php if (!$this->canShip()): ?>
|
| 193 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
| 194 |
+
<?php endif; ?>
|
| 195 |
+
<div class="buttons-set" id="billing-buttons-container">
|
| 196 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 197 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
| 198 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
| 199 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
| 200 |
+
</span>
|
| 201 |
+
</div>
|
| 202 |
+
</fieldset>
|
| 203 |
+
</form>
|
| 204 |
+
<script type="text/javascript">
|
| 205 |
+
//<![CDATA[
|
| 206 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
| 207 |
+
var billingForm = new VarienForm('co-billing-form');
|
| 208 |
+
|
| 209 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
| 210 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
| 211 |
+
|
| 212 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
| 213 |
+
//]]>
|
| 214 |
+
</script>
|
app/design/frontend/default/default/template/persistent/checkout/onepage/shipping.phtml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form action="" id="co-shipping-form">
|
| 2 |
+
<ul class="form-list">
|
| 3 |
+
<?php if ($this->customerHasAddresses()): ?>
|
| 4 |
+
<li class="wide">
|
| 5 |
+
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
| 6 |
+
<div class="input-box">
|
| 7 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
| 8 |
+
</div>
|
| 9 |
+
</li>
|
| 10 |
+
<?php endif ?>
|
| 11 |
+
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
|
| 12 |
+
<fieldset>
|
| 13 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
| 14 |
+
<ul>
|
| 15 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
| 16 |
+
<li class="fields">
|
| 17 |
+
<div class="fields">
|
| 18 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
| 19 |
+
<div class="input-box">
|
| 20 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
</li>
|
| 24 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
| 25 |
+
<li class="wide">
|
| 26 |
+
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
| 27 |
+
<div class="input-box">
|
| 28 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 29 |
+
</div>
|
| 30 |
+
</li>
|
| 31 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
| 32 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
| 33 |
+
<li class="wide">
|
| 34 |
+
<div class="input-box">
|
| 35 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 36 |
+
</div>
|
| 37 |
+
</li>
|
| 38 |
+
<?php endfor; ?>
|
| 39 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
| 40 |
+
<li class="wide">
|
| 41 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
| 42 |
+
<div class="input-box">
|
| 43 |
+
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
| 44 |
+
</div>
|
| 45 |
+
</li>
|
| 46 |
+
<?php endif; ?>
|
| 47 |
+
<li class="fields">
|
| 48 |
+
<div class="field">
|
| 49 |
+
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
| 50 |
+
<div class="input-box">
|
| 51 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="field">
|
| 55 |
+
<?php if(Mage::getStoreConfig('customer/address/region_show') != 1):?>
|
| 56 |
+
<label for="shipping:region"><?php echo $this->__('State/Province') ?></label>
|
| 57 |
+
<div class="input-box">
|
| 58 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 59 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 60 |
+
</select>
|
| 61 |
+
<script type="text/javascript">
|
| 62 |
+
//<![CDATA[
|
| 63 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 64 |
+
//]]>
|
| 65 |
+
</script>
|
| 66 |
+
<input type="text" id="shipping:region" name="shipping[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') ?>" style="display:none;" />
|
| 67 |
+
</div>
|
| 68 |
+
<?php else:?>
|
| 69 |
+
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
| 70 |
+
<div class="input-box">
|
| 71 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
| 72 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
| 73 |
+
</select>
|
| 74 |
+
<script type="text/javascript">
|
| 75 |
+
//<![CDATA[
|
| 76 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
| 77 |
+
//]]>
|
| 78 |
+
</script>
|
| 79 |
+
<input type="text" id="shipping:region" name="shipping[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') ?>" style="display:none;" />
|
| 80 |
+
</div>
|
| 81 |
+
<?php endif;?>
|
| 82 |
+
</div>
|
| 83 |
+
</li>
|
| 84 |
+
<li class="fields">
|
| 85 |
+
<div class="field">
|
| 86 |
+
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
| 87 |
+
<div class="input-box">
|
| 88 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="field">
|
| 92 |
+
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
| 93 |
+
<div class="input-box">
|
| 94 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</li>
|
| 98 |
+
<li class="fields">
|
| 99 |
+
<?php if(Mage::getStoreConfig('customer/address/telephone_show') != 1):?>
|
| 100 |
+
<div class="field">
|
| 101 |
+
<label for="shipping:telephone"><?php echo $this->__('Telephone') ?></label>
|
| 102 |
+
<div class="input-box">
|
| 103 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
<?php else:?>
|
| 107 |
+
<div class="field">
|
| 108 |
+
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
| 109 |
+
<div class="input-box">
|
| 110 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
<?php endif;?>
|
| 114 |
+
<div class="field">
|
| 115 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
| 116 |
+
<div class="input-box">
|
| 117 |
+
<input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</li>
|
| 121 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
| 122 |
+
<li class="control">
|
| 123 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
| 124 |
+
<?php else:?>
|
| 125 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
| 126 |
+
<?php endif;?>
|
| 127 |
+
</ul>
|
| 128 |
+
</fieldset>
|
| 129 |
+
</li>
|
| 130 |
+
<li class="control">
|
| 131 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
| 132 |
+
</li>
|
| 133 |
+
</ul>
|
| 134 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
| 135 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 136 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
| 137 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
| 138 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
| 139 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
| 140 |
+
</span>
|
| 141 |
+
</div>
|
| 142 |
+
</form>
|
| 143 |
+
<script type="text/javascript">
|
| 144 |
+
//<![CDATA[
|
| 145 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
| 146 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
| 147 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
| 148 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
| 149 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
| 150 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
| 151 |
+
|
| 152 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
| 153 |
+
//]]>
|
| 154 |
+
</script>
|
app/etc/modules/Magecloud_Notmandatory.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Magecloud_Notmandatory>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Magecloud_Notmandatory>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Magecloud_Addressfieldsconfigurable</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Makes address fields (e.g. state and telephone) not required. This can be configured in adminpanel. </summary>
|
| 10 |
+
<description>Makes address fields (e.g. state and telephone) not required. This can be configured in adminpanel. </description>
|
| 11 |
+
<notes>Makes address fields (e.g. state and telephone) not required. This can be configured in adminpanel.</notes>
|
| 12 |
+
<authors><author><name>magecloud</name><user>magecloud</user><email>abhinav@magecloud.de</email></author></authors>
|
| 13 |
+
<date>2013-07-29</date>
|
| 14 |
+
<time>11:27:22</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Magecloud"><dir name="Notmandatory"><dir name="Helper"><file name="Data.php" hash="232d93d0f94168f194fa5e04e3bcfd9f"/></dir><dir name="Model"><dir name="Address"><file name="Abs.php" hash="605c03a2b494a8948b004823f1071f3a"/><file name="Abstract.php" hash="b4050a74a42aab182a8fb2738f5b6499"/><file name="Mandatory.php" hash="60c063381b16bd8914d48c726dc32187"/></dir><dir name="Mysql4"><file name="Setup.php" hash="834f3cab23159941c3459adf9912ff31"/></dir><dir name="Quote"><file name="Address.php" hash="6c7d31baffbb1a5ed8a27e7d51581e21"/></dir></dir><dir name="etc"><file name="config.xml" hash="c47d6c815a63cfedcf7fb04d22676de5"/><file name="system.xml" hash="d8e74a964c82c88170cd3e7af644cd75"/></dir><dir name="sql"><dir name="notmandatory_setup"><file name="mysql4-install-1.0.0.php" hash="6800c948902b4de294f52453279eca85"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magecloud_Notmandatory.xml" hash="90e91b221002ed400e0c760a684b7c0f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c2135cd99072a5f7dde4b33f16711815"/><file name="shipping.phtml" hash="37a804c6f64714c8d512d1b424acd235"/></dir></dir><dir name="customer"><dir name="Address"><file name="edit.phtml" hash="14946a20f481235ca203aac67c1e934c"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c2135cd99072a5f7dde4b33f16711815"/><file name="shipping.phtml" hash="37a804c6f64714c8d512d1b424acd235"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
