Version Notes
None
Download this release
Release Info
Developer | Matt Woodward |
Extension | WhitePages_PRO |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Create/Form/Account/Autocomplete.php +35 -0
- app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Grid/Renderer/MatchScore.php +41 -0
- app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Tab/MatchScore.php +178 -0
- app/code/community/Wp/WhitePages/Block/Adminhtml/System/Config/Options/Button.php +53 -0
- app/code/community/Wp/WhitePages/Helper/Data.php +80 -0
- app/code/community/Wp/WhitePages/Model/Api.php +220 -0
- app/code/community/Wp/WhitePages/Model/AutocompleteAddress.php +186 -0
- app/code/community/Wp/WhitePages/Model/MatchScore.php +133 -0
- app/code/community/Wp/WhitePages/Model/Mysql4/MatchScore.php +34 -0
- app/code/community/Wp/WhitePages/Model/Mysql4/MatchScore/Collection.php +34 -0
- app/code/community/Wp/WhitePages/Model/Observer.php +158 -0
- app/code/community/Wp/WhitePages/Model/System/Config/Source/MatchScore.php +49 -0
- app/code/community/Wp/WhitePages/controllers/Adminhtml/IndexController.php +79 -0
- app/code/community/Wp/WhitePages/controllers/IndexController.php +39 -0
- app/code/community/Wp/WhitePages/etc/config.xml +184 -0
- app/code/community/Wp/WhitePages/etc/system.xml +99 -0
- app/code/community/Wp/WhitePages/sql/whitePages_setup/mysql4-install-0.0.1.php +42 -0
- app/design/adminhtml/default/default/layout/whitePages.xml +49 -0
- app/design/adminhtml/default/default/template/whitepages/order/create/form/account.phtml +38 -0
- app/design/adminhtml/default/default/template/whitepages/order/create/form/account/autocomplete.phtml +125 -0
- app/design/adminhtml/default/default/template/whitepages/order/create/form/account/autocomplete/results.phtml +89 -0
- app/design/adminhtml/default/default/template/whitepages/order/view/tab/matchscore.phtml +149 -0
- app/etc/modules/Wp_WhitePages.xml +9 -0
- js/whitepages/autocompleteaddress.js +253 -0
- package.xml +39 -0
- skin/adminhtml/default/default/images/WPPRO-blue.png +0 -0
- skin/adminhtml/default/default/whitepages.css +123 -0
app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Create/Form/Account/Autocomplete.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Wp_WhitePages_Block_Adminhtml_Sales_Order_Create_Form_Account_Autocomplete extends Mage_Adminhtml_Block_Template
|
29 |
+
{
|
30 |
+
public function getAutoCompleteResults()
|
31 |
+
{
|
32 |
+
$params = $this->getRequest()->getParams();
|
33 |
+
return Mage::getModel('whitePages/autocompleteAddress')->getAutocompleteResults($params,$params['type']);
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Grid/Renderer/MatchScore.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Block_Adminhtml_Sales_Order_Grid_Renderer_MatchScore extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
28 |
+
{
|
29 |
+
public function render(Varien_Object $row)
|
30 |
+
{
|
31 |
+
$matchScore = Mage::getModel('whitePages/matchScore')->getMatchScoreByOrderId($row->getEntityId());
|
32 |
+
$returnString = '';
|
33 |
+
if($matchScore->getId())
|
34 |
+
{
|
35 |
+
$returnString = "<strong class='grade-".$matchScore->getGrade()."'>".$matchScore->getGrade()."</strong><br>".Mage::helper('whitePages')->__('Score: %s', number_format( round( $matchScore->getScore(), 2 ), 2 ) );
|
36 |
+
}
|
37 |
+
|
38 |
+
return $returnString;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
?>
|
app/code/community/Wp/WhitePages/Block/Adminhtml/Sales/Order/Tab/MatchScore.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Block_Adminhtml_Sales_Order_Tab_MatchScore extends Mage_Adminhtml_Block_Template
|
28 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
29 |
+
{
|
30 |
+
|
31 |
+
protected $_matchScore;
|
32 |
+
|
33 |
+
/**
|
34 |
+
*
|
35 |
+
* Set the tab's content template
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
protected function _construct()
|
39 |
+
{
|
40 |
+
parent::_construct();
|
41 |
+
$this->setTemplate('whitepages/order/view/tab/matchscore.phtml');
|
42 |
+
$this->setMatchScore();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Retrieve order model instance
|
47 |
+
*
|
48 |
+
* @return Mage_Sales_Model_Order
|
49 |
+
*/
|
50 |
+
protected function _getOrder()
|
51 |
+
{
|
52 |
+
return Mage::registry('current_order');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Retrieve order model instance id
|
57 |
+
*
|
58 |
+
* @return Current order id
|
59 |
+
*/
|
60 |
+
protected function _getOrderId()
|
61 |
+
{
|
62 |
+
return $this->_getOrder()->getId();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Set the current orders MatchScore
|
67 |
+
*/
|
68 |
+
public function setMatchScore()
|
69 |
+
{
|
70 |
+
$orderId = $this->_getOrderId();
|
71 |
+
|
72 |
+
$this->_matchScore = Mage::getModel('whitePages/matchScore')->getMatchScoreByOrderId($orderId);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Retrieve MatchScore
|
77 |
+
*
|
78 |
+
* @return
|
79 |
+
*/
|
80 |
+
public function getMatchScore()
|
81 |
+
{
|
82 |
+
return $this->_matchScore;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function hasMatchScore()
|
86 |
+
{
|
87 |
+
$hasMatchScore = false;
|
88 |
+
if($this->_matchScore->getId() != null)
|
89 |
+
{
|
90 |
+
$hasMatchScore = true;
|
91 |
+
}
|
92 |
+
return $hasMatchScore;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getDetailedMatchScore()
|
96 |
+
{
|
97 |
+
return $this->_matchScore->getDetailedMatchScore();
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getOrderIp()
|
101 |
+
{
|
102 |
+
return $this->_getOrder()->getRemoteIp();
|
103 |
+
}
|
104 |
+
|
105 |
+
public function getMatchScoreGrade()
|
106 |
+
{
|
107 |
+
$matchScoreGrade = " ";
|
108 |
+
|
109 |
+
if($this->hasMatchScore() == true)
|
110 |
+
{
|
111 |
+
$matchScoreGrade .= "<strong class='grade-".$this->_matchScore->getGrade()."'>".$this->_matchScore->getGrade()." (".number_format( $this->_matchScore->getScore(), 2) .")</strong>";
|
112 |
+
}
|
113 |
+
else
|
114 |
+
{
|
115 |
+
$matchScoreGrade .= '';
|
116 |
+
}
|
117 |
+
|
118 |
+
return $matchScoreGrade;
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getMatchScoreLabel($labelKey)
|
122 |
+
{
|
123 |
+
$labelArray = array(
|
124 |
+
'phone_name' => $this->__('Phone-Name Score'),
|
125 |
+
'address_name' => $this->__('Address-Name Score'),
|
126 |
+
'deliverable' => $this->__('Deliverable Score'),
|
127 |
+
'family' => $this->__('Family Count'),
|
128 |
+
'spam' => $this->__('Phone Spam Score'),
|
129 |
+
'phone_type' => $this->__('Phone Type')
|
130 |
+
);
|
131 |
+
return $labelArray[$labelKey];
|
132 |
+
}
|
133 |
+
|
134 |
+
public function getFamilyNames(array $familyNames)
|
135 |
+
{
|
136 |
+
$nameArray = array();
|
137 |
+
foreach ($familyNames as $key => $familyName)
|
138 |
+
{
|
139 |
+
$nameArray[] = $familyName['lastname'];
|
140 |
+
}
|
141 |
+
return implode(', ', $nameArray);
|
142 |
+
}
|
143 |
+
|
144 |
+
public function getTransactionDetails()
|
145 |
+
{
|
146 |
+
return $this->_matchScore->getTransactionDetails();
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
/**
|
151 |
+
* ######################## TAB settings #################################
|
152 |
+
*/
|
153 |
+
|
154 |
+
public function getTabClass()
|
155 |
+
{
|
156 |
+
return "";
|
157 |
+
}
|
158 |
+
|
159 |
+
public function getTabLabel()
|
160 |
+
{
|
161 |
+
return Mage::helper('sales')->__('MatchScore%s',$this->getMatchScoreGrade());
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getTabTitle()
|
165 |
+
{
|
166 |
+
return Mage::helper('sales')->__('MatchScore%s',$this->getMatchScoreGrade());
|
167 |
+
}
|
168 |
+
|
169 |
+
public function canShowTab()
|
170 |
+
{
|
171 |
+
return true;
|
172 |
+
}
|
173 |
+
|
174 |
+
public function isHidden()
|
175 |
+
{
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
}
|
app/code/community/Wp/WhitePages/Block/Adminhtml/System/Config/Options/Button.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Block_Adminhtml_System_Config_Options_Button
|
28 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
29 |
+
{
|
30 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$element->setScopeLabel(null);
|
33 |
+
return parent::render($element);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get country selector html
|
38 |
+
*
|
39 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
43 |
+
{
|
44 |
+
|
45 |
+
return '<button id="test_wp_api_key" title="'.Mage::helper('whitePages')->__('Validate API Key').'" type="button" class="scalable" onclick="wpTestApiKey()" style=""><span><span><span>'.Mage::helper('whitePages')->__('Validate API Key').'</span></span></span></button><p></p>'. $this->helper('adminhtml/js')
|
46 |
+
->getScript( $this->getAjaxJs());
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function getAjaxJs()
|
50 |
+
{
|
51 |
+
return "function wpTestApiKey() { url = '".Mage::helper("adminhtml")->getUrl('wp/adminhtml_index/testkey')."'; new Ajax.Request(url, { method: 'get', onComplete: function(req) { if(req.responseText == 'error'){alert('Invalid Request');}else{alert(req.responseText);}}});};";
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Wp/WhitePages/Helper/Data.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Helper_Data extends Mage_Core_Helper_Abstract
|
28 |
+
{
|
29 |
+
public function getMatchScoreExpression($key)
|
30 |
+
{
|
31 |
+
switch ($key)
|
32 |
+
{
|
33 |
+
case 'match_score':
|
34 |
+
$result = new Zend_Db_Expr("IFNULL((SELECT grade as match_score_id FROM wp_match_score WHERE order_id = main_table.entity_id LIMIT 1),'Z') ");
|
35 |
+
break;
|
36 |
+
}
|
37 |
+
return $result;
|
38 |
+
}
|
39 |
+
|
40 |
+
/*
|
41 |
+
*
|
42 |
+
*/
|
43 |
+
|
44 |
+
public function getMatchScoreOptions()
|
45 |
+
{
|
46 |
+
$grades = range('A', 'F');
|
47 |
+
$matchScoresOptionArray = array();
|
48 |
+
|
49 |
+
foreach ($grades as $key => $value)
|
50 |
+
{
|
51 |
+
$matchScoresOptionArray[$value] = $value;
|
52 |
+
}
|
53 |
+
|
54 |
+
return $matchScoresOptionArray;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function isScoreDeclined($grade)
|
58 |
+
{
|
59 |
+
$declined = false;
|
60 |
+
|
61 |
+
// Get MatchScore decline configuration
|
62 |
+
$matchScoreDeclineGrade = Mage::getStoreConfig('whitePages_configuration/match_score/decline');
|
63 |
+
|
64 |
+
if(ctype_alpha($matchScoreDeclineGrade) == true && $this->toNumber($matchScoreDeclineGrade) < $this->toNumber($grade) )
|
65 |
+
{
|
66 |
+
$declined = true;
|
67 |
+
}
|
68 |
+
|
69 |
+
return $declined;
|
70 |
+
}
|
71 |
+
|
72 |
+
private function toNumber($dest)
|
73 |
+
{
|
74 |
+
if ($dest)
|
75 |
+
return ord(strtolower($dest)) - 96;
|
76 |
+
else
|
77 |
+
return 0;
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
app/code/community/Wp/WhitePages/Model/Api.php
ADDED
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_Api extends Mage_Core_Model_Abstract
|
28 |
+
{
|
29 |
+
//Configuration
|
30 |
+
const API_OUTPUT_TYPE = 'JSON';
|
31 |
+
const API_URL = 'http://proapi.whitepages.com';
|
32 |
+
const API_VERSION = '1.1';
|
33 |
+
const API_REQUEST_METHOD_MATCHSCORE = 'match_score';
|
34 |
+
const API_REQUEST_METHOD_TEST = 'reverse_phone'; //TODO:get test method action
|
35 |
+
const API_REQUEST_METHOD_REVERSEPHONE = 'reverse_phone';
|
36 |
+
const API_REQUEST_METHOD_FINDPERSON = 'find_person';
|
37 |
+
const API_REQUEST_METHOD_FINDBUSINESS = 'find_business';
|
38 |
+
const API_REQUEST_TEST_PHONENUMBER = 2069735100;
|
39 |
+
const API_REQUEST_TEST_SUCCESS_MESSAGE = 'Your WhitePages API is valid.';
|
40 |
+
const API_REQUEST_TEST_ERROR_MESSAGE = 'There was an error connecting to the server please contact WhitePages Support. ';
|
41 |
+
|
42 |
+
const ERROR_CODE_DEBUGGING = 200;
|
43 |
+
//TODO: Add other methods
|
44 |
+
//const REQUEST_METHOD_REVERSPHONE = 'match_score';
|
45 |
+
|
46 |
+
protected $_apiKey;
|
47 |
+
protected $_requestQuery;
|
48 |
+
protected $_result;
|
49 |
+
protected $_hasError;
|
50 |
+
|
51 |
+
|
52 |
+
/*
|
53 |
+
* Builds and sets the request query string
|
54 |
+
*/
|
55 |
+
public function setRequestQuery($requestArray=array())
|
56 |
+
{
|
57 |
+
//Add API Config to Request
|
58 |
+
$this->_requestQuery = '?'.http_build_query( $requestArray + $this->getConfig() );
|
59 |
+
$this->_hasError = false;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Make a free test conection to validate key
|
64 |
+
*
|
65 |
+
* @return the result Message string
|
66 |
+
*/
|
67 |
+
public function testKey()
|
68 |
+
{
|
69 |
+
$retunMessage = '';
|
70 |
+
|
71 |
+
$this->setRequestQuery( array( 'phone'=>Wp_WhitePages_Model_Api::API_REQUEST_TEST_PHONENUMBER) );
|
72 |
+
$testRequest = $this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_TEST);
|
73 |
+
|
74 |
+
if($this->_result["result"]['type'] == 'error')
|
75 |
+
{
|
76 |
+
$retunMessage = $this->_result["result"]["message"];
|
77 |
+
}
|
78 |
+
elseif($this->_result["result"])
|
79 |
+
{
|
80 |
+
$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_SUCCESS_MESSAGE);
|
81 |
+
}
|
82 |
+
else
|
83 |
+
{
|
84 |
+
$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_ERROR_MESSAGE);
|
85 |
+
}
|
86 |
+
|
87 |
+
return $retunMessage;
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Make MatchScore request and return results
|
93 |
+
*
|
94 |
+
* @return the result array
|
95 |
+
*/
|
96 |
+
public function getMatchScore()
|
97 |
+
{
|
98 |
+
$this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_MATCHSCORE);
|
99 |
+
return $this->_result;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Make Reverse Phone request and return results
|
104 |
+
*
|
105 |
+
* @return the result array
|
106 |
+
*/
|
107 |
+
public function getReversePhone()
|
108 |
+
{
|
109 |
+
$this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_REVERSEPHONE);
|
110 |
+
return $this->_result;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Make Find Business request and return results
|
115 |
+
*
|
116 |
+
* @return the result array
|
117 |
+
*/
|
118 |
+
public function getFindBusiness()
|
119 |
+
{
|
120 |
+
$this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_FINDBUSINESS);
|
121 |
+
return $this->_result;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Make Find Person request and return results
|
126 |
+
*
|
127 |
+
* @return the result array
|
128 |
+
*/
|
129 |
+
public function getFindPerson()
|
130 |
+
{
|
131 |
+
$this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_FINDPERSON);
|
132 |
+
return $this->_result;
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getErrors()
|
136 |
+
{
|
137 |
+
return $this->_hasError;
|
138 |
+
}
|
139 |
+
|
140 |
+
/*
|
141 |
+
* Make Curl request and return JSON string as array
|
142 |
+
*/
|
143 |
+
private function _makeRequest($type)
|
144 |
+
{
|
145 |
+
|
146 |
+
$http = new Varien_Http_Adapter_Curl();
|
147 |
+
$config = array('timeout' => 30);
|
148 |
+
|
149 |
+
//Build URL from the
|
150 |
+
$url = Wp_WhitePages_Model_Api::API_URL.'/'.$type.'/'.Wp_WhitePages_Model_Api::API_VERSION.'/'. $this->_requestQuery;
|
151 |
+
|
152 |
+
//Magento logging
|
153 |
+
$isLogsActive = Mage::getStoreConfig('dev/log/active');
|
154 |
+
if($isLogsActive)
|
155 |
+
{
|
156 |
+
$this->wpDebug("Requests URL: ".$url);
|
157 |
+
}
|
158 |
+
//echo $url; die;
|
159 |
+
|
160 |
+
try
|
161 |
+
{
|
162 |
+
//Make Curl Request
|
163 |
+
$http->write('GET', $url, '1.1');
|
164 |
+
$this->_result = json_decode(Zend_Http_Response::extractBody($http->read()), true );
|
165 |
+
|
166 |
+
//Check for Curl Error
|
167 |
+
if($http->getErrno() != 0)
|
168 |
+
{
|
169 |
+
Mage::throwException($http->getError(). ' error number '. $http->getErrno());
|
170 |
+
}
|
171 |
+
//Check for API result Errors
|
172 |
+
elseif(array_key_exists('errors',$this->_result))
|
173 |
+
{
|
174 |
+
Mage::throwException($this->_result["errors"][0]);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
catch (Exception $e)
|
178 |
+
{
|
179 |
+
$this->wpDebug($e->getMessage(), Zend_Log::ERR);
|
180 |
+
$this->_hasError = true;
|
181 |
+
}
|
182 |
+
|
183 |
+
//Magento logging
|
184 |
+
if($isLogsActive)
|
185 |
+
{
|
186 |
+
$this->wpDebug( "Response Data: ".var_export($this->_result, true));
|
187 |
+
}
|
188 |
+
|
189 |
+
return $this->_result;
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
/*
|
194 |
+
* Return the API Key
|
195 |
+
*/
|
196 |
+
private function getApiKey()
|
197 |
+
{
|
198 |
+
return Mage::helper('core')->decrypt(Mage::getStoreConfig('whitePages_configuration/options/api_key'));
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
/*
|
203 |
+
* Returns the API Key and URL in an Array
|
204 |
+
*/
|
205 |
+
private function getConfig()
|
206 |
+
{
|
207 |
+
$apiKey = $this->getApiKey();
|
208 |
+
$configArray = array('api_key'=> $apiKey,'outputtype'=>Wp_WhitePages_Model_Api::API_OUTPUT_TYPE);
|
209 |
+
|
210 |
+
return $configArray;
|
211 |
+
}
|
212 |
+
|
213 |
+
/*
|
214 |
+
* Write any errors to our logs for easy reading
|
215 |
+
*/
|
216 |
+
public function wpDebug($message, $code=Zend_Log::INFO)
|
217 |
+
{
|
218 |
+
Mage::log($message, $code, "WhitePageswpDebug.log");
|
219 |
+
}
|
220 |
+
}
|
app/code/community/Wp/WhitePages/Model/AutocompleteAddress.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Wp_WhitePages_Model_AutocompleteAddress extends Mage_Core_Model_Abstract
|
29 |
+
{
|
30 |
+
protected $_type = null;
|
31 |
+
protected $_formattedResults = array(
|
32 |
+
'displayname' => null,
|
33 |
+
'address_prefix' => null,
|
34 |
+
'address_firstname' => null,
|
35 |
+
'address_middlename' => null,
|
36 |
+
'address_lastname' => null,
|
37 |
+
'address_suffix' => null,
|
38 |
+
'address_company' => null,
|
39 |
+
'address_street0' => null,
|
40 |
+
'address_street1' => null,
|
41 |
+
'address_city' => null,
|
42 |
+
'address_country_id' => null,
|
43 |
+
'address_region_id' => null,
|
44 |
+
'address_region_code' => null,
|
45 |
+
'address_postcode' => null,
|
46 |
+
'address_telephone' => null,
|
47 |
+
'address_fax' => null,
|
48 |
+
'address_vat_id' => null
|
49 |
+
);
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
*
|
54 |
+
* Enter description here ...
|
55 |
+
*/
|
56 |
+
protected function _getWhitePagesApi()
|
57 |
+
{
|
58 |
+
return Mage::getModel('whitePages/api');
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
*
|
63 |
+
* Enter description here ...
|
64 |
+
* @param unknown_type $data
|
65 |
+
* @param unknown_type $type
|
66 |
+
*/
|
67 |
+
public function getAutocompleteResults($data,$type)
|
68 |
+
{
|
69 |
+
$resultsArray = array();
|
70 |
+
$this->_type = $type;
|
71 |
+
|
72 |
+
switch($this->_type)
|
73 |
+
{
|
74 |
+
case "phone":
|
75 |
+
$resultsArray = $this->getReversePhoneResults($data['reverse_phone']);
|
76 |
+
break;
|
77 |
+
//TODO: Remove no function written yet
|
78 |
+
/*case "people":
|
79 |
+
$resultsArray = $this->getFindPeopleResults($data);
|
80 |
+
break;*/
|
81 |
+
case "business":
|
82 |
+
$resultsArray = $this->getFindBusiness($data['find_business_name'],$data['find_business_location']);
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
|
86 |
+
return $resultsArray;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
*
|
91 |
+
* Enter description here ...
|
92 |
+
* @param unknown_type $phoneNumber
|
93 |
+
*/
|
94 |
+
public function getFindBusiness($businessName, $businessLocation)
|
95 |
+
{
|
96 |
+
$whitePagesApi = $this->_getWhitePagesApi();
|
97 |
+
$whitePagesApi->setRequestQuery(array('keywords'=>$businessName, 'location'=>$businessLocation));
|
98 |
+
$apiResults = $whitePagesApi->getFindBusiness();
|
99 |
+
|
100 |
+
$formatAutocompleteResults = array();
|
101 |
+
|
102 |
+
if(isset($apiResults['listings']))
|
103 |
+
{
|
104 |
+
foreach ($apiResults['listings'] as $apiResultListings)
|
105 |
+
{
|
106 |
+
$formatAutocompleteResults[] = $this->_setFormatAutocompleteResults($apiResultListings);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
return $formatAutocompleteResults;
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
/**
|
115 |
+
*
|
116 |
+
* Enter description here ...
|
117 |
+
* @param unknown_type $phoneNumber
|
118 |
+
*/
|
119 |
+
public function getReversePhoneResults($phoneNumber)
|
120 |
+
{
|
121 |
+
$whitePagesApi = $this->_getWhitePagesApi();
|
122 |
+
$whitePagesApi->setRequestQuery(array('phone'=>$phoneNumber));
|
123 |
+
$apiResults = $whitePagesApi->getReversePhone();
|
124 |
+
|
125 |
+
|
126 |
+
$formatAutocompleteResults = array();
|
127 |
+
|
128 |
+
foreach ($apiResults['listings'] as $apiResultListings)
|
129 |
+
{
|
130 |
+
$formatAutocompleteResults[] = $this->_setFormatAutocompleteResults($apiResultListings);
|
131 |
+
|
132 |
+
}
|
133 |
+
return $formatAutocompleteResults;
|
134 |
+
}
|
135 |
+
|
136 |
+
protected function _setFormatAutocompleteResults($apiResultListings)
|
137 |
+
{
|
138 |
+
$formattedResults = $this->_formattedResults;
|
139 |
+
$resultKey = $this->_type;
|
140 |
+
|
141 |
+
if($resultKey != 'business')
|
142 |
+
{
|
143 |
+
$resultKey = 'people';
|
144 |
+
}
|
145 |
+
|
146 |
+
if($this->_type == 'business' && count($apiResultListings[$resultKey]) > 0 )
|
147 |
+
{
|
148 |
+
$formattedResults['displayname'] = (isset($apiResultListings['displayname'])?$apiResultListings['displayname']:'');
|
149 |
+
$formattedResults['address_company'] = (isset($apiResultListings['displayname'])?$apiResultListings['displayname']:'');
|
150 |
+
}
|
151 |
+
elseif( count($apiResultListings[$resultKey]) > 0 )
|
152 |
+
{
|
153 |
+
|
154 |
+
foreach ($apiResultListings[$resultKey] as $people)
|
155 |
+
{
|
156 |
+
if($people['rank'] == 'primary')
|
157 |
+
{
|
158 |
+
$formattedResults['displayname'] = (isset($apiResultListings['displayname'])?$apiResultListings['displayname']:'');
|
159 |
+
$formattedResults['address_prefix'] = (isset($people['prefix'])?$people['prefix']:'');
|
160 |
+
$formattedResults['address_firstname'] = (isset($people['firstname'])?$people['firstname']:'');
|
161 |
+
$formattedResults['address_middlename'] = (isset($people['middlename'])?$people['middlename']:'');
|
162 |
+
$formattedResults['address_lastname'] = (isset($people['lastname'])?$people['lastname']:'');
|
163 |
+
$formattedResults['address_suffix'] = (isset($people['suffix'])?$people['suffix']:'');
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
foreach($apiResultListings['phonenumbers'] as $phone)
|
169 |
+
{
|
170 |
+
if($phone['rank'] == 'primary')
|
171 |
+
{
|
172 |
+
$formattedResults['address_telephone'] = $phone['fullphone'];
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
$formattedResults['address_street0'] = (isset($apiResultListings['address']['fullstreet'])?$apiResultListings['address']['fullstreet']:'');
|
177 |
+
$formattedResults['address_city'] = (isset($apiResultListings['address']['city'])?$apiResultListings['address']['city']:'');
|
178 |
+
$formattedResults['address_country_id'] = (isset($apiResultListings['address']['country'])?$apiResultListings['address']['country']:'');
|
179 |
+
$formattedResults['address_region_id'] = Mage::getModel('directory/region')->loadByCode( $apiResultListings['address']['state'], $apiResultListings['address']['country'] )->getId();
|
180 |
+
$formattedResults['address_region_code'] = (isset($apiResultListings['address']['state'])?$apiResultListings['address']['state']:'');
|
181 |
+
$formattedResults['address_postcode'] = (isset($apiResultListings['address']['zip'])?$apiResultListings['address']['zip']:'');
|
182 |
+
|
183 |
+
return $formattedResults;
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
app/code/community/Wp/WhitePages/Model/MatchScore.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_MatchScore extends Mage_Core_Model_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('whitePages/matchScore');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getTransactionDetails()
|
36 |
+
{
|
37 |
+
$result = $this->getResultsArray();
|
38 |
+
$transactionId = $result['transaction_id'];
|
39 |
+
|
40 |
+
return array( 'transaction_id' => $transactionId);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
*
|
45 |
+
* Retrieves the results from current loaded object
|
46 |
+
*
|
47 |
+
* @return Array of the MatchScore details values
|
48 |
+
*/
|
49 |
+
public function getDetailedMatchScore()
|
50 |
+
{
|
51 |
+
$result = $this->getResultsArray();
|
52 |
+
|
53 |
+
//Messages are not always availible so set them that way
|
54 |
+
$billingPhoneNameMessages = ( isset( $result['score_vector']['billing_phone_name']['messages'] ) ? $result['score_vector']['billing_phone_name']['messages'] : null );
|
55 |
+
$billingAddressNameMessages = ( isset( $result['score_vector']['billing_address_name']['messages'] ) ? $result['score_vector']['billing_address_name']['messages'] : null );
|
56 |
+
$billingDeliverableMessages = ( isset( $result['score_vector']['billing_address_deliverable']['messages'] ) ? $result['score_vector']['billing_address_deliverable']['messages'] : null );
|
57 |
+
$billingFamilyMessages = ( isset( $result['score_vector']['billing_address_family_count']['meta']['messages'] ) ? $result['score_vector']['billing_address_family_count']['meta']['messages'] : null );
|
58 |
+
$billingSpamMessages = ( isset( $result['score_vector']['billing_phone_spam_score']['messages'] ) ? $result['score_vector']['billing_phone_spam_score']['messages'] : null );
|
59 |
+
$billingPhoneTypeMessages = ( isset( $result['score_vector']['billing_phone_type']['messages'] ) ? $result['score_vector']['billing_phone_type']['messages'] : null );
|
60 |
+
|
61 |
+
$shippingPhoneNameMessages = ( isset( $result['score_vector']['shipping_phone_name']['messages'] ) ? $result['score_vector']['shipping_phone_name']['messages'] : null );
|
62 |
+
$shippingAddressNameMessages = ( isset( $result['score_vector']['shipping_address_name']['messages'] ) ? $result['score_vector']['shipping_address_name']['messages'] : null );
|
63 |
+
$shippingDeliverableMessages = ( isset( $result['score_vector']['shipping_address_deliverable']['messages'] ) ? $result['score_vector']['shipping_address_deliverable']['messages'] : null );
|
64 |
+
$shippingFamilyMessages = ( isset( $result['score_vector']['shipping_address_family_count']['meta']['messages'] ) ? $result['score_vector']['shipping_address_family_count']['meta']['messages'] : null );
|
65 |
+
$shippingSpamMessages = ( isset( $result['score_vector']['shipping_phone_spam_score']['messages'] ) ? $result['score_vector']['shipping_phone_spam_score']['messages'] : null );
|
66 |
+
$shippingPhoneTypeMessages = ( isset( $result['score_vector']['shipping_phone_type']['messages'] ) ? $result['score_vector']['shipping_phone_type']['messages'] : null );
|
67 |
+
|
68 |
+
$detailedMatchScoreArray = array(
|
69 |
+
'billing' => array(
|
70 |
+
'phone_name' => array(
|
71 |
+
'grade' => $result['score_vector']['billing_phone_name']['grade'],
|
72 |
+
'messages' => $billingPhoneNameMessages),
|
73 |
+
'address_name' => array(
|
74 |
+
'grade' => $result['score_vector']['billing_address_name']['grade'],
|
75 |
+
'messages' => $billingAddressNameMessages),
|
76 |
+
'deliverable' => array(
|
77 |
+
'grade' => $result['score_vector']['billing_address_deliverable']['grade'],
|
78 |
+
'messages' => $billingDeliverableMessages),
|
79 |
+
'family' => array(
|
80 |
+
'names' => $result['score_vector']['billing_address_family_count']['meta']['name_frequencies'],
|
81 |
+
'messages' => $billingFamilyMessages),
|
82 |
+
/*'spam' => array(
|
83 |
+
'grade' => $result['score_vector']['billing_phone_spam_score']['grade'],
|
84 |
+
'messages' => $billingSpamMessages),*/
|
85 |
+
'phone_type' => array(
|
86 |
+
'grade' => $result['score_vector']['billing_phone_type']['grade'],
|
87 |
+
'messages' => $billingPhoneTypeMessages)
|
88 |
+
|
89 |
+
),
|
90 |
+
'shipping' => array(
|
91 |
+
'phone_name' => array(
|
92 |
+
'grade' => $result['score_vector']['shipping_phone_name']['grade'],
|
93 |
+
'messages' => $shippingPhoneNameMessages),
|
94 |
+
'address_name' => array(
|
95 |
+
'grade' => $result['score_vector']['shipping_address_name']['grade'],
|
96 |
+
'messages' => $shippingAddressNameMessages),
|
97 |
+
'deliverable' => array(
|
98 |
+
'grade' => $result['score_vector']['shipping_address_deliverable']['grade'],
|
99 |
+
'messages' => $shippingDeliverableMessages),
|
100 |
+
'family' => array(
|
101 |
+
'names' => $result['score_vector']['shipping_address_family_count']['meta']['name_frequencies'],
|
102 |
+
'messages' => $shippingFamilyMessages),
|
103 |
+
/*'spam' => array(
|
104 |
+
'grade' => $result['score_vector']['shipping_phone_spam_score']['grade'],
|
105 |
+
'messages' => $shippingSpamMessages),*/
|
106 |
+
'phone_type' => array(
|
107 |
+
'grade' => $result['score_vector']['shipping_phone_type']['grade'],
|
108 |
+
'messages' => $shippingPhoneTypeMessages)
|
109 |
+
),
|
110 |
+
);
|
111 |
+
|
112 |
+
return $detailedMatchScoreArray; //array($detailedMatchScoreArray, $result);//
|
113 |
+
}
|
114 |
+
|
115 |
+
public function setResults($results)
|
116 |
+
{
|
117 |
+
$this->setScore($results["score"]["score"]);
|
118 |
+
$this->setGrade($results["score"]["grade"]);
|
119 |
+
$jsonResults = json_encode($results);
|
120 |
+
$this->setResult($jsonResults);
|
121 |
+
$this->setIsMarkedAsFraud($results["meta"]["is_marked_as_fraud"]);
|
122 |
+
}
|
123 |
+
|
124 |
+
public function getMatchScoreByOrderId($orderId)
|
125 |
+
{
|
126 |
+
return $this->getCollection()->addFieldToFilter('order_id', $orderId)->getFirstItem();
|
127 |
+
}
|
128 |
+
|
129 |
+
public function getResultsArray()
|
130 |
+
{
|
131 |
+
return json_decode($this->getResult() ,true);
|
132 |
+
}
|
133 |
+
}
|
app/code/community/Wp/WhitePages/Model/Mysql4/MatchScore.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_Mysql4_MatchScore extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
$this->_init('whitePages/matchScore', 'id');
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/Wp/WhitePages/Model/Mysql4/MatchScore/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_Mysql4_MatchScore_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('whitePages/matchScore');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Wp/WhitePages/Model/Observer.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_Observer
|
28 |
+
{
|
29 |
+
|
30 |
+
public function getOrderMatchScore($observer)
|
31 |
+
{
|
32 |
+
// Set the order Obj
|
33 |
+
$order = $observer['order'];
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
// Get the order address
|
38 |
+
$addressCollection = $order->getAddressesCollection();
|
39 |
+
|
40 |
+
// Address Array
|
41 |
+
$addressArray = array();
|
42 |
+
|
43 |
+
//Loop all address and set the data
|
44 |
+
foreach ($addressCollection as $address)
|
45 |
+
{
|
46 |
+
//Make sure we have a customer name to check
|
47 |
+
|
48 |
+
if(Mage::getSingleton( 'customer/session' )->isLoggedIn() == true)
|
49 |
+
{
|
50 |
+
$addressArray["name"] = $order->getCustomer()->getName();
|
51 |
+
}
|
52 |
+
elseif(strtolower($address->getAddressType()) == 'billing')
|
53 |
+
{
|
54 |
+
$addressArray["name"] = $address->getFirstname(). " ". $address->getLastname();
|
55 |
+
}
|
56 |
+
$addressArray[$address->getAddressType()."_phone"] = $address->getTelephone();
|
57 |
+
$addressArray[$address->getAddressType()."_phone_name"] = $address->getName();
|
58 |
+
$addressArray[$address->getAddressType()."_address_street"] = $address->getData('street');
|
59 |
+
$addressArray[$address->getAddressType()."_address_city"] = $address->getCity();
|
60 |
+
$addressArray[$address->getAddressType()."_address_state"] = $address->getRegion();
|
61 |
+
$addressArray[$address->getAddressType()."_address_zip"] = $address->getPostcode();
|
62 |
+
}
|
63 |
+
|
64 |
+
// Connect to White Pages Api
|
65 |
+
$apiConnection = Mage::getModel('whitePages/api');
|
66 |
+
|
67 |
+
//Magento logging
|
68 |
+
$isLogsActive = Mage::getStoreConfig('dev/log/active');
|
69 |
+
if($isLogsActive)
|
70 |
+
{
|
71 |
+
$apiConnection->wpDebug("Order ID: ".$order->getIncrementId());
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
$apiConnection->setRequestQuery($addressArray);
|
76 |
+
$matchScoreResults = $apiConnection->getMatchScore();
|
77 |
+
|
78 |
+
//TODO: Add the correct messaging
|
79 |
+
$isScoreDeclined = Mage::helper('whitePages')->isScoreDeclined($matchScoreResults["score"]["grade"]);
|
80 |
+
|
81 |
+
if($isScoreDeclined == true)
|
82 |
+
{
|
83 |
+
Mage::throwException(Mage::getStoreConfig('whitePages_configuration/match_score/message'));
|
84 |
+
}
|
85 |
+
|
86 |
+
// Make sure there is data to set or do nothing
|
87 |
+
if($apiConnection->getErrors() === false)
|
88 |
+
{
|
89 |
+
//Save MatchScore results and quote id
|
90 |
+
$matchScore = Mage::getModel('whitePages/matchScore');
|
91 |
+
$matchScore->setResults($matchScoreResults);
|
92 |
+
$matchScore->setQuoteId($order->getQuote()->getId());
|
93 |
+
$matchScore->save();
|
94 |
+
|
95 |
+
//Set the MatchScore id
|
96 |
+
$order->setMatchScoreId($matchScore->getId());
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
public function setOrderMatchScore($observer)
|
101 |
+
{
|
102 |
+
$order = $observer['order'];
|
103 |
+
$matchScoreId = $order->getMatchScoreId();
|
104 |
+
|
105 |
+
//Make sure there is a MatchScore to update
|
106 |
+
if($matchScoreId)
|
107 |
+
{
|
108 |
+
//Load MatchScore and set the order id to it
|
109 |
+
$matchScore = Mage::getModel('whitePages/matchScore')->load($matchScoreId);
|
110 |
+
$matchScore->setOrderId($order->getId());
|
111 |
+
$matchScore->save();
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
public function orderGridAddMatchScore($observer)
|
116 |
+
{
|
117 |
+
$block = $observer->getBlock();
|
118 |
+
if (!isset($block)) {
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
|
122 |
+
if($block->getId() == 'sales_order_grid')
|
123 |
+
{
|
124 |
+
$block->addColumnAfter('match_score', array(
|
125 |
+
'header' => 'MatchScore',
|
126 |
+
'index' => 'match_score',
|
127 |
+
'align' => 'center',
|
128 |
+
'width' => '75',
|
129 |
+
'renderer' => 'Wp_WhitePages_Block_Adminhtml_Sales_Order_Grid_Renderer_MatchScore',
|
130 |
+
'filter_index' => Mage::helper('whitePages')->getMatchScoreExpression('match_score'),
|
131 |
+
'type' => 'options',
|
132 |
+
'options' => Mage::helper('whitePages')->getMatchScoreOptions()
|
133 |
+
),
|
134 |
+
'grand_total');
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
public function orderGridFilterCiollection($observer)
|
139 |
+
{
|
140 |
+
$block = $observer->getBlock();
|
141 |
+
if (!isset($block)) {
|
142 |
+
return $this;
|
143 |
+
}
|
144 |
+
|
145 |
+
if($block->getId() == 'sales_order_grid')
|
146 |
+
{
|
147 |
+
$collection = $block->getCollection();
|
148 |
+
$block->getCollection()->addFieldToSelect('match_score');
|
149 |
+
$collection->getSelect()->columns(array(
|
150 |
+
'match_score' => Mage::helper('whitePages')->getMatchScoreExpression('match_score'),
|
151 |
+
));
|
152 |
+
|
153 |
+
$block->setCollection($collection);
|
154 |
+
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
app/code/community/Wp/WhitePages/Model/System/Config/Source/MatchScore.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Model_System_Config_Source_MatchScore
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Options getter
|
32 |
+
*
|
33 |
+
* @return array
|
34 |
+
*/
|
35 |
+
public function toOptionArray()
|
36 |
+
{
|
37 |
+
return (array(0=>Mage::helper('adminhtml')->__('Accept All Orders')) + Mage::helper('whitePages')->getMatchScoreOptions() );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get options in "key-value" format
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function toArray()
|
46 |
+
{
|
47 |
+
return $this->toOptionArray();
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Wp/WhitePages/controllers/Adminhtml/IndexController.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
*
|
31 |
+
* Loads the layout for the controller action and sets it to this.
|
32 |
+
*
|
33 |
+
* @return this class obj
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
protected function _initAction()
|
37 |
+
{
|
38 |
+
$this->loadLayout();
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* @return the test message from WhitePages API
|
45 |
+
*
|
46 |
+
*/
|
47 |
+
public function testkeyAction()
|
48 |
+
{
|
49 |
+
echo $this->getWhitePagesApi()->testKey();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
*
|
54 |
+
* @return the view results of the autocomplete request
|
55 |
+
*
|
56 |
+
*/
|
57 |
+
public function autocompleteAction()
|
58 |
+
{
|
59 |
+
//TODO: Validate logged in or not
|
60 |
+
|
61 |
+
$controller = $this;
|
62 |
+
|
63 |
+
$update = $controller->getLayout()->getUpdate();
|
64 |
+
$update->addHandle('WHITEPAGES_AUTOCOMPLETE_AJAX');
|
65 |
+
$controller->loadLayoutUpdates()->generateLayoutXml()->generateLayoutBlocks();
|
66 |
+
$controller->renderLayout();
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
*
|
72 |
+
* @return the WhitePages API model
|
73 |
+
*
|
74 |
+
*/
|
75 |
+
protected function getWhitePagesApi()
|
76 |
+
{
|
77 |
+
return Mage::getModel('whitePages/api');
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Wp/WhitePages/controllers/IndexController.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Wp_WhitePages_IndexController extends Mage_Core_Controller_Front_Action
|
28 |
+
{
|
29 |
+
protected function _initAction() {
|
30 |
+
$this->loadLayout();
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function indexAction() {
|
35 |
+
|
36 |
+
$this->_initAction();
|
37 |
+
$this->renderLayout();
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Wp/WhitePages/etc/config.xml
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Wp_WhitePages>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Wp_WhitePages>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<whitePages>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Wp_WhitePages</module>
|
14 |
+
<frontName>wp</frontName>
|
15 |
+
</args>
|
16 |
+
</whitePages>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<whitePages>
|
21 |
+
<file>whitePages.xml</file>
|
22 |
+
</whitePages>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
<translate>
|
26 |
+
<modules>
|
27 |
+
<Wp_WhitePages>
|
28 |
+
<files>
|
29 |
+
<default>Wp_WhitePages.csv</default>
|
30 |
+
</files>
|
31 |
+
</Wp_WhitePages>
|
32 |
+
</modules>
|
33 |
+
</translate>
|
34 |
+
</frontend>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<wp>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Wp_WhitePages</module>
|
41 |
+
<frontName>wp</frontName>
|
42 |
+
</args>
|
43 |
+
</wp>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<translate>
|
48 |
+
<modules>
|
49 |
+
<Wp_WhitePages>
|
50 |
+
<files>
|
51 |
+
<default>Wp_WhitePages.csv</default>
|
52 |
+
</files>
|
53 |
+
</Wp_WhitePages>
|
54 |
+
</modules>
|
55 |
+
</translate>
|
56 |
+
<menu>
|
57 |
+
<system translate="title" module="adminhtml"/>
|
58 |
+
</menu>
|
59 |
+
<acl>
|
60 |
+
<resources>
|
61 |
+
<all>
|
62 |
+
<title>Allow Everything</title>
|
63 |
+
</all>
|
64 |
+
<admin>
|
65 |
+
<children>
|
66 |
+
<system>
|
67 |
+
<children>
|
68 |
+
<config>
|
69 |
+
<children>
|
70 |
+
<whitePages_configuration>
|
71 |
+
<title>White Pages</title>
|
72 |
+
</whitePages_configuration>
|
73 |
+
</children>
|
74 |
+
</config>
|
75 |
+
</children>
|
76 |
+
</system>
|
77 |
+
</children>
|
78 |
+
</admin>
|
79 |
+
</resources>
|
80 |
+
</acl>
|
81 |
+
<layout>
|
82 |
+
<updates>
|
83 |
+
<whitePages>
|
84 |
+
<file>whitePages.xml</file>
|
85 |
+
</whitePages>
|
86 |
+
</updates>
|
87 |
+
</layout>
|
88 |
+
</adminhtml>
|
89 |
+
<global>
|
90 |
+
<models>
|
91 |
+
<whitePages>
|
92 |
+
<class>Wp_WhitePages_Model</class>
|
93 |
+
<resourceModel>whitePages_mysql4</resourceModel>
|
94 |
+
</whitePages>
|
95 |
+
<whitePages_mysql4>
|
96 |
+
<class>Wp_WhitePages_Model_Mysql4</class>
|
97 |
+
<entities>
|
98 |
+
<matchScore>
|
99 |
+
<table>wp_match_score</table>
|
100 |
+
</matchScore>
|
101 |
+
</entities>
|
102 |
+
</whitePages_mysql4>
|
103 |
+
</models>
|
104 |
+
<resources>
|
105 |
+
<whitePages_setup>
|
106 |
+
<setup>
|
107 |
+
<module>Wp_WhitePages</module>
|
108 |
+
</setup>
|
109 |
+
<connection>
|
110 |
+
<use>core_setup</use>
|
111 |
+
</connection>
|
112 |
+
</whitePages_setup>
|
113 |
+
<whitePages_write>
|
114 |
+
<connection>
|
115 |
+
<use>core_write</use>
|
116 |
+
</connection>
|
117 |
+
</whitePages_write>
|
118 |
+
<whitePages_read>
|
119 |
+
<connection>
|
120 |
+
<use>core_read</use>
|
121 |
+
</connection>
|
122 |
+
</whitePages_read>
|
123 |
+
</resources>
|
124 |
+
<blocks>
|
125 |
+
<whitePages>
|
126 |
+
<class>Wp_WhitePages_Block</class>
|
127 |
+
</whitePages>
|
128 |
+
</blocks>
|
129 |
+
<helpers>
|
130 |
+
<whitePages>
|
131 |
+
<class>Wp_WhitePages_Helper</class>
|
132 |
+
</whitePages>
|
133 |
+
</helpers>
|
134 |
+
<events>
|
135 |
+
<sales_order_place_before>
|
136 |
+
<observers>
|
137 |
+
<get_order_match_score>
|
138 |
+
<type>singleton</type>
|
139 |
+
<class>Wp_WhitePages_Model_Observer</class>
|
140 |
+
<method>getOrderMatchScore</method>
|
141 |
+
</get_order_match_score>
|
142 |
+
</observers>
|
143 |
+
</sales_order_place_before>
|
144 |
+
<sales_order_save_commit_after>
|
145 |
+
<observers>
|
146 |
+
<set_order_item_cost>
|
147 |
+
<type>singleton</type>
|
148 |
+
<class>Wp_WhitePages_Model_Observer</class>
|
149 |
+
<method>setOrderMatchScore</method>
|
150 |
+
</set_order_item_cost>
|
151 |
+
</observers>
|
152 |
+
</sales_order_save_commit_after>
|
153 |
+
<core_block_abstract_prepare_layout_before>
|
154 |
+
<observers>
|
155 |
+
<customgrid_column_append>
|
156 |
+
<type>model</type>
|
157 |
+
<class>Wp_WhitePages_Model_Observer</class>
|
158 |
+
<method>orderGridAddMatchScore</method>
|
159 |
+
</customgrid_column_append>
|
160 |
+
</observers>
|
161 |
+
</core_block_abstract_prepare_layout_before>
|
162 |
+
<adminhtml_block_html_before>
|
163 |
+
<observers>
|
164 |
+
<customgrid_column_append>
|
165 |
+
<type>model</type>
|
166 |
+
<class>Wp_WhitePages_Model_Observer</class>
|
167 |
+
<method>orderGridFilterCiollection</method>
|
168 |
+
</customgrid_column_append>
|
169 |
+
</observers>
|
170 |
+
</adminhtml_block_html_before>
|
171 |
+
</events>
|
172 |
+
</global>
|
173 |
+
<default>
|
174 |
+
<whitePages_configuration>
|
175 |
+
<match_score>
|
176 |
+
<decline>0</decline>
|
177 |
+
<message>Your order has been declined because of an issue with your billing or shipping information. Please contact us to complete your order.</message>
|
178 |
+
</match_score>
|
179 |
+
<reverse_lookup>
|
180 |
+
<enabled>1</enabled>
|
181 |
+
</reverse_lookup>
|
182 |
+
</whitePages_configuration>
|
183 |
+
</default>
|
184 |
+
</config>
|
app/code/community/Wp/WhitePages/etc/system.xml
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<wp translate="label" module="whitePages">
|
5 |
+
<label>WhitePages PRO</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</wp>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<whitePages_configuration translate="label" module="whitePages">
|
11 |
+
<label>WhitePages PRO</label>
|
12 |
+
<tab>wp</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<options translate="label">
|
20 |
+
<label>Options</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<api_key>
|
28 |
+
<label>API Key</label>
|
29 |
+
<frontend_type>obscure</frontend_type>
|
30 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<comment>You must save this Magento configuration before validating your API Key</comment>
|
36 |
+
</api_key>
|
37 |
+
<api_url>
|
38 |
+
<label></label>
|
39 |
+
<frontend_class>complex</frontend_class>
|
40 |
+
<frontend_model>whitePages/adminhtml_system_config_options_button</frontend_model>
|
41 |
+
<sort_order>5</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<comment><![CDATA[Click <a target="_blank" href="http://pro.whitepages.com/magento">here</a> to obtain your own API Key.]]></comment>
|
46 |
+
</api_url>
|
47 |
+
</fields>
|
48 |
+
</options>
|
49 |
+
<match_score>
|
50 |
+
<label>MatchScore</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>20</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
<fields>
|
57 |
+
<decline>
|
58 |
+
<label>Decline Orders with Scores Below</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>whitePages/system_config_source_matchScore</source_model>
|
61 |
+
<sort_order>10</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
<comment>Setting this value to anything but 'Accept All Orders" will cause orders for customers to be declined.</comment>
|
66 |
+
</decline>
|
67 |
+
<message>
|
68 |
+
<label>Decline Message</label>
|
69 |
+
<frontend_type>textarea</frontend_type>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</message>
|
75 |
+
</fields>
|
76 |
+
</match_score>
|
77 |
+
<reverse_lookup>
|
78 |
+
<label>Customer Look Up</label>
|
79 |
+
<frontend_type>text</frontend_type>
|
80 |
+
<sort_order>30</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<fields>
|
85 |
+
<enabled>
|
86 |
+
<label>Enabled</label>
|
87 |
+
<frontend_type>select</frontend_type>
|
88 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
89 |
+
<sort_order>25</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</enabled>
|
94 |
+
</fields>
|
95 |
+
</reverse_lookup>
|
96 |
+
</groups>
|
97 |
+
</whitePages_configuration>
|
98 |
+
</sections>
|
99 |
+
</config>
|
app/code/community/Wp/WhitePages/sql/whitePages_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
$installer = $this;
|
28 |
+
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
$installer->run("CREATE TABLE {$this->getTable('wp_match_score')} (
|
32 |
+
id int(11) NOT NULL AUTO_INCREMENT,
|
33 |
+
order_id int(11) DEFAULT NULL,
|
34 |
+
quote_id int(11) DEFAULT NULL,
|
35 |
+
grade varchar(25) DEFAULT NULL,
|
36 |
+
score decimal(10,9) DEFAULT NULL,
|
37 |
+
result text,
|
38 |
+
is_marked_as_fraud tinyint(1) DEFAULT NULL,
|
39 |
+
PRIMARY KEY (id)
|
40 |
+
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;");
|
41 |
+
|
42 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/whitePages.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.0.1">
|
3 |
+
|
4 |
+
<WHITEPAGES_AUTOCOMPLETE_AJAX>
|
5 |
+
<block type="whitePages/adminhtml_sales_order_create_form_account_autocomplete" template="whitepages/order/create/form/account/autocomplete/results.phtml" name="autocomplete_results" output="toHtml" />
|
6 |
+
</WHITEPAGES_AUTOCOMPLETE_AJAX>
|
7 |
+
|
8 |
+
<!-- Sales views and over rides below -->
|
9 |
+
<adminhtml_sales_order_index>
|
10 |
+
<reference name="head">
|
11 |
+
<action method="addCss"><name>whitepages.css</name></action>
|
12 |
+
</reference>
|
13 |
+
</adminhtml_sales_order_index>
|
14 |
+
<adminhtml_sales_order_view>
|
15 |
+
<reference name="head">
|
16 |
+
<action method="addCss"><name>whitepages.css</name></action>
|
17 |
+
</reference>
|
18 |
+
<reference name="sales_order_tabs">
|
19 |
+
<action method="addTab">
|
20 |
+
<name>order_matchscore</name>
|
21 |
+
<block>whitePages/adminhtml_sales_order_tab_matchScore</block>
|
22 |
+
</action>
|
23 |
+
</reference>
|
24 |
+
</adminhtml_sales_order_view>
|
25 |
+
|
26 |
+
<adminhtml_sales_order_create_index>
|
27 |
+
<reference name="head">
|
28 |
+
<action method="addJs"><file>whitepages/autocompleteaddress.js</file></action>
|
29 |
+
<action method="addCss"><name>whitepages.css</name></action>
|
30 |
+
</reference>
|
31 |
+
|
32 |
+
<reference name="content">
|
33 |
+
<reference name="data">
|
34 |
+
<block type="adminhtml/sales_order_create_form_account" template="whitepages/order/create/form/account.phtml" name="form_account">
|
35 |
+
<block type="whitePages/adminhtml_sales_order_create_form_account_autocomplete" template="whitepages/order/create/form/account/autocomplete.phtml" name="form_account_autocomplete" />
|
36 |
+
</block>
|
37 |
+
</reference>
|
38 |
+
</reference>
|
39 |
+
</adminhtml_sales_order_create_index>
|
40 |
+
<adminhtml_sales_order_create_load_block_data>
|
41 |
+
<reference name="content">
|
42 |
+
<reference name="data">
|
43 |
+
<block type="adminhtml/sales_order_create_form_account" template="whitepages/order/create/form/account.phtml" name="form_account">
|
44 |
+
<block type="whitePages/adminhtml_sales_order_create_form_account_autocomplete" template="whitepages/order/create/form/account/autocomplete.phtml" name="form_account_autocomplete" />
|
45 |
+
</block>
|
46 |
+
</reference>
|
47 |
+
</reference>
|
48 |
+
</adminhtml_sales_order_create_load_block_data>
|
49 |
+
</layout>
|
app/design/adminhtml/default/default/template/whitepages/order/create/form/account.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="entry-edit">
|
28 |
+
<div class="entry-edit-head">
|
29 |
+
<h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>
|
30 |
+
</div>
|
31 |
+
<div id="customer_account_fieds">
|
32 |
+
<?php echo $this->getForm()->getHtml() ?>
|
33 |
+
</div>
|
34 |
+
<script type="text/javascript">order.accountFieldsBind($('customer_account_fieds'))</script>
|
35 |
+
</div>
|
36 |
+
<?php if(Mage::getStoreConfig('whitePages_configuration/reverse_lookup/enabled') == true):?>
|
37 |
+
<?php echo $this->getChildHtml()?>
|
38 |
+
<?php endif;?>
|
app/design/adminhtml/default/default/template/whitepages/order/create/form/account/autocomplete.phtml
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="entry-edit">
|
28 |
+
<div class="entry-edit-head">
|
29 |
+
<h4 class="icon-head fieldset-legend" ><?php echo $this->__('WhitePages PRO Customer Look Up')?></h4>
|
30 |
+
</div>
|
31 |
+
<div id="whitepages_autocomplete_fields">
|
32 |
+
<fieldset>
|
33 |
+
<div class="hor-scroll form-list">
|
34 |
+
<input type="hidden" id="autocomplete_action" value="<?php echo $this->getUrl('whitePages/adminhtml_index/autocomplete').'&isAjax=true'?>" />
|
35 |
+
<table cellspacing="0" class="box-left" id="phone">
|
36 |
+
<tbody>
|
37 |
+
<tr>
|
38 |
+
<td class="label">
|
39 |
+
<label for="group_id">
|
40 |
+
<?php echo $this->__('Phone Number')?>
|
41 |
+
<span class="required">*</span>
|
42 |
+
</label>
|
43 |
+
</td>
|
44 |
+
<td class="value">
|
45 |
+
<input name="reverse_phone" id="phone_autocomplete" type="text"/>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
<tr>
|
49 |
+
<td class="label"></td>
|
50 |
+
<td class="value">
|
51 |
+
<button id="submit_reverse_phone" title="Submit" type="button" class="scalable disabled" onclick="autoCompleteAddress.showAutocompleteResults('phone')" style="">
|
52 |
+
<span>
|
53 |
+
<span>
|
54 |
+
<span><?php echo $this->__('Search Phone')?></span>
|
55 |
+
</span>
|
56 |
+
</span>
|
57 |
+
</button>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
</tbody>
|
61 |
+
<table cellspacing="0" class="box-right">
|
62 |
+
<tbody>
|
63 |
+
<tr>
|
64 |
+
<td class="label">
|
65 |
+
<label for="business_autocomplete_name">
|
66 |
+
<?php echo $this->__('Business Name')?>
|
67 |
+
<span class="required">*</span>
|
68 |
+
</label>
|
69 |
+
</td>
|
70 |
+
<td class="value">
|
71 |
+
<input name="find_business_name" id="business_autocomplete_name" type="text"/>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td class="label">
|
76 |
+
<label for="business_autocomplete_location">
|
77 |
+
<?php echo $this->__('Business Location')?>
|
78 |
+
<span class="required">*</span>
|
79 |
+
</label>
|
80 |
+
</td>
|
81 |
+
<td class="value">
|
82 |
+
<input name="find_business_location" id="business_autocomplete_location" type="text"/>
|
83 |
+
<p class="note"><span><?php echo $this->__('City, State or Zip')?></span></p>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
<tr>
|
87 |
+
<td class="label"></td>
|
88 |
+
<td class="value">
|
89 |
+
<button id="submit_find_business" title="Submit" type="button" class="scalable disabled" onclick="autoCompleteAddress.showAutocompleteResults('business')" style="">
|
90 |
+
<span>
|
91 |
+
<span>
|
92 |
+
<span><?php echo $this->__('Search Business')?></span>
|
93 |
+
</span>
|
94 |
+
</span>
|
95 |
+
</button>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
</tbody>
|
99 |
+
</table>
|
100 |
+
</fieldset>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
<div id="whitepages_autocomplete_fields_modal" class="whitepages-autocomplete-fields" style="display:none;">
|
105 |
+
<div id="search-results"></div>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
<script type="text/javascript">
|
111 |
+
//Incase this ia ajax load and there is new html to bind too.
|
112 |
+
var ajaxLoad = <?php echo ($this->getRequest()->getParam('isAjax') != null ? 'true' : 'false') ?>;
|
113 |
+
if( ajaxLoad == true )
|
114 |
+
{
|
115 |
+
autoCompleteAddress.initialize();
|
116 |
+
}
|
117 |
+
|
118 |
+
var _translateData = {
|
119 |
+
'Please enter a phone number.':
|
120 |
+
"<?php echo $this->__('Please enter a phone number.'); ?>",
|
121 |
+
'Please enter a valid business name and location.':
|
122 |
+
"<?php echo $this->__('Please enter a valid business name and location.');?>"
|
123 |
+
};
|
124 |
+
var Translator = new Translate(_translateData);
|
125 |
+
</script>
|
app/design/adminhtml/default/default/template/whitepages/order/create/form/account/autocomplete/results.phtml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
|
27 |
+
$results = $this->getAutoCompleteResults();
|
28 |
+
?>
|
29 |
+
<div class="entry-edit">
|
30 |
+
<div class="entry-edit-head">
|
31 |
+
<h4 class="icon-head fieldset-legend"><?php echo $this->__('Search Results')?></h4>
|
32 |
+
</div>
|
33 |
+
<div id="whitepages_autocomplete_messages" style="display: none;">
|
34 |
+
<ul class="messages"><li class="error-msg"></li></ul>
|
35 |
+
</div>
|
36 |
+
<div id="whitepages_autocomplete_results" class="content">
|
37 |
+
<?php if(count($results) > 0 ):?>
|
38 |
+
<h4><?php echo $this->__('Results (%s):', count($results) )?></h4>
|
39 |
+
<div class="grid">
|
40 |
+
<table class="data inline-table " style="border-spacing: 0px;">
|
41 |
+
<tbody>
|
42 |
+
<?php foreach ($results as $index => $result):?>
|
43 |
+
<tr id="whitepages_autocomplete_results_row_<? echo $index?>" class=" <?php echo ( $index % 2 == 0 ? 'even' : 'odd' )?>">
|
44 |
+
<td>
|
45 |
+
<ul>
|
46 |
+
<li>
|
47 |
+
<strong><?php echo $result['displayname']?></strong>
|
48 |
+
</li>
|
49 |
+
<li>
|
50 |
+
<?php echo $this->__('%s %s, %s %s', $result['address_street0'], $result['address_city'], $result['address_region_code'], $result['address_postcode'] )?>
|
51 |
+
</li>
|
52 |
+
<li>
|
53 |
+
<?php echo $result['address_telephone']?>
|
54 |
+
<?php foreach ($result as $key => $value):?>
|
55 |
+
<input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>" />
|
56 |
+
<?php endforeach;?>
|
57 |
+
</li>
|
58 |
+
</ul>
|
59 |
+
</td>
|
60 |
+
<td class="send-autocomplete">
|
61 |
+
<a href="javascript:void(0)" onclick="autoCompleteAddress.onSendLink(<? echo $index?>,'billing')"><?php echo $this->__('send to billing')?></a>
|
62 |
+
</td>
|
63 |
+
<td class="send-autocomplete">
|
64 |
+
<a href="javascript:void(0)" onclick="autoCompleteAddress.onSendLink(<? echo $index?>,'shipping')"><?php echo $this->__('send to shipping')?></a>
|
65 |
+
</td>
|
66 |
+
<td class="send-autocomplete">
|
67 |
+
<a href="javascript:void(0)" onclick="autoCompleteAddress.onSendLink(<? echo $index?>)"><?php echo $this->__('send to both')?></a>
|
68 |
+
</td>
|
69 |
+
</tr>
|
70 |
+
<?php endforeach;?>
|
71 |
+
</tbody>
|
72 |
+
</table>
|
73 |
+
</div>
|
74 |
+
<?php else:?>
|
75 |
+
<h4><?php echo $this->__('Your search returned zero results, please broaden your search.')?></h4>
|
76 |
+
<?php endif;?>
|
77 |
+
<div style="display:none"></div>
|
78 |
+
</div>
|
79 |
+
<div class="buttons-set a-left">
|
80 |
+
<button id="reset_order_top_button" title="<?php echo $this->__('Close') ?>" type="button" class="scalable cancel close" onclick="autoCompleteAddress.onCloseBtn()" style="">
|
81 |
+
<span>
|
82 |
+
<span>
|
83 |
+
<span><?php echo $this->__('Close') ?></span>
|
84 |
+
</span>
|
85 |
+
</span>
|
86 |
+
</button>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
|
app/design/adminhtml/default/default/template/whitepages/order/view/tab/matchscore.phtml
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Wp
|
4 |
+
* @package Wp_Whitepages
|
5 |
+
* @author WhitePages <support@whitepages.com>
|
6 |
+
* @copyright WhitePages Inc. (c) 2013
|
7 |
+
*
|
8 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
9 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
10 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
11 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
12 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
13 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
14 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
15 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
16 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
17 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
18 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
19 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
20 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
21 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
23 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $hasMatchScore = $this->hasMatchScore()?>
|
28 |
+
<div class="matchscore">
|
29 |
+
<?php if($hasMatchScore == true):?>
|
30 |
+
<?php $matchSCore = $this->getMatchScore()?>
|
31 |
+
<?php $detailedMatchScore = $this->getDetailedMatchScore()?>
|
32 |
+
<?php $transactionDetails = $this->getTransactionDetails()?>
|
33 |
+
<div class="entry-edit ">
|
34 |
+
<div class="entry-edit-head">
|
35 |
+
<h4 class="icon-head"><?php echo $this->__('Overall MatchScore')?></h4>
|
36 |
+
</div>
|
37 |
+
<fieldset >
|
38 |
+
<div>
|
39 |
+
<table cellspacing="2" class="box-left form-list">
|
40 |
+
<tbody>
|
41 |
+
<tr>
|
42 |
+
<td>
|
43 |
+
<strong>
|
44 |
+
<?php echo $this->__('MatchScore Grade')?>:
|
45 |
+
</strong>
|
46 |
+
</td>
|
47 |
+
<td>
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
<tr>
|
51 |
+
<td>
|
52 |
+
<table>
|
53 |
+
<tbody>
|
54 |
+
<tr>
|
55 |
+
<td class="overall-grade">
|
56 |
+
<div>
|
57 |
+
<span class="grade-<?php echo $matchSCore->getGrade() ?>" ><?php echo $matchSCore->getGrade() ?></span>
|
58 |
+
</div>
|
59 |
+
</td>
|
60 |
+
<td class="label"><strong><?php echo $this->__('MatchScore')?></strong></td>
|
61 |
+
<td class="value"><?php echo number_format($matchSCore->getScore(), 2) ?></td>
|
62 |
+
</tr>
|
63 |
+
</tbody>
|
64 |
+
</table>
|
65 |
+
</td>
|
66 |
+
<td class="wp-logo"> <img alt="<?php echo $this->__('WhitePages PRO') ?>" src="<?php echo $this->getSkinUrl('images/WPPRO-blue.png') ?>" /></td>
|
67 |
+
</tr>
|
68 |
+
</tbody>
|
69 |
+
</table>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
</fieldset>
|
73 |
+
</div>
|
74 |
+
<div class="entry-edit">
|
75 |
+
<div class="entry-edit-head">
|
76 |
+
<h4 class="icon-head"><?php echo $this->__('Match Details')?></h4>
|
77 |
+
</div>
|
78 |
+
<fieldset>
|
79 |
+
<div class="box-left">
|
80 |
+
<table cellspacing="2" class="data">
|
81 |
+
<tbody>
|
82 |
+
<tr>
|
83 |
+
<td style="width: 150px;"><strong><?php echo $this->__('Billing Info')?></strong></td>
|
84 |
+
<td style="width: 25px;"></td>
|
85 |
+
<td></td>
|
86 |
+
</tr>
|
87 |
+
<?php foreach ($detailedMatchScore['billing'] as $key => $value):?>
|
88 |
+
<?php if($key !='family'): //removing family temporarily until the data gets fixed in the WP API ?>
|
89 |
+
<tr>
|
90 |
+
<td><?php echo $this->getMatchScoreLabel($key)?></td>
|
91 |
+
<?php if($key =='family'):?>
|
92 |
+
<td><strong><?php echo count($value['names'])?></strong></td>
|
93 |
+
<td><?php echo (count($value['names']) > 1 ? " (". $this->getFamilyNames($value['names']). ")": '')?></td>
|
94 |
+
<?php else :?>
|
95 |
+
<td><strong class="grade-<?php echo $value['grade'] ?>"><?php echo $value['grade']?></strong></td>
|
96 |
+
<td><?php echo ($value['messages'] != null ? " (". implode(',', $value['messages']).")" : '')?></td>
|
97 |
+
<?php endif;?>
|
98 |
+
</tr>
|
99 |
+
<?php endif;?>
|
100 |
+
<?php endforeach;?>
|
101 |
+
<tr>
|
102 |
+
<td><br /></td>
|
103 |
+
<td> </td></tr>
|
104 |
+
<tr>
|
105 |
+
<td><strong><?php echo $this->__('Shipping Info')?></strong></td>
|
106 |
+
<td></td>
|
107 |
+
</tr>
|
108 |
+
<?php foreach ($detailedMatchScore['shipping'] as $key => $value):?>
|
109 |
+
|
110 |
+
<?php if($key !='family'): //removing family temporarily until the data gets fixed in the WP API ?>
|
111 |
+
<tr>
|
112 |
+
<td><?php echo $this->getMatchScoreLabel($key)?></td>
|
113 |
+
<?php if($key =='family'):?>
|
114 |
+
<td><strong><?php echo count($value['names'])?></strong></td>
|
115 |
+
<td><?php echo (count($value['names']) > 1 ? " (". $this->getFamilyNames($value['names']). ")": '')?></td>
|
116 |
+
<?php else :?>
|
117 |
+
<td><strong class="grade-<?php echo $value['grade'] ?>"><?php echo $value['grade']?></strong></td>
|
118 |
+
<td><?php echo ($value['messages'] != null ? " (". implode(',', $value['messages']).")" : '')?></td>
|
119 |
+
<?php endif;?>
|
120 |
+
</tr>
|
121 |
+
<?php endif;?>
|
122 |
+
<?php endforeach;?>
|
123 |
+
</tbody>
|
124 |
+
</table>
|
125 |
+
</div>
|
126 |
+
</fieldset>
|
127 |
+
</div>
|
128 |
+
<div class="entry-edit">
|
129 |
+
<div class="entry-edit-head">
|
130 |
+
<h4 class="icon-head"><?php echo $this->__('Transaction Details')?></h4>
|
131 |
+
</div>
|
132 |
+
<fieldset>
|
133 |
+
<div class="box-left">
|
134 |
+
<table cellspacing="2" class="data">
|
135 |
+
<tbody>
|
136 |
+
<tr>
|
137 |
+
<td style="width: 150px;"><?php echo $this->__('Transaction Id')?></td>
|
138 |
+
<td><?php echo $transactionDetails['transaction_id'] ?></td>
|
139 |
+
</tr>
|
140 |
+
</tbody>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
</fieldset>
|
144 |
+
</div>
|
145 |
+
<?php else:?>
|
146 |
+
<h1 class=""><?php echo $this->__('No MatchScore Available')?></h1>
|
147 |
+
<p><?php echo $this->__('This order was created prior to the WhitePages PRO module being installed.')?></p>
|
148 |
+
<?php endif;?>
|
149 |
+
</div>
|
app/etc/modules/Wp_WhitePages.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Wp_WhitePages>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Wp_WhitePages>
|
8 |
+
</modules>
|
9 |
+
</config>
|
js/whitepages/autocompleteaddress.js
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @category Wp
|
3 |
+
* @package Wp_Whitepages
|
4 |
+
* @author WhitePages <support@whitepages.com>
|
5 |
+
* @copyright WhitePages Inc. (c) 2013
|
6 |
+
*
|
7 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
8 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
9 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
10 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
11 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
12 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
13 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
14 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
15 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
16 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
17 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
18 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
19 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
20 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
22 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
23 |
+
*
|
24 |
+
*/
|
25 |
+
|
26 |
+
AutoCompleteAddress = Class.create();
|
27 |
+
AutoCompleteAddress.prototype = {
|
28 |
+
|
29 |
+
orderBillingAddressFields: null,
|
30 |
+
formAction: null,
|
31 |
+
searchFields: null,
|
32 |
+
blockResult: null,
|
33 |
+
blockWindow: null,
|
34 |
+
blockMask: null,
|
35 |
+
requestType: null,
|
36 |
+
windowHeight: null,
|
37 |
+
blockMsg: null,
|
38 |
+
blockMsgError: null,
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Initialize object
|
42 |
+
*/
|
43 |
+
initialize: function() {
|
44 |
+
this._initWindowElements();
|
45 |
+
},
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Initialize window elements
|
49 |
+
*/
|
50 |
+
_initWindowElements: function() {
|
51 |
+
|
52 |
+
this.orderShippingAddressFields = $('order-shipping_address_fields');
|
53 |
+
this.orderBillingAddressFields = $('order-billing_address_fields');
|
54 |
+
this.formAction = $('autocomplete_action');
|
55 |
+
this.searchFields = $('whitepages_autocomplete_fields');
|
56 |
+
this.blockWindow = $('whitepages_autocomplete_fields_modal');
|
57 |
+
this.blockResult = $('search-results');
|
58 |
+
this.blockMask = $('popup-window-mask');
|
59 |
+
this.windowHeight = $('html-body').getHeight();
|
60 |
+
this.blockMsg = $('product_composite_configure_messages');
|
61 |
+
this.blockMsgError = this.blockMsg.select('.error-msg')[0];
|
62 |
+
|
63 |
+
|
64 |
+
$('submit_find_business').removeClassName('disabled');
|
65 |
+
$('submit_reverse_phone').removeClassName('disabled');
|
66 |
+
|
67 |
+
},
|
68 |
+
/**
|
69 |
+
* Show configuration window
|
70 |
+
*/
|
71 |
+
_showWindow: function() {
|
72 |
+
this.blockMask.setStyle({'height':this.windowHeight+'px'}).show();
|
73 |
+
this.blockWindow.setStyle({'marginTop':-this.blockWindow.getHeight()/2 + "px", 'display':'block'});
|
74 |
+
},
|
75 |
+
/**
|
76 |
+
* Close results window
|
77 |
+
*/
|
78 |
+
_closeWindow: function() {
|
79 |
+
toggleSelectsUnderBlock(this.blockMask, true);
|
80 |
+
this.blockMask.style.display = 'none';
|
81 |
+
this.blockWindow.style.display = 'none';
|
82 |
+
},
|
83 |
+
/**
|
84 |
+
* Show and get it through ajax
|
85 |
+
*/
|
86 |
+
showAutocompleteResults: function(type) {
|
87 |
+
|
88 |
+
var errorMessage = this._validateInput(type);
|
89 |
+
|
90 |
+
if( errorMessage != null)
|
91 |
+
{
|
92 |
+
return alert(errorMessage);
|
93 |
+
}
|
94 |
+
this.requestType = type;
|
95 |
+
this._getAutoCompleteAddress(this._getRequestData());
|
96 |
+
},
|
97 |
+
/**
|
98 |
+
* Triggered on confirm button click
|
99 |
+
* Do submit configured data through iFrame if needed
|
100 |
+
*/
|
101 |
+
onSendLink: function(rowId,addressType) {
|
102 |
+
|
103 |
+
var sendLinkRow = $('whitepages_autocomplete_results_row_'+rowId);
|
104 |
+
var addressInputs = sendLinkRow.select('input[type="hidden"]');
|
105 |
+
var autoCompleteAddress = this;
|
106 |
+
var shippingAddressSelectOptions = $$('select#order-shipping_address_customer_address_id option');
|
107 |
+
var billingAddressSelectOptions = $$('select#order-billing_address_customer_address_id option');
|
108 |
+
|
109 |
+
//Set address id and unset same as billing
|
110 |
+
switch(addressType)
|
111 |
+
{
|
112 |
+
case 'billing':
|
113 |
+
billingAddressSelectOptions[0].selected = true;
|
114 |
+
break;
|
115 |
+
case 'shipping':
|
116 |
+
shippingAddressSelectOptions[0].selected = true;
|
117 |
+
break;
|
118 |
+
default:
|
119 |
+
billingAddressSelectOptions[0].selected = true;
|
120 |
+
shippingAddressSelectOptions[0].selected = true;
|
121 |
+
}
|
122 |
+
|
123 |
+
for (var i=0;i<addressInputs.length;i++)
|
124 |
+
{
|
125 |
+
if(addressType != undefined)
|
126 |
+
{
|
127 |
+
this._insertAddressField(addressInputs[i],addressType);
|
128 |
+
}
|
129 |
+
else
|
130 |
+
{
|
131 |
+
this._insertAddressField(addressInputs[i],'billing');
|
132 |
+
this._insertAddressField(addressInputs[i],'shipping');
|
133 |
+
}
|
134 |
+
};
|
135 |
+
|
136 |
+
order.setShippingAsBilling(false);
|
137 |
+
|
138 |
+
this._closeWindow();
|
139 |
+
|
140 |
+
return this;
|
141 |
+
},
|
142 |
+
/**
|
143 |
+
*
|
144 |
+
*/
|
145 |
+
_validateInput: function(addressType) {
|
146 |
+
|
147 |
+
var errorMessage = null;
|
148 |
+
|
149 |
+
if(addressType == 'phone')
|
150 |
+
{
|
151 |
+
var reversePhone = $('phone_autocomplete').value.trim();
|
152 |
+
if(reversePhone == '')
|
153 |
+
{
|
154 |
+
errorMessage = Translator.translate('Please enter a phone number.');
|
155 |
+
}
|
156 |
+
}
|
157 |
+
else
|
158 |
+
{
|
159 |
+
var findBusinessName = $('business_autocomplete_name').value.trim();
|
160 |
+
var findBusinessLocation = $('business_autocomplete_location').value.trim();
|
161 |
+
if( findBusinessName == '' || findBusinessLocation == '')
|
162 |
+
{
|
163 |
+
errorMessage = Translator.translate('Please enter a valid business name and location.');
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
return errorMessage;
|
169 |
+
},
|
170 |
+
/**
|
171 |
+
* Triggered on cancel button click
|
172 |
+
*/
|
173 |
+
onCloseBtn: function() {
|
174 |
+
this._closeWindow();
|
175 |
+
return this;
|
176 |
+
},
|
177 |
+
_getRequestData: function(){
|
178 |
+
var inputFields = this.searchFields.select('input[id^="'+this.requestType+'"]');
|
179 |
+
|
180 |
+
var data = new Object();
|
181 |
+
|
182 |
+
inputFields.each(function(elm) {
|
183 |
+
|
184 |
+
var elmName = elm.name;
|
185 |
+
var elmValue = elm.value;
|
186 |
+
|
187 |
+
data[elmName] = elmValue;
|
188 |
+
});
|
189 |
+
|
190 |
+
//Set type
|
191 |
+
data['type'] = this.requestType;
|
192 |
+
return Object.toJSON(data);
|
193 |
+
},
|
194 |
+
_insertAddressField: function(inputElm, addressType) {
|
195 |
+
|
196 |
+
var addressField = $('order-'+addressType+'_'+inputElm.name);
|
197 |
+
if(addressField != undefined)
|
198 |
+
{
|
199 |
+
addressField.value = inputElm.value;;
|
200 |
+
}
|
201 |
+
else if (addressField != null)
|
202 |
+
{
|
203 |
+
addressField.value = null;
|
204 |
+
}
|
205 |
+
|
206 |
+
},
|
207 |
+
_getAutoCompleteAddress: function(data) {
|
208 |
+
|
209 |
+
var action = this.formAction.value;
|
210 |
+
new Ajax.Request(action, {
|
211 |
+
parameters: data.evalJSON(),
|
212 |
+
onSuccess: function(transport) {
|
213 |
+
var response = transport.responseText;
|
214 |
+
if (response.isJSON()) {
|
215 |
+
response = response.evalJSON();
|
216 |
+
if (response.error)
|
217 |
+
{
|
218 |
+
|
219 |
+
this.blockMsg.show();
|
220 |
+
this.blockMsgError.innerHTML = response.message;
|
221 |
+
}
|
222 |
+
if (response.error)
|
223 |
+
{
|
224 |
+
alert(response.message);
|
225 |
+
}
|
226 |
+
|
227 |
+
if(response.ajaxExpired && response.ajaxRedirect)
|
228 |
+
{
|
229 |
+
setLocation(response.ajaxRedirect);
|
230 |
+
}
|
231 |
+
} else if (response) {
|
232 |
+
|
233 |
+
if(response.search('login-container') != -1)
|
234 |
+
{
|
235 |
+
location.href = BASE_URL;
|
236 |
+
}else
|
237 |
+
{
|
238 |
+
//adminhtml-dashboard-index
|
239 |
+
response = response+"";
|
240 |
+
this.blockResult.update(response);
|
241 |
+
// Show window
|
242 |
+
this._showWindow();
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}.bind(this)
|
246 |
+
});
|
247 |
+
}
|
248 |
+
};
|
249 |
+
|
250 |
+
|
251 |
+
Event.observe(window, 'load', function() {
|
252 |
+
autoCompleteAddress = new AutoCompleteAddress();
|
253 |
+
});
|
package.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>WhitePages_PRO</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://pro.whitepages.com/magento/license">MITL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Validates purchasers to prevent card-not-present fraud and improves efficiencies to streamline the manual order entry process.</summary>
|
10 |
+
<description>WhitePages PRO provides you with access to the industry’s most intelligent contact data for a 360 degree view of your customers. With the WhitePages PRO Magento extension, you can tap into WhitePages.com’s extensive contact database of 300 million phone numbers (including mobile) to validate online purchasers to predict and prevent fraud and to improve efficiencies to help streamline the manual order entry process. 
|
11 |
+

|
12 |
+
Extension Features:
|
13 |
+

|
14 |
+
Customer Information Validation 
|
15 |
+

|
16 |
+
The WhitePages PRO plug-in ensures that all of the customer information you receive within an order is consistent, helping you prevent card-not-present fraud. This feature aligns the name and phone number of your customer with their address and provides you with a simple grade (A,B,C,D,F) that you can use to determine if the order should undergo a manual review.
|
17 |
+

|
18 |
+
A “score” is automatically given to all of your orders. The 
|
19 |
+
details view displays a "deliverability score" that leverages data sourced from mail carriers to disclose whether or not an address is vacant, is new construction or is otherwise occupied with regular inhabitants
|
20 |
+

|
21 |
+
Customer Lookup:
|
22 |
+

|
23 |
+
WhitePages PRO’s Customer Lookup feature allows for much faster order entry than is available within Margento’s standard admin tool. By simply entering a customer phone number, you get to see all of the matching names and addresses that are associated with that phone number. This feature taps into WhitePages.com’s extensive database of more than 300 million landline and mobile phone numbers to match corresponding contact data points. With Customer Lookup:
|
24 |
+

|
25 |
+
You can lookup customers by phone number or business name
|
26 |
+
Auto-fill all address information with one click of a button!
|
27 |
+
Help prevent typos when entering address details.
|
28 |
+
Speed up the Magento admin order entry!
|
29 |
+

|
30 |
+
The WhitePages PRO extension is free to install. Pricing depends on usage. For more information please contact <a href="mailto:pro-sales@whitepages.com">pro-sales@whitepages.com</a>.
|
31 |
+
</description>
|
32 |
+
<notes>None</notes>
|
33 |
+
<authors><author><name>Matt Woodward</name><user>MattWoodward</user><email>mwoodward@whitepages.com</email></author></authors>
|
34 |
+
<date>2013-03-19</date>
|
35 |
+
<time>23:49:30</time>
|
36 |
+
<contents><target name="magecommunity"><dir name="Wp"><dir name="WhitePages"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Form"><dir name="Account"><file name="Autocomplete.php" hash="ee74eecff99a6443399e87593940695a"/></dir></dir></dir><dir name="Grid"><dir name="Renderer"><file name="MatchScore.php" hash="7e560eab5cb98a60abc10a3ed6e26a5e"/></dir></dir><dir name="Tab"><file name="MatchScore.php" hash="6b1116b7e19b8a34af6c84340c8ebf43"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Options"><file name="Button.php" hash="219d8673155453d0dd44036c7cc77895"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="db857fdb4fb68dcbb3caf39bc9c77d74"/></dir><dir name="Model"><file name="Api.php" hash="6acce704b8c3b17004fbafa6a84ba9eb"/><file name="AutocompleteAddress.php" hash="2bf0d3dad2002b6b3847eb6c8a8f7e7c"/><file name="MatchScore.php" hash="6a4147fdb6cc1956a553905648871f68"/><dir name="Mysql4"><dir name="MatchScore"><file name="Collection.php" hash="d75cf5ecc9243214c2ca90237bde033f"/></dir><file name="MatchScore.php" hash="06384b36c3ee5ccb28d7f42d0967c0c7"/></dir><file name="Observer.php" hash="ea8893c833fb989e0ffc8e956fc62067"/><dir name="System"><dir name="Config"><dir name="Source"><file name="MatchScore.php" hash="0d9da8a2086e477d32d6dd1df37adb87"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="d1b44167985127410741354779b72af7"/></dir><file name="IndexController.php" hash="2f9313dac5f41eb2178a1f19ae5aa363"/></dir><dir name="etc"><file name="config.xml" hash="4cae3b1712f19a4437af7ea47a600e4c"/><file name="system.xml" hash="c06b01b863d3bba0bea46d07a93b9d41"/></dir><dir name="sql"><dir name="whitePages_setup"><file name="mysql4-install-0.0.1.php" hash="6c4fb5bcfc4445ccd08ef57e69657ae1"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="whitepages.css" hash="cd9b736f15422b937983596d07716034"/><dir name="images"><file name="WPPRO-blue.png" hash="a475c0574d5c48540ee60a2a1fae6c56"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="whitePages.xml" hash="c10e2aba9197696f7508eb22e015b496"/></dir><dir name="template"><dir name="whitepages"><dir name="order"><dir name="create"><dir name="form"><dir name="account"><dir name="autocomplete"><file name="results.phtml" hash="a566f44620c43108392afeb3bc0375b6"/></dir><file name="autocomplete.phtml" hash="6de09d828f640e06f1124795e5cedf1f"/></dir><file name="account.phtml" hash="0acb1327a2203a855bf891a1d9e12fed"/></dir></dir><dir name="view"><dir name="tab"><file name="matchscore.phtml" hash="aaa474634a7a370d78c5ec70bf3959ed"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="whitepages"><file name="autocompleteaddress.js" hash="4e1a6ca3f001996531b7b181b34822e2"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wp_WhitePages.xml" hash="53d45a1a03cd134f07f23a8453c137b5"/></dir></target></contents>
|
37 |
+
<compatible/>
|
38 |
+
<dependencies><required><php><min>5.0.0</min><max>5.3.0</max></php></required></dependencies>
|
39 |
+
</package>
|
skin/adminhtml/default/default/images/WPPRO-blue.png
ADDED
Binary file
|
skin/adminhtml/default/default/whitepages.css
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @category Wp
|
3 |
+
* @package Wp_Whitepages
|
4 |
+
* @author WhitePages <support@whitepages.com>
|
5 |
+
* @copyright WhitePages Inc. (c) 2013
|
6 |
+
*
|
7 |
+
* THIS SOFTWARE AND RELATED SERVICE IS PROVIDED ON AN �AS IS� BASIS. TO THE FULLEST EXTENT
|
8 |
+
* PERMISSIBLE, WHITEPAGES AND ITS AFFILIATES DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS
|
9 |
+
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NONINFRINGEMENT AND IMPLIED
|
10 |
+
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSEOR THOSE ARISING FROM
|
11 |
+
* COURSE OF DEALING OR USAGE OF TRADE. WITHOUT LIMITING THE FOREGOING, WHITEPAGES MAKES NO
|
12 |
+
* REPRESENTATIONS THAT (I) THE SOFTWARE OR RELATED SERVICE WILL MEET YOUR REQUIREMENTS OR BE
|
13 |
+
* ACCURATE, COMPLETE, RELIABLE OR ERROR FREE; (II) THAT THE SOFTWARE OR RELATED SERVICE
|
14 |
+
* ALWAYS BE AVAILABLE OR WILL BE UNINTERRUPTED, ACCESSIBLE, TIMELY, RESPONSIVE OR SECURE; OR
|
15 |
+
* (III) THAT ANY DEFECTS WILL BE CORRECTED, OR THAT THE SOFTWARE OR RELATED SERVICE WILL BE
|
16 |
+
* FREE FROM VIRUSES, �WORMS,� �TROJAN HORSES� OR OTHER HARMFUL PROPERTIES. YOU EXPRESSLY
|
17 |
+
* AGREE THAT USE IS AT YOUR SOLE RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE
|
18 |
+
* TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM AND FOR ANY DISCLOSURE OF
|
19 |
+
* INFORMATION THAT YOU UNDERTAKE WHILE USING THE SOFTWARE OR RELATED SERVICE. IN NO EVENT
|
20 |
+
* SHALL WHITEPAGES OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION
|
22 |
+
* WITH THE SOFTWARE OR RELATED SERVICE.
|
23 |
+
*
|
24 |
+
*/
|
25 |
+
|
26 |
+
/* Styles For Autocomplete */
|
27 |
+
|
28 |
+
.whitepages-autocomplete-fields
|
29 |
+
{
|
30 |
+
background: #fafafa;
|
31 |
+
border: 1px solid #d6d6d6;
|
32 |
+
left: 50%;
|
33 |
+
margin: 0 0 0 -325px;
|
34 |
+
position: fixed;
|
35 |
+
top: 50%;
|
36 |
+
width: 650px;
|
37 |
+
z-index: 400;
|
38 |
+
}
|
39 |
+
|
40 |
+
.whitepages-autocomplete-fields .grid
|
41 |
+
{
|
42 |
+
height: 310px;
|
43 |
+
overflow-y: scroll;
|
44 |
+
}
|
45 |
+
|
46 |
+
.whitepages-autocomplete-fields .send-autocomplete
|
47 |
+
{
|
48 |
+
width: 100px;
|
49 |
+
vertical-align: middle;
|
50 |
+
}
|
51 |
+
|
52 |
+
.whitepages-autocomplete-fields .close
|
53 |
+
{
|
54 |
+
margin-left: 20px;
|
55 |
+
}
|
56 |
+
|
57 |
+
/* Styles for MatchScore */
|
58 |
+
|
59 |
+
.grade-A
|
60 |
+
{
|
61 |
+
color:green;
|
62 |
+
}
|
63 |
+
|
64 |
+
.grade-B,.grade-C
|
65 |
+
{
|
66 |
+
color:black;
|
67 |
+
}
|
68 |
+
|
69 |
+
.grade-D, .grade-E, .grade-F
|
70 |
+
{
|
71 |
+
color:red;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
.matchscore .overall-grade
|
76 |
+
{
|
77 |
+
width: 215px;
|
78 |
+
}
|
79 |
+
|
80 |
+
.matchscore .overall-grade div
|
81 |
+
{
|
82 |
+
width: 200px;
|
83 |
+
height: 75px;
|
84 |
+
background-color: lightgray;
|
85 |
+
text-align: center;
|
86 |
+
line-height: 75px;
|
87 |
+
-moz-border-radius: 10px;
|
88 |
+
-webkit-border-radius: 10px;
|
89 |
+
-khtml-border-radius: 10px;
|
90 |
+
border-radius: 10px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.matchscore .overall-grade div span
|
94 |
+
{
|
95 |
+
font-size: 40px;
|
96 |
+
font-weight: bold;
|
97 |
+
}
|
98 |
+
|
99 |
+
.columns .matchscore .form-list
|
100 |
+
{
|
101 |
+
width: 100%;
|
102 |
+
}
|
103 |
+
.matchscore td
|
104 |
+
{
|
105 |
+
padding-bottom: 5px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.matchscore td.label
|
109 |
+
{
|
110 |
+
width: 75px;
|
111 |
+
}
|
112 |
+
|
113 |
+
.matchscore .wp-logo
|
114 |
+
{
|
115 |
+
position: relative;
|
116 |
+
top: -15px;
|
117 |
+
width: 263px;
|
118 |
+
}
|
119 |
+
|
120 |
+
.matchscore .wp-logo img
|
121 |
+
{
|
122 |
+
float: right;
|
123 |
+
}
|