CommerceBees_ResidentialCommercial_Pro_v1 - Version 1.0.0

Version Notes

First version of Residential/Commercial Pro module is released.

Download this release

Release Info

Developer Commerce Bees
Extension CommerceBees_ResidentialCommercial_Pro_v1
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

CommerceBees_ResidentialCommercialPro_Extension_Guide_V1.0.pdf ADDED
Binary file
app/code/local/Ameex/ResidentialCommercial/Model/FedEx.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ameex_ResidentialCommercial_Model_FedEx extends Mage_Usa_Model_Shipping_Carrier_Fedex
4
+ {
5
+ protected function _formRateRequest($purpose)
6
+ {
7
+ $strpos = strpos(Mage::helper('core/url')->getCurrentUrl(),'admin');
8
+ if(!$strpos)
9
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
10
+ else
11
+ $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
12
+ $residentialCommercial = $quote->getShippingAddress()->getResidentialcommercial();
13
+
14
+ $r = $this->_rawRequest;
15
+ $ratesRequest = array(
16
+ 'WebAuthenticationDetail' => array(
17
+ 'UserCredential' => array(
18
+ 'Key' => $r->getKey(),
19
+ 'Password' => $r->getPassword()
20
+ )
21
+ ),
22
+ 'ClientDetail' => array(
23
+ 'AccountNumber' => $r->getAccount(),
24
+ 'MeterNumber' => $r->getMeterNumber()
25
+ ),
26
+ 'Version' => $this->getVersionInfo(),
27
+ 'RequestedShipment' => array(
28
+ 'DropoffType' => $r->getDropoffType(),
29
+ 'ShipTimestamp' => date('c'),
30
+ 'PackagingType' => $r->getPackaging(),
31
+ 'TotalInsuredValue' => array(
32
+ 'Amount' => $r->getValue(),
33
+ 'Currency' => $this->getCurrencyCode()
34
+ ),
35
+ 'Shipper' => array(
36
+ 'Address' => array(
37
+ 'PostalCode' => $r->getOrigPostal(),
38
+ 'CountryCode' => $r->getOrigCountry()
39
+ )
40
+ ),
41
+ 'Recipient' => array(
42
+ 'Address' => array(
43
+ 'PostalCode' => $r->getDestPostal(),
44
+ 'CountryCode' => $r->getDestCountry(),
45
+ //'Residential' => (bool)$this->getConfigData('residence_delivery') //Edited By Ameex
46
+ 'Residential' =>($residentialCommercial-1)
47
+ )
48
+ ),
49
+ 'ShippingChargesPayment' => array(
50
+ 'PaymentType' => 'SENDER',
51
+ 'Payor' => array(
52
+ 'AccountNumber' => $r->getAccount(),
53
+ 'CountryCode' => $r->getOrigCountry()
54
+ )
55
+ ),
56
+ 'CustomsClearanceDetail' => array(
57
+ 'CustomsValue' => array(
58
+ 'Amount' => $r->getValue(),
59
+ 'Currency' => $this->getCurrencyCode()
60
+ )
61
+ ),
62
+ 'RateRequestTypes' => 'LIST',
63
+ 'PackageCount' => '1',
64
+ 'PackageDetail' => 'INDIVIDUAL_PACKAGES',
65
+ 'RequestedPackageLineItems' => array(
66
+ '0' => array(
67
+ 'Weight' => array(
68
+ 'Value' => (float)$r->getWeight(),
69
+ 'Units' => $this->getConfigData('unit_of_measure')
70
+ ),
71
+ 'GroupPackageCount' => 1,
72
+ )
73
+ )
74
+ )
75
+ );
76
+
77
+ if ($purpose == self::RATE_REQUEST_GENERAL) {
78
+ $ratesRequest['RequestedShipment']['RequestedPackageLineItems'][0]['InsuredValue'] = array(
79
+ 'Amount' => $r->getValue(),
80
+ 'Currency' => $this->getCurrencyCode()
81
+ );
82
+ } else if ($purpose == self::RATE_REQUEST_SMARTPOST) {
83
+ $ratesRequest['RequestedShipment']['ServiceType'] = self::RATE_REQUEST_SMARTPOST;
84
+ $ratesRequest['RequestedShipment']['SmartPostDetail'] = array(
85
+ 'Indicia' => ((float)$r->getWeight() >= 1) ? 'PARCEL_SELECT' : 'PRESORTED_STANDARD',
86
+ 'HubId' => $this->getConfigData('smartpost_hubid')
87
+ );
88
+ }
89
+ return $ratesRequest;
90
+ }
91
+
92
+ }
app/code/local/Ameex/ResidentialCommercial/Model/Observer.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_ResidentialCommercial_Model_Observer
3
+ {
4
+ public function setResidentialcommercialToQuoteAddress(Varien_Event_Observer $observer)
5
+ {
6
+ $residentialcommercial = $observer->getControllerAction()->getRequest()->getPost('residentialcommercial');
7
+ Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->setResidentialcommercial($residentialcommercial)->save();
8
+ }
9
+ }
app/code/local/Ameex/ResidentialCommercial/Model/Source.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_ResidentialCommercial_Model_Source extends Mage_Eav_Model_Entity_Attribute_Source_Table
3
+ {
4
+ public function getAllOptions()
5
+ {
6
+ $options = array(1=>'Commercial',2=>'Residential');
7
+ return $options;
8
+ }
9
+
10
+ public function getOptionText($value)
11
+ {
12
+ if($value == 1)
13
+ return 'Commercial';
14
+ elseif($value == 2)
15
+ return 'Residential';
16
+ else
17
+ return false;
18
+ }
19
+ }
app/code/local/Ameex/ResidentialCommercial/Model/Ups.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_ResidentialCommercial_Model_Ups extends Mage_Usa_Model_Shipping_Carrier_Ups
3
+ {
4
+ public function setRequest(Mage_Shipping_Model_Rate_Request $request)
5
+ {
6
+ $strpos = strpos(Mage::helper('core/url')->getCurrentUrl(),'admin');
7
+ if(!$strpos)
8
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
9
+ else
10
+ $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
11
+ $residentialCommercial = $quote->getShippingAddress()->getResidentialcommercial();
12
+
13
+ $this->_request = $request;
14
+
15
+ $r = new Varien_Object();
16
+
17
+ if ($request->getLimitMethod()) {
18
+ $r->setAction($this->getCode('action', 'single'));
19
+ $r->setProduct($request->getLimitMethod());
20
+ } else {
21
+ $r->setAction($this->getCode('action', 'all'));
22
+ $r->setProduct('GND'.$this->getConfigData('dest_type'));
23
+ }
24
+
25
+ if ($request->getUpsPickup()) {
26
+ $pickup = $request->getUpsPickup();
27
+ } else {
28
+ $pickup = $this->getConfigData('pickup');
29
+ }
30
+ $r->setPickup($this->getCode('pickup', $pickup));
31
+
32
+ if ($request->getUpsContainer()) {
33
+ $container = $request->getUpsContainer();
34
+ } else {
35
+ $container = $this->getConfigData('container');
36
+ }
37
+ $r->setContainer($this->getCode('container', $container));
38
+
39
+ /*if ($request->getUpsDestType()) {
40
+ $destType = $request->getUpsDestType();
41
+ } else {
42
+ $destType = $this->getConfigData('dest_type');
43
+ }
44
+ $r->setDestType($this->getCode('dest_type', $destType));*/
45
+
46
+ if($residentialCommercial == 1)
47
+ $r->setDestType('02');
48
+ elseif($residentialCommercial == 2)
49
+ $r->setDestType('01');
50
+
51
+ if ($request->getOrigCountry()) {
52
+ $origCountry = $request->getOrigCountry();
53
+ } else {
54
+ $origCountry = Mage::getStoreConfig(
55
+ Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID,
56
+ $request->getStoreId()
57
+ );
58
+ }
59
+
60
+ $r->setOrigCountry(Mage::getModel('directory/country')->load($origCountry)->getIso2Code());
61
+
62
+ if ($request->getOrigRegionCode()) {
63
+ $origRegionCode = $request->getOrigRegionCode();
64
+ } else {
65
+ $origRegionCode = Mage::getStoreConfig(
66
+ Mage_Shipping_Model_Shipping::XML_PATH_STORE_REGION_ID,
67
+ $request->getStoreId()
68
+ );
69
+ }
70
+ if (is_numeric($origRegionCode)) {
71
+ $origRegionCode = Mage::getModel('directory/region')->load($origRegionCode)->getCode();
72
+ }
73
+ $r->setOrigRegionCode($origRegionCode);
74
+
75
+ if ($request->getOrigPostcode()) {
76
+ $r->setOrigPostal($request->getOrigPostcode());
77
+ } else {
78
+ $r->setOrigPostal(Mage::getStoreConfig(
79
+ Mage_Shipping_Model_Shipping::XML_PATH_STORE_ZIP,
80
+ $request->getStoreId()
81
+ ));
82
+ }
83
+
84
+ if ($request->getOrigCity()) {
85
+ $r->setOrigCity($request->getOrigCity());
86
+ } else {
87
+ $r->setOrigCity(Mage::getStoreConfig(
88
+ Mage_Shipping_Model_Shipping::XML_PATH_STORE_CITY,
89
+ $request->getStoreId()
90
+ ));
91
+ }
92
+
93
+
94
+ if ($request->getDestCountryId()) {
95
+ $destCountry = $request->getDestCountryId();
96
+ } else {
97
+ $destCountry = self::USA_COUNTRY_ID;
98
+ }
99
+
100
+ //for UPS, puero rico state for US will assume as puerto rico country
101
+ if ($destCountry == self::USA_COUNTRY_ID
102
+ && ($request->getDestPostcode()=='00912' || $request->getDestRegionCode()==self::PUERTORICO_COUNTRY_ID)
103
+ ) {
104
+ $destCountry = self::PUERTORICO_COUNTRY_ID;
105
+ }
106
+
107
+ // For UPS, Guam state of the USA will be represented by Guam country
108
+ if ($destCountry == self::USA_COUNTRY_ID && $request->getDestRegionCode() == self::GUAM_REGION_CODE) {
109
+ $destCountry = self::GUAM_COUNTRY_ID;
110
+ }
111
+
112
+ $r->setDestCountry(Mage::getModel('directory/country')->load($destCountry)->getIso2Code());
113
+
114
+ $r->setDestRegionCode($request->getDestRegionCode());
115
+
116
+ if ($request->getDestPostcode()) {
117
+ $r->setDestPostal($request->getDestPostcode());
118
+ } else {
119
+
120
+ }
121
+
122
+ $weight = $this->getTotalNumOfBoxes($request->getPackageWeight());
123
+
124
+ $weight = $this->_getCorrectWeight($weight);
125
+
126
+ $r->setWeight($weight);
127
+ if ($request->getFreeMethodWeight()!=$request->getPackageWeight()) {
128
+ $r->setFreeMethodWeight($request->getFreeMethodWeight());
129
+ }
130
+
131
+ $r->setValue($request->getPackageValue());
132
+ $r->setValueWithDiscount($request->getPackageValueWithDiscount());
133
+
134
+ if ($request->getUpsUnitMeasure()) {
135
+ $unit = $request->getUpsUnitMeasure();
136
+ } else {
137
+ $unit = $this->getConfigData('unit_of_measure');
138
+ }
139
+ $r->setUnitMeasure($unit);
140
+
141
+ $r->setIsReturn($request->getIsReturn());
142
+
143
+ $r->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax());
144
+
145
+ $this->_rawRequest = $r;
146
+
147
+ return $this;
148
+ }
149
+ }
app/code/local/Ameex/ResidentialCommercial/etc/config.xml ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ameex_ResidentialCommercial>
5
+ <version>1.0.0</version>
6
+ </Ameex_ResidentialCommercial>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <residentialcommercial>
11
+ <class>Ameex_ResidentialCommercial_Model</class>
12
+ </residentialcommercial>
13
+ <usa>
14
+ <rewrite>
15
+ <shipping_carrier_fedex>Ameex_ResidentialCommercial_Model_FedEx</shipping_carrier_fedex>
16
+ <shipping_carrier_ups>Ameex_ResidentialCommercial_Model_Ups</shipping_carrier_ups>
17
+ </rewrite>
18
+ </usa>
19
+ </models>
20
+ <resources>
21
+ <residentialcommercial_setup>
22
+ <setup>
23
+ <module>Ameex_ResidentialCommercial</module>
24
+ <class>Mage_Customer_Model_Resource_Setup</class>
25
+ </setup>
26
+ </residentialcommercial_setup>
27
+ </resources>
28
+ <events>
29
+ <controller_action_predispatch_checkout_cart_estimatePost>
30
+ <observers>
31
+ <checkout_cart_estimatePost_residentialcommercial>
32
+ <class>Ameex_ResidentialCommercial_Model_Observer</class>
33
+ <method>setResidentialcommercialToQuoteAddress</method>
34
+ </checkout_cart_estimatePost_residentialcommercial>
35
+ </observers>
36
+ </controller_action_predispatch_checkout_cart_estimatePost>
37
+ </events>
38
+ <fieldsets>
39
+ <sales_convert_quote_address>
40
+ <residentialcommercial>
41
+ <to_order_address>*</to_order_address>
42
+ <to_customer_address>*</to_customer_address>
43
+ </residentialcommercial>
44
+ </sales_convert_quote_address>
45
+ <customer_address>
46
+ <residentialcommercial>
47
+ <to_quote_address>*</to_quote_address>
48
+ </residentialcommercial>
49
+ </customer_address>
50
+ </fieldsets>
51
+ </global>
52
+ <default>
53
+ <customer>
54
+ <address_templates>
55
+ <text>{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}
56
+ {{depend company}}{{var company}}{{/depend}}
57
+ Address Type: {{depend residentialcommercial}}{{var residentialcommercial}}{{/depend}}
58
+ {{if street1}}{{var street1}}
59
+ {{/if}}
60
+ {{depend street2}}{{var street2}}{{/depend}}
61
+ {{depend street3}}{{var street3}}{{/depend}}
62
+ {{depend street4}}{{var street4}}{{/depend}}
63
+ {{if city}}{{var city}}, {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}
64
+ {{var country}}
65
+ T: {{var telephone}}
66
+ {{depend fax}}F: {{var fax}}{{/depend}}
67
+ {{depend vat_id}}VAT: {{var vat_id}}{{/depend}}</text>
68
+ <oneline>{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}, {{depend residentialcommercial}}{{var residentialcommercial}}{{/depend}}, {{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}</oneline>
69
+ <html><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}<br/>
70
+ {{depend company}}{{var company}}<br />{{/depend}}
71
+ Address Type: {{depend residentialcommercial}}{{var residentialcommercial}}{{/depend}}<br/>
72
+ {{if street1}}{{var street1}}<br />{{/if}}
73
+ {{depend street2}}{{var street2}}<br />{{/depend}}
74
+ {{depend street3}}{{var street3}}<br />{{/depend}}
75
+ {{depend street4}}{{var street4}}<br />{{/depend}}
76
+ {{if city}}{{var city}}, {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}<br/>
77
+ {{var country}}<br/>
78
+ {{depend telephone}}T: {{var telephone}}{{/depend}}
79
+ {{depend fax}}<br/>F: {{var fax}}{{/depend}}
80
+ {{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}]]></html>
81
+ <pdf><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}|
82
+ {{depend company}}{{var company}}|{{/depend}}
83
+ Address Type: {{depend residentialcommercial}}{{var residentialcommercial}}{{/depend}}|
84
+ {{if street1}}{{var street1}}
85
+ {{/if}}
86
+ {{depend street2}}{{var street2}}|{{/depend}}
87
+ {{depend street3}}{{var street3}}|{{/depend}}
88
+ {{depend street4}}{{var street4}}|{{/depend}}
89
+ {{if city}}{{var city}},|{{/if}}
90
+ {{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}|
91
+ {{var country}}|
92
+ {{depend telephone}}T: {{var telephone}}{{/depend}}|
93
+ {{depend fax}}<br/>F: {{var fax}}{{/depend}}|
94
+ {{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}|]]></pdf>
95
+ <js_template><![CDATA[#{prefix} #{firstname} #{middlename} #{lastname} #{suffix}<br/>#{company}<br/>#{residentialcommercial}<br/>#{street0}<br/>#{street1}<br/>#{street2}<br/>#{street3}<br/>#{city}, #{region}, #{postcode}<br/>#{country_id}<br/>T: #{telephone}<br/>F: #{fax}<br/>VAT: #{vat_id}]]></js_template>
96
+ </address_templates>
97
+ </customer>
98
+ </default>
99
+ </config>
app/code/local/Ameex/ResidentialCommercial/sql/residentialcommercial_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute('customer_address', 'residentialcommercial', array(
7
+ 'type' => 'int',
8
+ 'input' => 'select',
9
+ 'label' => 'Address Type',
10
+ 'global' => 1,
11
+ 'visible' => 1,
12
+ 'required' => 0,
13
+ 'user_defined' => 1,
14
+ 'visible_on_front' => 1
15
+ ));
16
+ $installer->updateAttribute(
17
+ 'customer_address',
18
+ 'residentialcommercial',
19
+ 'source_model',
20
+ 'residentialcommercial/source'
21
+ );
22
+ Mage::getSingleton('eav/config')
23
+ ->getAttribute('customer_address', 'residentialcommercial')
24
+ ->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))
25
+ ->save();
26
+
27
+ $tablequote = $this->getTable('sales/quote_address');
28
+ $installer->run("ALTER TABLE $tablequote ADD COLUMN residentialcommercial INT(2) NOT NULL");
29
+
30
+ $tablequote = $this->getTable('sales/order_address');
31
+ $installer->run("ALTER TABLE $tablequote ADD COLUMN residentialcommercial INT(2) NOT NULL");
32
+ $installer->endSetup();
app/design/frontend/default/default/template/checkout/cart/shipping.phtml ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
28
+ <div class="shipping">
29
+ <h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
30
+ <div class="shipping-form">
31
+ <form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
32
+ <p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
33
+ <ul class="form-list">
34
+ <li>
35
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
36
+ <div class="input-box">
37
+ <?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
38
+ </div>
39
+ </li>
40
+ <?php //if($this->getStateActive()): ?>
41
+ <li>
42
+ <label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
43
+ <div class="input-box">
44
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
45
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
46
+ </select>
47
+ <script type="text/javascript">
48
+ //<![CDATA[
49
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
50
+ //]]>
51
+ </script>
52
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
53
+ </div>
54
+ </li>
55
+ <?php //endif; ?>
56
+ <?php if($this->getCityActive()): ?>
57
+ <li>
58
+ <label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
59
+ <div class="input-box">
60
+ <input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
61
+ </div>
62
+ </li>
63
+ <?php endif; ?>
64
+ <li>
65
+ <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
66
+ <div class="input-box">
67
+ <input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
68
+ </div>
69
+ </li>
70
+ <li>
71
+ <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer_address','residentialcommercial'); ?>
72
+ <label for="residentialcommercial"><?php echo $this->__('Address Type') ?></label>
73
+ <div class="input-box">
74
+ <select id="residentialcommercial" name="residentialcommercial" title="<?php echo $this->__('Address Type') ?>" class="validate-select">
75
+ <?php $options = $attribute->getSource()->getAllOptions(); ?>
76
+ <?php foreach($options as $key=>$value): ?>
77
+ <option value="<?php echo $key ?>"<?php if(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getResidentialcommercial()==$key) echo " selected=\"selected\""; ?>><?php echo $value ?></option>
78
+ <?php endforeach; ?>
79
+ </select>
80
+ </div>
81
+ </li>
82
+ </ul>
83
+ <div class="buttons-set">
84
+ <button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
85
+ </div>
86
+ </form>
87
+ <script type="text/javascript">
88
+ //<![CDATA[
89
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
90
+ //]]>
91
+ </script>
92
+
93
+ <?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
94
+ <form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
95
+ <dl class="sp-methods">
96
+ <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
97
+ <dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
98
+ <dd>
99
+ <ul>
100
+ <?php foreach ($_rates as $_rate): ?>
101
+ <li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
102
+ <?php if ($_rate->getErrorMessage()): ?>
103
+ <?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
104
+ <?php else: ?>
105
+ <input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
106
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
107
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
108
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
109
+ <?php echo $_excl; ?>
110
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
111
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
112
+ <?php endif; ?>
113
+ </label>
114
+ <?php endif ?>
115
+ </li>
116
+ <?php endforeach; ?>
117
+ </ul>
118
+ </dd>
119
+ <?php endforeach; ?>
120
+ </dl>
121
+ <div class="buttons-set">
122
+ <button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
123
+ </div>
124
+ </form>
125
+ <?php endif; ?>
126
+ <script type="text/javascript">
127
+ //<![CDATA[
128
+ var coShippingMethodForm = new VarienForm('shipping-zip-form');
129
+ var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
130
+
131
+ coShippingMethodForm.submit = function () {
132
+ var country = $F('country');
133
+ var optionalZip = false;
134
+
135
+ for (i=0; i < countriesWithOptionalZip.length; i++) {
136
+ if (countriesWithOptionalZip[i] == country) {
137
+ optionalZip = true;
138
+ }
139
+ }
140
+ if (optionalZip) {
141
+ $('postcode').removeClassName('required-entry');
142
+ }
143
+ else {
144
+ $('postcode').addClassName('required-entry');
145
+ }
146
+ return VarienForm.prototype.submit.bind(coShippingMethodForm)();
147
+ }
148
+ //]]>
149
+ </script>
150
+ </div>
151
+ </div>
app/design/frontend/default/default/template/checkout/onepage/shipping.phtml ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form action="" id="co-shipping-form">
28
+ <ul class="form-list">
29
+ <?php if ($this->customerHasAddresses()): ?>
30
+ <li class="wide">
31
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
32
+ <div class="input-box">
33
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
34
+ </div>
35
+ </li>
36
+ <?php endif ?>
37
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
38
+ <fieldset>
39
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
40
+ <ul>
41
+ <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>
42
+ <li class="fields">
43
+ <div class="fields">
44
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
45
+ <div class="input-box">
46
+ <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);" />
47
+ </div>
48
+ </div>
49
+ </li>
50
+ <li class="fields">
51
+ <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer_address','residentialcommercial'); ?>
52
+ <div class="field">
53
+ <label for="shipping:residentialcommercial"><?php echo $this->__('Address Type') ?></label>
54
+ </div>
55
+ <div class="input-box">
56
+ <select id="residentialcommercial" name="shipping[residentialcommercial]" title="<?php echo $this->__('Address Type') ?>" class="validate-select">
57
+ <?php $options = $attribute->getSource()->getAllOptions(); ?>
58
+ <?php foreach($options as $key=>$value): ?>
59
+ <option value="<?php echo $key ?>"<?php if($this->getAddress()->getResidentialcommercial()==$key) echo " selected=\"selected\""; ?>><?php echo $value ?></option>
60
+ <?php endforeach; ?>
61
+ </select>
62
+ </div>
63
+ </li>
64
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
65
+ <li class="wide">
66
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
67
+ <div class="input-box">
68
+ <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);" />
69
+ </div>
70
+ </li>
71
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
72
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
73
+ <li class="wide">
74
+ <div class="input-box">
75
+ <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);" />
76
+ </div>
77
+ </li>
78
+ <?php endfor; ?>
79
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
80
+ <li class="wide">
81
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
82
+ <div class="input-box">
83
+ <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') ?>" />
84
+ </div>
85
+ </li>
86
+ <?php endif; ?>
87
+ <li class="fields">
88
+ <div class="field">
89
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
90
+ <div class="input-box">
91
+ <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);" />
92
+ </div>
93
+ </div>
94
+ <div class="field">
95
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
96
+ <div class="input-box">
97
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
98
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
99
+ </select>
100
+ <script type="text/javascript">
101
+ //<![CDATA[
102
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
103
+ //]]>
104
+ </script>
105
+ <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;" />
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <li class="fields">
110
+ <div class="field">
111
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
112
+ <div class="input-box">
113
+ <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);" />
114
+ </div>
115
+ </div>
116
+ <div class="field">
117
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
118
+ <div class="input-box">
119
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
120
+ </div>
121
+ </div>
122
+ </li>
123
+ <li class="fields">
124
+ <div class="field">
125
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
126
+ <div class="input-box">
127
+ <input type="text" name="shipping[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="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
128
+ </div>
129
+ </div>
130
+ <div class="field">
131
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
132
+ <div class="input-box">
133
+ <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);" />
134
+ </div>
135
+ </div>
136
+ </li>
137
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
138
+ <li class="control">
139
+ <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>
140
+ <?php else:?>
141
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
142
+ <?php endif;?>
143
+ </ul>
144
+ </fieldset>
145
+ </li>
146
+ <li class="control">
147
+ <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>
148
+ </li>
149
+ </ul>
150
+ <div class="buttons-set" id="shipping-buttons-container">
151
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
152
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
153
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
154
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
155
+ <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...') ?>
156
+ </span>
157
+ </div>
158
+ </form>
159
+ <script type="text/javascript">
160
+ //<![CDATA[
161
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
162
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
163
+ var shippingForm = new VarienForm('co-shipping-form');
164
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
165
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
166
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
167
+
168
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
169
+ //]]>
170
+ </script>
app/design/frontend/default/default/template/customer/address/edit.phtml ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Edit customer address template
30
+ *
31
+ * @see Mage_Customer_Block_Address_Edit
32
+ */
33
+ ?>
34
+ <?php if($this->getTitle()): ?>
35
+ <div class="page-title">
36
+ <h1><?php echo $this->getTitle() ?></h1>
37
+ </div>
38
+ <?php endif; ?>
39
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
41
+ <div class="fieldset">
42
+ <?php echo $this->getBlockHtml('formkey')?>
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
46
+ <ul class="form-list">
47
+ <li class="fields">
48
+ <?php echo $this->getNameBlockHtml() ?>
49
+ </li>
50
+ <li class="wide">
51
+ <label for="company"><?php echo $this->__('Company') ?></label>
52
+ <div class="input-box">
53
+ <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') ?>" />
54
+ </div>
55
+ </li>
56
+ <li class="fields">
57
+ <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer_address','residentialcommercial'); ?>
58
+ <div class="field">
59
+ <label for="residentialcommercial"><?php echo $this->__('Address Type') ?></label>
60
+ </div>
61
+ <div class="input-box">
62
+ <select id="residentialcommercial" name="residentialcommercial" title="<?php echo $this->__('Address Type') ?>" class="validate-select">
63
+ <?php $options = $attribute->getSource()->getAllOptions(); ?>
64
+ <?php foreach($options as $key=>$value): ?>
65
+ <option value="<?php echo $key ?>"<?php if($this->getAddress()->getResidentialcommercial()==$key) echo " selected=\"selected\""; ?>><?php echo $value ?></option>
66
+ <?php endforeach; ?>
67
+ </select>
68
+ </div>
69
+ </li>
70
+ <li class="fields">
71
+ <div class="field">
72
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
73
+ <div class="input-box">
74
+ <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" />
75
+ </div>
76
+ </div>
77
+ <div class="field">
78
+ <label for="fax"><?php echo $this->__('Fax') ?></label>
79
+ <div class="input-box">
80
+ <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') ?>" />
81
+ </div>
82
+ </div>
83
+ </li>
84
+ </ul>
85
+ </div>
86
+ <div class="fieldset">
87
+ <h2 class="legend"><?php echo $this->__('Address') ?></h2>
88
+ <ul class="form-list">
89
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
90
+ <li class="wide">
91
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
92
+ <div class="input-box">
93
+ <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 ?>" />
94
+ </div>
95
+ </li>
96
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
97
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
98
+ <li class="wide">
99
+ <div class="input-box">
100
+ <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 ?>" />
101
+ </div>
102
+ </li>
103
+ <?php endfor; ?>
104
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
105
+ <li class="wide">
106
+ <label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
107
+ <div class="input-box">
108
+ <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') ?>" />
109
+ </div>
110
+ </li>
111
+ <?php endif; ?>
112
+ <li class="fields">
113
+ <div class="field">
114
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
115
+ <div class="input-box">
116
+ <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" />
117
+ </div>
118
+ </div>
119
+ <div class="field">
120
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
121
+ <div class="input-box">
122
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
123
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
124
+ </select>
125
+ <script type="text/javascript">
126
+ //<![CDATA[
127
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
128
+ //]]>
129
+ </script>
130
+ <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') ?>" />
131
+ </div>
132
+ </div>
133
+ </li>
134
+ <li class="fields">
135
+ <div class="field">
136
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
137
+ <div class="input-box">
138
+ <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') ?>" />
139
+ </div>
140
+ </div>
141
+ <div class="field">
142
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
143
+ <div class="input-box">
144
+ <?php echo $this->getCountryHtmlSelect() ?>
145
+ </div>
146
+ </div>
147
+ </li>
148
+ <li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
149
+ <?php if($this->isDefaultBilling()): ?>
150
+ <strong><?php echo $this->__('Default Billing Address') ?></strong>
151
+ <?php elseif($this->canSetAsDefaultBilling()): ?>
152
+ <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>
153
+ <?php else: ?>
154
+ <input type="hidden" name="default_billing" value="1" />
155
+ <?php endif; ?>
156
+ </li>
157
+ <li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
158
+ <?php if($this->isDefaultShipping()): ?>
159
+ <strong><?php echo $this->__('Default Shipping Address') ?></strong>
160
+ <?php elseif($this->canSetAsDefaultShipping()): ?>
161
+ <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>
162
+ <?php else: ?>
163
+ <input type="hidden" name="default_shipping" value="1" />
164
+ <?php endif; ?>
165
+ </li>
166
+ </ul>
167
+ </div>
168
+ <div class="buttons-set">
169
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
170
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
171
+ <button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
172
+ </div>
173
+ </form>
174
+ <script type="text/javascript">
175
+ //<![CDATA[
176
+ var dataForm = new VarienForm('form-validate', true);
177
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
178
+ //]]>
179
+ </script>
app/design/frontend/default/default/template/persistent/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /** @var Mage_Checkout_Block_Onepage_Billing $this */
27
+ ?>
28
+ <form id="co-billing-form" action="">
29
+ <fieldset>
30
+ <ul class="form-list">
31
+ <?php if ($this->customerHasAddresses()): ?>
32
+ <li class="wide">
33
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
34
+ <div class="input-box">
35
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
40
+ <fieldset>
41
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
42
+ <ul>
43
+ <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>
44
+ <li class="fields">
45
+ <div class="field">
46
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
47
+ <div class="input-box">
48
+ <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') ?>" />
49
+ </div>
50
+ </div>
51
+ <?php if(!$this->isCustomerLoggedIn()): ?>
52
+ <div class="field">
53
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
54
+ <div class="input-box">
55
+ <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" />
56
+ </div>
57
+ </div>
58
+ <?php endif; ?>
59
+ </li>
60
+ <li class="fields">
61
+ <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer_address','residentialcommercial'); ?>
62
+ <div class="field">
63
+ <label for="billing:residentialcommercial"><?php echo $this->__('Address Type') ?></label>
64
+ </div>
65
+ <div class="input-box">
66
+ <select id="residentialcommercial" name="billing[residentialcommercial]" title="<?php echo $this->__('Address Type') ?>" class="validate-select">
67
+ <?php $options = $attribute->getSource()->getAllOptions(); ?>
68
+ <?php foreach($options as $key=>$value): ?>
69
+ <option value="<?php echo $key ?>"<?php if($this->getAddress()->getResidentialcommercial()==$key) echo " selected=\"selected\""; ?>><?php echo $value ?></option>
70
+ <?php endforeach; ?>
71
+ </select>
72
+ </div>
73
+ </li>
74
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
75
+ <li class="wide">
76
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
77
+ <div class="input-box">
78
+ <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 ?>" />
79
+ </div>
80
+ </li>
81
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
82
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
83
+ <li class="wide">
84
+ <div class="input-box">
85
+ <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 ?>" />
86
+ </div>
87
+ </li>
88
+ <?php endfor; ?>
89
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
90
+ <li class="wide">
91
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
92
+ <div class="input-box">
93
+ <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') ?>" />
94
+ </div>
95
+ </li>
96
+ <?php endif; ?>
97
+ <li class="fields">
98
+ <div class="field">
99
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
100
+ <div class="input-box">
101
+ <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" />
102
+ </div>
103
+ </div>
104
+ <div class="field">
105
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
106
+ <div class="input-box">
107
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
108
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
109
+ </select>
110
+ <script type="text/javascript">
111
+ //<![CDATA[
112
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
113
+ //]]>
114
+ </script>
115
+ <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;" />
116
+ </div>
117
+ </div>
118
+ </li>
119
+ <li class="fields">
120
+ <div class="field">
121
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
122
+ <div class="input-box">
123
+ <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') ?>" />
124
+ </div>
125
+ </div>
126
+ <div class="field">
127
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
128
+ <div class="input-box">
129
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
130
+ </div>
131
+ </div>
132
+ </li>
133
+ <li class="fields">
134
+ <div class="field">
135
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
136
+ <div class="input-box">
137
+ <input type="text" name="billing[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="billing:telephone" />
138
+ </div>
139
+ </div>
140
+ <div class="field">
141
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
142
+ <div class="input-box">
143
+ <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" />
144
+ </div>
145
+ </div>
146
+ </li>
147
+ <?php if(!$this->isCustomerLoggedIn()): ?>
148
+
149
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
150
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
151
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
152
+ <li class="fields">
153
+ <?php if ($_dob->isEnabled()): ?>
154
+ <div class="field">
155
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
156
+ </div>
157
+ <?php endif; ?>
158
+ <?php if ($_gender->isEnabled()): ?>
159
+ <div class="field">
160
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
161
+ </div>
162
+ <?php endif ?>
163
+ </li>
164
+ <?php endif ?>
165
+
166
+ <?php if ($this->isTaxvatEnabled()):?>
167
+ <li><?php echo $this->getTaxvatHtml() ?></li>
168
+ <?php endif; ?>
169
+
170
+ <li class="fields" id="register-customer-password">
171
+ <div class="field">
172
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
173
+ <div class="input-box">
174
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
175
+ </div>
176
+ </div>
177
+ <div class="field">
178
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
179
+ <div class="input-box">
180
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
181
+ </div>
182
+ </div>
183
+ </li>
184
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
185
+ <?php endif; ?>
186
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
187
+ <li class="control">
188
+ <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>
189
+ </li>
190
+ <?php else:?>
191
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
192
+ <?php endif; ?>
193
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
194
+ </ul>
195
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
196
+ </fieldset>
197
+ </li>
198
+ <?php if ($this->canShip()): ?>
199
+ <li class="control">
200
+ <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>
201
+ <li class="control">
202
+ <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>
203
+ </li>
204
+ <?php endif; ?>
205
+ </ul>
206
+ <?php if (!$this->canShip()): ?>
207
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
208
+ <?php endif; ?>
209
+ <div class="buttons-set" id="billing-buttons-container">
210
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
211
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
212
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
213
+ <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...') ?>
214
+ </span>
215
+ </div>
216
+ </fieldset>
217
+ </form>
218
+ <script type="text/javascript">
219
+ //<![CDATA[
220
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
221
+ var billingForm = new VarienForm('co-billing-form');
222
+
223
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
224
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
225
+
226
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
227
+ if ($('onepage-guest-register-button')) {
228
+ Event.observe($('onepage-guest-register-button'), 'click', function(event) {
229
+ var billingRememberMe = $('co-billing-form').select('#remember-me-box');
230
+ if (billingRememberMe.length > 0) {
231
+ if ($('login:guest') && $('login:guest').checked) {
232
+ billingRememberMe[0].hide();
233
+ } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
234
+ billingRememberMe[0].show();
235
+ }
236
+ }
237
+ });
238
+ }
239
+ //]]>
240
+ </script>
app/design/frontend/default/default/template/persistent/customer/form/register.phtml ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/register.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Register */
34
+ ?>
35
+ <div class="account-create">
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Create an Account') ?></h1>
38
+ </div>
39
+ <?php echo $this->getChildHtml('form_fields_before')?>
40
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
42
+ <div class="fieldset">
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
46
+ <ul class="form-list">
47
+ <li class="fields">
48
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
49
+ </li>
50
+ <li>
51
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
52
+ <div class="input-box">
53
+ <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
54
+ </div>
55
+ </li>
56
+ <?php if ($this->isNewsletterEnabled()): ?>
57
+ <li class="control">
58
+ <div class="input-box">
59
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
60
+ </div>
61
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
62
+ </li>
63
+ <?php endif ?>
64
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
65
+ <?php if ($_dob->isEnabled()): ?>
66
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
67
+ <?php endif ?>
68
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
69
+ <?php if ($_taxvat->isEnabled()): ?>
70
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
71
+ <?php endif ?>
72
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
73
+ <?php if ($_gender->isEnabled()): ?>
74
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
75
+ <?php endif ?>
76
+ </ul>
77
+ </div>
78
+ <?php if($this->getShowAddressFields()): ?>
79
+ <div class="fieldset">
80
+ <input type="hidden" name="create_address" value="1" />
81
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
82
+ <ul class="form-list">
83
+ <li class="fields">
84
+ <div class="field">
85
+ <label for="company"><?php echo $this->__('Company') ?></label>
86
+ <div class="input-box">
87
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
88
+ </div>
89
+ </div>
90
+ <div class="field">
91
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
92
+ <div class="input-box">
93
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
94
+ </div>
95
+ </div>
96
+ </li>
97
+ <li class="fields">
98
+ <div class="field">
99
+ <label for="residentialcommercial"><?php echo $this->__('Address Type') ?></label>
100
+ </div>
101
+ <div class="input-box">
102
+ <select id="residentialcommercial" name="residentialcommercial" title="<?php echo $this->__('Address Type') ?>" class="validate-select">
103
+ <option selected="selected" value="0">Commercial</option>
104
+ <option value="1">Residential</option>
105
+ </select>
106
+ </div>
107
+ </li>
108
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
109
+ <li class="wide">
110
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
111
+ <div class="input-box">
112
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
113
+ </div>
114
+ </li>
115
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
116
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
117
+ <li class="wide">
118
+ <div class="input-box">
119
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
120
+ </div>
121
+ </li>
122
+ <?php endfor; ?>
123
+ <li class="fields">
124
+ <div class="field">
125
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
126
+ <div class="input-box">
127
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
128
+ </div>
129
+ </div>
130
+ <div class="field">
131
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
132
+ <div class="input-box">
133
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
134
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
135
+ </select>
136
+ <script type="text/javascript">
137
+ //<![CDATA[
138
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
139
+ //]]>
140
+ </script>
141
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
142
+ </div>
143
+ </div>
144
+ </li>
145
+ <li class="fields">
146
+ <div class="field">
147
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
148
+ <div class="input-box">
149
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
150
+ </div>
151
+ </div>
152
+ <div class="field">
153
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
154
+ <div class="input-box">
155
+ <?php echo $this->getCountryHtmlSelect() ?>
156
+ </div>
157
+ </div>
158
+ </li>
159
+ </ul>
160
+ <input type="hidden" name="default_billing" value="1" />
161
+ <input type="hidden" name="default_shipping" value="1" />
162
+ </div>
163
+ <?php endif; ?>
164
+ <div class="fieldset">
165
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
166
+ <ul class="form-list">
167
+ <li class="fields">
168
+ <div class="field">
169
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
170
+ <div class="input-box">
171
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
172
+ </div>
173
+ </div>
174
+ <div class="field">
175
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
176
+ <div class="input-box">
177
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
178
+ </div>
179
+ </div>
180
+ </li>
181
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
182
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
183
+ </ul>
184
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
185
+ </div>
186
+ <div class="buttons-set">
187
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
188
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
189
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
190
+ </div>
191
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
192
+ <input name="context" type="hidden" value="checkout" />
193
+ <?php endif; ?>
194
+ </form>
195
+ <script type="text/javascript">
196
+ //<![CDATA[
197
+ var dataForm = new VarienForm('form-validate', true);
198
+ <?php if($this->getShowAddressFields()): ?>
199
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
200
+ <?php endif; ?>
201
+ //]]>
202
+ </script>
203
+ </div>
app/etc/modules/Ameex_ResidentialCommercial.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ameex_ResidentialCommercial>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Ameex_ResidentialCommercial>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CommerceBees_ResidentialCommercial_Pro_v1</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://www.gnu.org/copyleft/gpl.html">GPL v4</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Residential/Commercial Pro is a Magento module to indicate whether the customers' addresses are Residential or Commercial &amp;amp;amp; get the Shipping Quotes according to the Address Type.</summary>
10
+ <description>Residential/Commercial Pro is a Magento module to indicate whether the customers' addresses are Residential or Commercial &amp;amp;amp; get the Shipping Quotes according to the Address Type.</description>
11
+ <notes>First version of Residential/Commercial Pro module is released.</notes>
12
+ <authors><author><name>Commerce Bees</name><user>CommerceBees</user><email>support@commercebees.com</email></author></authors>
13
+ <date>2015-02-01</date>
14
+ <time>03:47:42</time>
15
+ <contents><target name="magelocal"><dir name="Ameex"><dir name="ResidentialCommercial"><dir name="Model"><file name="FedEx.php" hash="c5b7539c4c29351fd6b6377c843840b8"/><file name="Observer.php" hash="7708480e975993ec675e2f9102e89d75"/><file name="Source.php" hash="77608aa477c523abbda558a9177169e4"/><file name="Ups.php" hash="92fe902b1e8f377daa3e5c06dcdf61ce"/></dir><dir name="etc"><file name="config.xml" hash="29526bb21940cd486ab83089c4453728"/></dir><dir name="sql"><dir name="residentialcommercial_setup"><file name="mysql4-install-1.0.0.php" hash="e633d4f217b48dfaf989a9abe38a76bb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="49a916adef85dfc63955cb86e757b5de"/></dir><dir name="onepage"><file name="shipping.phtml" hash="0ff10441ffffe7f6e985975c60c3a5f0"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="18dd866442451c96ddea75482b50662b"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c3108813aa3bb6b37002abd1918aff87"/></dir></dir><dir name="customer"><dir name="form"><file name="register.phtml" hash="921d6cb47ca78ffb2d7e36d79d01d28b"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ameex_ResidentialCommercial.xml" hash="76359033ad34f894b590f98ba17f066c"/></dir></target><target name="mage"><dir name="."><file name="CommerceBees_ResidentialCommercialPro_Extension_Guide_V1.0.pdf" hash="1dd93807a55fa43675bfe1a1093255c5"/><file name="uninstall_ameex_residentialcommercial_module_bak.php" hash="452b8e6ecd47897e4df9166c1f75a3bc"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
18
+ </package>
uninstall_ameex_residentialcommercial_module_bak.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'app/Mage.php';
3
+ umask(0);
4
+ Mage::app('default');
5
+
6
+ $setup = Mage::getModel('eav/entity_setup', 'core_setup');
7
+ $setup->startSetup();
8
+ $setup->removeAttribute('customer_address', 'residentialcommercial');
9
+
10
+ $setup->run("DELETE FROM {$setup->getTable('core/resource')} WHERE code='residentialcommercial_setup';
11
+ ALTER TABLE sales_flat_quote_address DROP COLUMN residentialcommercial;
12
+ ALTER TABLE sales_flat_order_address DROP COLUMN residentialcommercial;
13
+ ");
14
+ $setup->endSetup();
15
+
16
+ echo 'Residential/Commercial module has been uninstalled completely';