Version Notes
test notes
Download this release
Release Info
Developer | Extensions Store |
Extension | Addressvalidator |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- app/code/community/Aydus/Addressvalidator/Helper/Data.php +34 -24
- app/code/community/Aydus/Addressvalidator/Model/Observer.php +35 -22
- app/code/community/Aydus/Addressvalidator/etc/config.xml +1 -1
- app/code/community/Aydus/Addressvalidator/etc/system.xml +1 -1
- app/design/frontend/base/default/template/aydus/addressvalidator/popup.phtml +5 -1
- package.xml +4 -4
- skin/frontend/base/default/js/aydus/addressvalidator.js +14 -12
app/code/community/Aydus/Addressvalidator/Helper/Data.php
CHANGED
@@ -194,9 +194,10 @@ class Aydus_Addressvalidator_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
194 |
*
|
195 |
* @param Mage_Customer_Model_Address $address
|
196 |
* @param array $data
|
|
|
197 |
* @return bool
|
198 |
*/
|
199 |
-
public function setAddressData($address, $data)
|
200 |
{
|
201 |
try {
|
202 |
|
@@ -227,7 +228,9 @@ class Aydus_Addressvalidator_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
227 |
}
|
228 |
|
229 |
$address->addData($data);
|
230 |
-
$
|
|
|
|
|
231 |
|
232 |
$customerAddressId = (int)$address->getCustomerAddressId();
|
233 |
|
@@ -237,19 +240,23 @@ class Aydus_Addressvalidator_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
237 |
$customerAddress->addData($data);
|
238 |
$customerAddress->setPopulated(1);
|
239 |
$customerAddress->save();
|
240 |
-
|
241 |
-
$datetime = date('Y-m-d H:i:s');
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
$validatedAddress->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
-
|
252 |
-
$validatedAddress->save();
|
253 |
}
|
254 |
|
255 |
if ($address->getAddressType() == 'billing'){
|
@@ -272,18 +279,21 @@ class Aydus_Addressvalidator_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
272 |
$customerShippingAddress->setPopulated(1);
|
273 |
$customerShippingAddress->save();
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
$validatedShippingAddress->
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
285 |
-
$validatedShippingAddress->setDateUpdated($datetime);
|
286 |
-
$validatedShippingAddress->save();
|
287 |
|
288 |
}
|
289 |
|
194 |
*
|
195 |
* @param Mage_Customer_Model_Address $address
|
196 |
* @param array $data
|
197 |
+
* @param bool $saveQuoteAddress
|
198 |
* @return bool
|
199 |
*/
|
200 |
+
public function setAddressData($address, $data, $saveQuoteAddress=true)
|
201 |
{
|
202 |
try {
|
203 |
|
228 |
}
|
229 |
|
230 |
$address->addData($data);
|
231 |
+
if ($saveQuoteAddress){
|
232 |
+
$address->save();
|
233 |
+
}
|
234 |
|
235 |
$customerAddressId = (int)$address->getCustomerAddressId();
|
236 |
|
240 |
$customerAddress->addData($data);
|
241 |
$customerAddress->setPopulated(1);
|
242 |
$customerAddress->save();
|
|
|
|
|
243 |
|
244 |
+
if ($customerAddress->getId()){
|
245 |
+
|
246 |
+
$datetime = date('Y-m-d H:i:s');
|
247 |
+
|
248 |
+
$validatedAddress = Mage::getModel('aydus_addressvalidator/address');
|
249 |
+
$validatedAddress->load($customerAddress->getId(), 'address_id');
|
250 |
+
$validatedAddress->setAddressId($customerAddress->getId());
|
251 |
+
$validatedAddress->setAddressType($customerAddress->getAddressType());
|
252 |
+
$validatedAddress->setValidated(1);
|
253 |
+
if (!$validatedAddress->getId()){
|
254 |
+
$validatedAddress->setDateCreated($datetime);
|
255 |
+
}
|
256 |
+
$validatedAddress->setDateUpdated($datetime);
|
257 |
+
$validatedAddress->save();
|
258 |
}
|
259 |
+
|
|
|
260 |
}
|
261 |
|
262 |
if ($address->getAddressType() == 'billing'){
|
279 |
$customerShippingAddress->setPopulated(1);
|
280 |
$customerShippingAddress->save();
|
281 |
|
282 |
+
if ($customerShippingAddress->getId()){
|
283 |
+
|
284 |
+
$datetime = date('Y-m-d H:i:s');
|
285 |
+
|
286 |
+
$validatedShippingAddress = Mage::getModel('aydus_addressvalidator/address');
|
287 |
+
$validatedShippingAddress->load($customerShippingAddress->getId(), 'address_id');
|
288 |
+
$validatedShippingAddress->setAddressId($customerShippingAddress->getId());
|
289 |
+
$validatedShippingAddress->setAddressType($customerShippingAddress->getAddressType());
|
290 |
+
$validatedShippingAddress->setValidated(1);
|
291 |
+
if (!$validatedShippingAddress->getId()){
|
292 |
+
$validatedShippingAddress->setDateCreated($datetime);
|
293 |
+
}
|
294 |
+
$validatedShippingAddress->setDateUpdated($datetime);
|
295 |
+
$validatedShippingAddress->save();
|
296 |
}
|
|
|
|
|
297 |
|
298 |
}
|
299 |
|
app/code/community/Aydus/Addressvalidator/Model/Observer.php
CHANGED
@@ -18,12 +18,43 @@ class Aydus_Addressvalidator_Model_Observer extends Mage_Core_Model_Abstract {
|
|
18 |
*/
|
19 |
public function validateAddress($observer) {
|
20 |
|
|
|
21 |
$request = Mage::app()->getRequest();
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
$addressValidated = $request->getParam('address_validated');
|
24 |
if ($addressValidated) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
return $observer;
|
26 |
}
|
|
|
|
|
27 |
$addressId = $request->getParam('billing_address_id');
|
28 |
if (!$addressId){
|
29 |
$addressId = $request->getParam('shipping_address_id');
|
@@ -35,14 +66,6 @@ class Aydus_Addressvalidator_Model_Observer extends Mage_Core_Model_Abstract {
|
|
35 |
return $observer;
|
36 |
}
|
37 |
|
38 |
-
$event = $observer->getEvent();
|
39 |
-
$controller = $event->getControllerAction();
|
40 |
-
$response = $controller->getResponse();
|
41 |
-
$store = Mage::app()->getStore();
|
42 |
-
$storeId = $store->getId();
|
43 |
-
|
44 |
-
$helper = Mage::helper('addressvalidator');
|
45 |
-
|
46 |
if ($helper->tooManyAttempts()) {
|
47 |
|
48 |
$result = array();
|
@@ -60,16 +83,6 @@ class Aydus_Addressvalidator_Model_Observer extends Mage_Core_Model_Abstract {
|
|
60 |
|
61 |
if ($validateStore) {
|
62 |
|
63 |
-
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
64 |
-
|
65 |
-
if ($event->getName() == 'controller_action_postdispatch_checkout_onepage_saveBilling') {
|
66 |
-
|
67 |
-
$address = $quote->getBillingAddress();
|
68 |
-
} else {
|
69 |
-
|
70 |
-
$address = $quote->getShippingAddress();
|
71 |
-
}
|
72 |
-
|
73 |
$international = ($address->getCountryId() && Mage::getStoreConfig('general/country/default') != $address->getCountryId()) ? true : false;
|
74 |
$service = $helper->getService($storeId, $international);
|
75 |
$returned = array('error' => true);
|
@@ -93,11 +106,10 @@ class Aydus_Addressvalidator_Model_Observer extends Mage_Core_Model_Abstract {
|
|
93 |
$result['data'] = json_encode($returned['data']);
|
94 |
$result['message'] = $helper->getMessaging('matches_available') . $responseCode;
|
95 |
|
96 |
-
$helper->setAddressData($address, $returned['data'][0]);
|
97 |
-
|
98 |
$autoPopulate = (int)Mage::getStoreConfig('aydus_addressvalidator/configuration/auto_populate', $storeId);
|
99 |
|
100 |
if ($autoPopulate){
|
|
|
101 |
$observer->setResult($result);
|
102 |
return $observer;
|
103 |
}
|
@@ -142,12 +154,13 @@ class Aydus_Addressvalidator_Model_Observer extends Mage_Core_Model_Abstract {
|
|
142 |
{
|
143 |
$customerAddress = $observer->getCustomerAddress();
|
144 |
|
145 |
-
if (!$customerAddress->getPopulated()){
|
146 |
|
147 |
$validatedAddress = Mage::getModel('aydus_addressvalidator/address');
|
148 |
$validatedAddress->load($customerAddress->getId(), 'address_id');
|
149 |
|
150 |
$datetime = date('Y-m-d H:i:s');
|
|
|
151 |
$validatedAddress->setValidated(0);
|
152 |
|
153 |
if (!$validatedAddress->getId()){
|
18 |
*/
|
19 |
public function validateAddress($observer) {
|
20 |
|
21 |
+
$helper = Mage::helper('addressvalidator');
|
22 |
$request = Mage::app()->getRequest();
|
23 |
+
$event = $observer->getEvent();
|
24 |
+
$controller = $event->getControllerAction();
|
25 |
+
$response = $controller->getResponse();
|
26 |
+
$store = Mage::app()->getStore();
|
27 |
+
$storeId = $store->getId();
|
28 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
29 |
+
|
30 |
+
if ($event->getName() == 'controller_action_postdispatch_checkout_onepage_saveBilling') {
|
31 |
+
|
32 |
+
$address = $quote->getBillingAddress();
|
33 |
+
} else {
|
34 |
+
|
35 |
+
$address = $quote->getShippingAddress();
|
36 |
+
}
|
37 |
+
|
38 |
+
//save validated address
|
39 |
$addressValidated = $request->getParam('address_validated');
|
40 |
if ($addressValidated) {
|
41 |
+
if ($address->getAddressType()=='billing'){
|
42 |
+
$postData = $request->getParam('billing');
|
43 |
+
} else {
|
44 |
+
$postData = $request->getParam('shipping');
|
45 |
+
}
|
46 |
+
$postData['customer_address_id'] = $addressValidated;
|
47 |
+
$helper->setAddressData($address, $postData, false);
|
48 |
+
return $observer;
|
49 |
+
}
|
50 |
+
|
51 |
+
//customer elected to skip validation
|
52 |
+
$skipValidation = (int)$request->getParam('skip_validation');
|
53 |
+
if ($skipValidation){
|
54 |
return $observer;
|
55 |
}
|
56 |
+
|
57 |
+
//skip validation if customer address has already been validated
|
58 |
$addressId = $request->getParam('billing_address_id');
|
59 |
if (!$addressId){
|
60 |
$addressId = $request->getParam('shipping_address_id');
|
66 |
return $observer;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
if ($helper->tooManyAttempts()) {
|
70 |
|
71 |
$result = array();
|
83 |
|
84 |
if ($validateStore) {
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$international = ($address->getCountryId() && Mage::getStoreConfig('general/country/default') != $address->getCountryId()) ? true : false;
|
87 |
$service = $helper->getService($storeId, $international);
|
88 |
$returned = array('error' => true);
|
106 |
$result['data'] = json_encode($returned['data']);
|
107 |
$result['message'] = $helper->getMessaging('matches_available') . $responseCode;
|
108 |
|
|
|
|
|
109 |
$autoPopulate = (int)Mage::getStoreConfig('aydus_addressvalidator/configuration/auto_populate', $storeId);
|
110 |
|
111 |
if ($autoPopulate){
|
112 |
+
$helper->setAddressData($address, $returned['data'][0], true);
|
113 |
$observer->setResult($result);
|
114 |
return $observer;
|
115 |
}
|
154 |
{
|
155 |
$customerAddress = $observer->getCustomerAddress();
|
156 |
|
157 |
+
if ($customerAddress->getId() && !$customerAddress->getPopulated()){
|
158 |
|
159 |
$validatedAddress = Mage::getModel('aydus_addressvalidator/address');
|
160 |
$validatedAddress->load($customerAddress->getId(), 'address_id');
|
161 |
|
162 |
$datetime = date('Y-m-d H:i:s');
|
163 |
+
$validatedAddress->setAddressId($customerAddress->getId());
|
164 |
$validatedAddress->setValidated(0);
|
165 |
|
166 |
if (!$validatedAddress->getId()){
|
app/code/community/Aydus/Addressvalidator/etc/config.xml
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Aydus_Addressvalidator>
|
14 |
-
<version>1.4.
|
15 |
</Aydus_Addressvalidator>
|
16 |
</modules>
|
17 |
<phpunit>
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Aydus_Addressvalidator>
|
14 |
+
<version>1.4.1</version>
|
15 |
</Aydus_Addressvalidator>
|
16 |
</modules>
|
17 |
<phpunit>
|
app/code/community/Aydus/Addressvalidator/etc/system.xml
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
<comment><![CDATA[Select the number of validation attempts allowed (minimum 1, maximum 25).]]></comment>
|
55 |
</num_attempts>
|
56 |
<too_many_attempts_url translate="label">
|
57 |
-
<label>
|
58 |
<frontend_type>text</frontend_type>
|
59 |
<sort_order>4</sort_order>
|
60 |
<show_in_default>1</show_in_default>
|
54 |
<comment><![CDATA[Select the number of validation attempts allowed (minimum 1, maximum 25).]]></comment>
|
55 |
</num_attempts>
|
56 |
<too_many_attempts_url translate="label">
|
57 |
+
<label>Customer Service URL</label>
|
58 |
<frontend_type>text</frontend_type>
|
59 |
<sort_order>4</sort_order>
|
60 |
<show_in_default>1</show_in_default>
|
app/design/frontend/base/default/template/aydus/addressvalidator/popup.phtml
CHANGED
@@ -6,6 +6,10 @@
|
|
6 |
* @package Aydus_Addressvalidator
|
7 |
* @author Aydus <davidt@aydus.com>
|
8 |
*/
|
|
|
|
|
|
|
|
|
9 |
?>
|
10 |
|
11 |
|
@@ -32,7 +36,7 @@
|
|
32 |
<span><span><?php echo $this->__('Skip') ?></span></span>
|
33 |
</button>
|
34 |
|
35 |
-
<button class="button okay" href="<?php echo $
|
36 |
<span><span><?php echo $this->__('Customer Service') ?></span></span>
|
37 |
</button>
|
38 |
|
6 |
* @package Aydus_Addressvalidator
|
7 |
* @author Aydus <davidt@aydus.com>
|
8 |
*/
|
9 |
+
|
10 |
+
$storeId = Mage::app()->getStore()->getId();
|
11 |
+
$tooManyAttemptsUrl = Mage::getStoreConfig('aydus_addressvalidator/configuration/too_many_attempts_url',$storeId);
|
12 |
+
$customerServiceUrl = $this->getUrl($tooManyAttemptsUrl);
|
13 |
?>
|
14 |
|
15 |
|
36 |
<span><span><?php echo $this->__('Skip') ?></span></span>
|
37 |
</button>
|
38 |
|
39 |
+
<button class="button okay" href="<?php echo $customerServiceUrl ?>">
|
40 |
<span><span><?php echo $this->__('Customer Service') ?></span></span>
|
41 |
</button>
|
42 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Addressvalidator</name>
|
4 |
-
<version>1.4.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Validate billing and shipping addresses in the One Page Checkout. Customer submits billing and shipping addresses and is shown a popup of valid addresses to choose from. With support for UPS, USPS, Fedex, Address Doctor and Melissa Data.</description>
|
11 |
<notes>test notes</notes>
|
12 |
<authors><author><name>Extensions Store</name><user>Extension</user><email>admin@extensions-store.com</email></author><author><name>Extensions Store</name><user>Extension</user><email>admin@extensions-store.com</email></author></authors>
|
13 |
-
<date>2015-08-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Aydus"><dir name="Addressvalidator"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Validexceptions.php" hash="cc648c12bc605c14f6127638ceddbe2d"/></dir></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Billing.php" hash="6be15561b9b09a101bf009734c5ee3a1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Addressvalidator</name>
|
4 |
+
<version>1.4.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Validate billing and shipping addresses in the One Page Checkout. Customer submits billing and shipping addresses and is shown a popup of valid addresses to choose from. With support for UPS, USPS, Fedex, Address Doctor and Melissa Data.</description>
|
11 |
<notes>test notes</notes>
|
12 |
<authors><author><name>Extensions Store</name><user>Extension</user><email>admin@extensions-store.com</email></author><author><name>Extensions Store</name><user>Extension</user><email>admin@extensions-store.com</email></author></authors>
|
13 |
+
<date>2015-08-21</date>
|
14 |
+
<time>01:17:43</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Aydus"><dir name="Addressvalidator"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Validexceptions.php" hash="cc648c12bc605c14f6127638ceddbe2d"/></dir></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Billing.php" hash="6be15561b9b09a101bf009734c5ee3a1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ed254c7dd29cc384b67f91ae42a6b53d"/></dir><dir name="Model"><file name="Address.php" hash="1a8180e69fd0ad58b0fa0d3423c490c0"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Addressdoctor"><file name="Validcodes.php" hash="fde2d39e5876e12c36857d896cae88c6"/></dir><file name="Service.php" hash="63d35c97530c54ce49deee6a1a746375"/></dir></dir></dir></dir><file name="Observer.php" hash="64637a622866fa51e9131c1861a10b98"/><dir name="Resource"><dir name="Address"><file name="Collection.php" hash="f1d88a6e347f83971dd3b41781e8f073"/></dir><file name="Address.php" hash="6638c5f7e07684441c895337c72d6c83"/></dir><dir name="Service"><file name="Abstract.php" hash="281351d7c63b1e92f1cb36f3135f35fb"/><file name="Addressdoctor.php" hash="484ed6246dc1e5ad93cca07d87d76680"/><file name="Fedex.php" hash="1608ae2c935597975816c61dd4a00a90"/><file name="Melissadata.php" hash="629c48b5ab2a40fa177c5a0a2b2e5607"/><file name="Ups.php" hash="9dbcb0dd63eb6bf864b61790fd9d8930"/><file name="Usps.php" hash="f29c986b213806e363a4f51ff19d0c53"/></dir></dir><dir name="Test"><dir name="Controller"><dir name="TestController"><dir name="fixtures"><file name="testController.yaml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><file name="TestController.php" hash="b0df7546fc56bd869d805a96e209ee77"/></dir><dir name="Helper"><dir name="TestHelper"><dir name="fixtures"><file name="testHelper.yaml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><file name="TestHelper.php" hash="3089d78a75d13084f9482995e807a37f"/></dir><dir name="Model"><dir name="TestModel"><dir name="fixtures"><file name="testModel.yaml" hash="ebcadfcfe7ac7469233f4d5124985792"/></dir></dir><file name="TestModel.php" hash="12609ff92a073dc75d8607482a48c870"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ec0ecd573275c3b98e98fe85c3d8bbf5"/><file name="config.xml" hash="ef080e432356cff13ee1465442ebad11"/><file name="system.xml" hash="269708db3262764131ed8410e476257c"/></dir><file name="readme.md" hash="99ee8caa9700fc61ebd943728645896c"/><dir name="sql"><dir name="aydus_addressvalidator_setup"><file name="install-1.0.0.php" hash="a3d556dd3c24a7cc8bad23ed556b61a0"/><file name="upgrade-1.3.0-1.4.0.php" hash="f1d251e2c674b055a991c09dc540ddfb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="aydus"><file name="addressvalidator.xml" hash="f0610f66ee0426e7b7aff9e4ac90d6da"/></dir></dir><dir name="template"><dir name="aydus"><dir name="addressvalidator"><file name="popup.phtml" hash="b7698d87698e3af70161449c379e6f6b"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aydus_Addressvalidator.xml" hash="b0a4f06b24da23ad6fe75178e987c89d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="aydus"><file name="addressvalidator.css" hash="c2499e0b4a71cdd7c5456496aefd502b"/></dir></dir><dir name="images"><dir name="aydus"><dir name="addressvalidator"><file name="LOGO_L.gif" hash="5aa294d5345e5b4cc83e92f8ae443283"/><file name="LOGO_S.gif" hash="0654a9638a3b7787f35495ad17dc7363"/></dir></dir></dir><dir name="js"><dir name="aydus"><dir name="addressvalidator"><file name="address.js" hash="5917b0b84e3bae21c347d692d462a0e7"/></dir><file name="addressvalidator.js" hash="4a297c9c0c3d3f9ddacf9cf80e054d6f"/></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>
|
skin/frontend/base/default/js/aydus/addressvalidator.js
CHANGED
@@ -24,14 +24,6 @@ function AddressValidator($)
|
|
24 |
//set the popup scope for any js that needs it
|
25 |
$('#address-form').val(form);
|
26 |
|
27 |
-
//placeholder so address doesn't get validated again
|
28 |
-
var $addressValidated = $('#' + form).find('.address-validated');
|
29 |
-
if ($addressValidated.length > 0) {
|
30 |
-
$addressValidated.val(1);
|
31 |
-
} else {
|
32 |
-
$('#' + form).append('<input type="hidden" class="address-validated" name="address_validated" value="1" />');
|
33 |
-
}
|
34 |
-
|
35 |
try {
|
36 |
results = JSON.parse(resultsJson);
|
37 |
} catch (e) {
|
@@ -49,8 +41,6 @@ function AddressValidator($)
|
|
49 |
$popup.find('h4').html(message);
|
50 |
//show buttons we hid in editAddress
|
51 |
$popup.find('.select').show();
|
52 |
-
//hide skip button per JM
|
53 |
-
$popup.find('.skip, .okay').hide();
|
54 |
var $radios = $popup.find('ul.radios');
|
55 |
$radios.empty();
|
56 |
|
@@ -109,7 +99,7 @@ function AddressValidator($)
|
|
109 |
//append message
|
110 |
$popup.find('h4').html(message);
|
111 |
//hide the select button (nothing to select) and skip button (per JM)
|
112 |
-
$popup.find('.select, .
|
113 |
//show popup
|
114 |
$('#av-popup').show();
|
115 |
}
|
@@ -167,6 +157,7 @@ function AddressValidator($)
|
|
167 |
{
|
168 |
//deselect addressbook entry
|
169 |
$('#' + formType + '-new-address-form').show();
|
|
|
170 |
$('#' + formType + '-address-select').val(null);
|
171 |
|
172 |
$('#' + formType + '\\:street1').val(address.street[0]);
|
@@ -187,7 +178,15 @@ function AddressValidator($)
|
|
187 |
$('#' + formType + '\\:postcode').val(address.postcode);
|
188 |
$('#' + formType + '\\:country_id').val(address.country_id);
|
189 |
|
190 |
-
$('#' + formType + '\\:save_in_address_book').attr('checked',true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
};
|
192 |
|
193 |
/**
|
@@ -270,6 +269,9 @@ function AddressValidator($)
|
|
270 |
|
271 |
e.preventDefault();
|
272 |
e.stopPropagation();
|
|
|
|
|
|
|
273 |
|
274 |
gotoNextStep();
|
275 |
|
24 |
//set the popup scope for any js that needs it
|
25 |
$('#address-form').val(form);
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
try {
|
28 |
results = JSON.parse(resultsJson);
|
29 |
} catch (e) {
|
41 |
$popup.find('h4').html(message);
|
42 |
//show buttons we hid in editAddress
|
43 |
$popup.find('.select').show();
|
|
|
|
|
44 |
var $radios = $popup.find('ul.radios');
|
45 |
$radios.empty();
|
46 |
|
99 |
//append message
|
100 |
$popup.find('h4').html(message);
|
101 |
//hide the select button (nothing to select) and skip button (per JM)
|
102 |
+
$popup.find('.select, .okay').hide();
|
103 |
//show popup
|
104 |
$('#av-popup').show();
|
105 |
}
|
157 |
{
|
158 |
//deselect addressbook entry
|
159 |
$('#' + formType + '-new-address-form').show();
|
160 |
+
var customerAddressId = $('#' + formType + '-address-select').val();
|
161 |
$('#' + formType + '-address-select').val(null);
|
162 |
|
163 |
$('#' + formType + '\\:street1').val(address.street[0]);
|
178 |
$('#' + formType + '\\:postcode').val(address.postcode);
|
179 |
$('#' + formType + '\\:country_id').val(address.country_id);
|
180 |
|
181 |
+
$('#' + formType + '\\:save_in_address_book').attr('checked',true);
|
182 |
+
|
183 |
+
var $addressValidated = $('#co-' + formType + '-form').find('.address-validated');
|
184 |
+
if ($addressValidated.length > 0) {
|
185 |
+
$addressValidated.val(customerAddressId);
|
186 |
+
} else {
|
187 |
+
$('#co-' + formType + '-form').append('<input type="hidden" class="address-validated" name="address_validated" value="'+customerAddressId+'" />');
|
188 |
+
}
|
189 |
+
|
190 |
};
|
191 |
|
192 |
/**
|
269 |
|
270 |
e.preventDefault();
|
271 |
e.stopPropagation();
|
272 |
+
|
273 |
+
var form = $('#address-form').val();
|
274 |
+
$('#' + form).append('<input type="hidden" class="skip-validation" name="skip_validation" value="1" />');
|
275 |
|
276 |
gotoNextStep();
|
277 |
|