Version Notes
Use our Signpost extension for Magento to sync your Magento clients in real time to your Signpost account. Setup takes 2 minutes, and all syncing is in the background. When a customer signs up in Magento, they will be immediately imported into Signpost for you to being marketing to.
Download this release
Release Info
Developer | bill |
Extension | signpost |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- Documentation.pdf +0 -0
- app/code/community/MySolutions/Signpost/Helper/Api.php +64 -0
- app/code/community/MySolutions/Signpost/Helper/Data.php +33 -0
- app/code/community/MySolutions/Signpost/Model/Observer.php +43 -0
- app/code/community/MySolutions/Signpost/etc/adminhtml.xml +23 -0
- app/code/community/MySolutions/Signpost/etc/config.xml +54 -0
- app/code/community/MySolutions/Signpost/etc/system.xml +49 -0
- app/etc/modules/MySolutions_Signpost.xml +12 -0
- package.xml +18 -0
Documentation.pdf
ADDED
Binary file
|
app/code/community/MySolutions/Signpost/Helper/Api.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Observer:
|
5 |
+
*
|
6 |
+
* @author amitb@digitalaptech.com
|
7 |
+
*/
|
8 |
+
class MySolutions_Signpost_Helper_Api {
|
9 |
+
|
10 |
+
|
11 |
+
public function CallSignPostContacts($emailAddress ,$name){
|
12 |
+
|
13 |
+
$ApiUrl = Mage::helper('signpost')->getApiUrl();
|
14 |
+
$XApiKey = Mage::helper('signpost')->getXApiKey();
|
15 |
+
$MerchantId = Mage::helper('signpost')->getMerchantId();
|
16 |
+
|
17 |
+
if($ApiUrl && $XApiKey && $MerchantId ){
|
18 |
+
|
19 |
+
$data= array(
|
20 |
+
'merchantId' => $MerchantId,
|
21 |
+
'name' => $name ,
|
22 |
+
'contacts' =>array(
|
23 |
+
array('emailAddress' => $emailAddress)
|
24 |
+
)
|
25 |
+
);
|
26 |
+
// log print
|
27 |
+
// Mage::log(print_r($data, 1), null, 'signpost.log');
|
28 |
+
$request = json_encode($data);
|
29 |
+
/* Hit Signpost APi */
|
30 |
+
try {
|
31 |
+
|
32 |
+
$ch = curl_init();
|
33 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
34 |
+
curl_setopt($ch, CURLOPT_URL, $ApiUrl.'/contacts');
|
35 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
36 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
37 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
38 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
|
39 |
+
|
40 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
41 |
+
'Content-Type: application/json',
|
42 |
+
'x-api-key: '.$XApiKey,
|
43 |
+
'Content-Length: ' . strlen($request))
|
44 |
+
);
|
45 |
+
|
46 |
+
$responseBody = curl_exec($ch);
|
47 |
+
curl_close($ch);
|
48 |
+
/* Mage::log('prefix'.Zend_Debug::dump($responseBody, null, false), null,
|
49 |
+
'signp.log'); */
|
50 |
+
$responseBodyJson = json_decode( $responseBody);
|
51 |
+
|
52 |
+
if(isset($responseBodyJson->message)){
|
53 |
+
return $responseBodyJson->message;
|
54 |
+
}
|
55 |
+
return FALSE;
|
56 |
+
}
|
57 |
+
catch (Exception $e) {
|
58 |
+
Mage::logException($e) ;
|
59 |
+
}
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
}
|
app/code/community/MySolutions/Signpost/Helper/Data.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Data
|
5 |
+
*
|
6 |
+
* @author amitb@digitalaptech
|
7 |
+
*/
|
8 |
+
class MySolutions_Signpost_Helper_Data extends Mage_Core_Helper_Data {
|
9 |
+
|
10 |
+
/* get Api url from configuration */
|
11 |
+
|
12 |
+
public function getApiUrl($store = null){
|
13 |
+
if(Mage::getStoreConfig('signpost/apis/url', $store)){
|
14 |
+
return Mage::getStoreConfig('signpost/apis/url', $store);
|
15 |
+
}
|
16 |
+
return false;
|
17 |
+
}
|
18 |
+
|
19 |
+
/* get Api X-APi Key -*/
|
20 |
+
public function getXApiKey($store = null){
|
21 |
+
|
22 |
+
if(Mage::getStoreConfig('signpost/apis/x_api_key', $store)){
|
23 |
+
return Mage::getStoreConfig('signpost/apis/x_api_key', $store);
|
24 |
+
}
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
public function getMerchantId($store = null){
|
28 |
+
if(Mage::getStoreConfig('signpost/apis/merchant_id', $store)){
|
29 |
+
return Mage::getStoreConfig('signpost/apis/merchant_id', $store);
|
30 |
+
}
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
}
|
app/code/community/MySolutions/Signpost/Model/Observer.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Observer:
|
5 |
+
*
|
6 |
+
* @author amitb@digitalaptech.com
|
7 |
+
*/
|
8 |
+
class MySolutions_Signpost_Model_Observer {
|
9 |
+
|
10 |
+
public function PushCustomerData(Varien_Event_Observer $observer) {
|
11 |
+
|
12 |
+
/** @var $customer Mage_Customer_Model_Customer */
|
13 |
+
$customer = $observer->getEvent()->getCustomer();
|
14 |
+
|
15 |
+
$object = $observer->getEvent()->getDataObject();
|
16 |
+
|
17 |
+
/* Call Sign post Api whenver Customer is new */
|
18 |
+
|
19 |
+
|
20 |
+
if($object->isObjectNew()) {
|
21 |
+
Mage::helper('signpost/api')->CallSignPostContacts($customer->getEmail()
|
22 |
+
,$customer->getName());
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
public function PushGuestCustomerData(Varien_Event_Observer $observer) {
|
28 |
+
|
29 |
+
/** @var $customer Mage_Customer_Model_Customer */
|
30 |
+
$order = $observer->getEvent()->getOrder();
|
31 |
+
|
32 |
+
|
33 |
+
/* Call Sign post Api whenver Customer is new */
|
34 |
+
|
35 |
+
|
36 |
+
if($order->getCustomerIsGuest()){
|
37 |
+
Mage::helper('signpost/api')->CallSignPostContacts($order->getCustomerEmail()
|
38 |
+
,$order->getBillingAddress()->getName());
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
app/code/community/MySolutions/Signpost/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<signpost translate="title" module="signpost">
|
12 |
+
<title>Signpost Section</title>
|
13 |
+
</signpost>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/community/MySolutions/Signpost/etc/config.xml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
To change this license header, choose License Headers in Project Properties.
|
4 |
+
To change this template file, choose Tools | Templates
|
5 |
+
and open the template in the editor.
|
6 |
+
-->
|
7 |
+
<config>
|
8 |
+
<modules>
|
9 |
+
<MySolutions_Signpost>
|
10 |
+
<version>1.0.0</version>
|
11 |
+
</MySolutions_Signpost>
|
12 |
+
</modules>
|
13 |
+
<global>
|
14 |
+
<helpers>
|
15 |
+
<signpost>
|
16 |
+
<class>MySolutions_Signpost_Helper</class>
|
17 |
+
</signpost>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<signpost>
|
21 |
+
<class>MySolutions_Signpost_Model</class>
|
22 |
+
</signpost>
|
23 |
+
</models>
|
24 |
+
<!--
|
25 |
+
* Push Customer Data to signpost
|
26 |
+
* whenever Customer will created
|
27 |
+
-->
|
28 |
+
<events>
|
29 |
+
<customer_save_before>
|
30 |
+
<observers>
|
31 |
+
<push_data_to_signpost_when_customer_register>
|
32 |
+
<class>signpost/observer</class>
|
33 |
+
<method>PushCustomerData</method>
|
34 |
+
<type>singleton</type>
|
35 |
+
</push_data_to_signpost_when_customer_register>
|
36 |
+
</observers>
|
37 |
+
</customer_save_before>
|
38 |
+
|
39 |
+
<!--
|
40 |
+
* Push guest Customer Data to signpost
|
41 |
+
* whenever order will placed
|
42 |
+
-->
|
43 |
+
<checkout_submit_all_after>
|
44 |
+
<observers>
|
45 |
+
<push_data_to_signpost_when_order_place>
|
46 |
+
<class>signpost/observer</class>
|
47 |
+
<method>PushGuestCustomerData</method>
|
48 |
+
<type>singleton</type>
|
49 |
+
</push_data_to_signpost_when_order_place>
|
50 |
+
</observers>
|
51 |
+
</checkout_submit_all_after>
|
52 |
+
</events>
|
53 |
+
</global>
|
54 |
+
</config>
|
app/code/community/MySolutions/Signpost/etc/system.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<signpost translate="label" module="signpost">
|
5 |
+
<label>Sign Post configuration</label>
|
6 |
+
<tab>customer</tab>
|
7 |
+
<show_in_default>1</show_in_default>
|
8 |
+
<show_in_website>1</show_in_website>
|
9 |
+
<show_in_store>1</show_in_store>
|
10 |
+
<sort_order>131</sort_order>
|
11 |
+
<groups>
|
12 |
+
<apis translate="label">
|
13 |
+
<label>Api Details(All fields should be field)</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<url translate="label">
|
21 |
+
<label>Api url</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
</url>
|
28 |
+
<merchant_id translate="label">
|
29 |
+
<label>Merchant id</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>2</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 |
+
</merchant_id>
|
36 |
+
<x_api_key translate="label">
|
37 |
+
<label>X Api Key</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>3</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</x_api_key>
|
44 |
+
</fields>
|
45 |
+
</apis>
|
46 |
+
</groups>
|
47 |
+
</signpost>
|
48 |
+
</sections>
|
49 |
+
</config>
|
app/etc/modules/MySolutions_Signpost.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MySolutions_Signpost>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
<active>true</active>
|
7 |
+
<depends>
|
8 |
+
<Mage_Customer/>
|
9 |
+
</depends>
|
10 |
+
</MySolutions_Signpost>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>signpost</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Sync your Magento clients to your Signpost account in real time!</summary>
|
10 |
+
<description>Use our Signpost extension for Magento to sync your Magento clients in real time to your Signpost account. Setup takes 2 minutes, and all syncing is in the background. When a customer signs up in Magento, they will be immediately imported into Signpost for you to being marketing to.</description>
|
11 |
+
<notes>Use our Signpost extension for Magento to sync your Magento clients in real time to your Signpost account. Setup takes 2 minutes, and all syncing is in the background. When a customer signs up in Magento, they will be immediately imported into Signpost for you to being marketing to.</notes>
|
12 |
+
<authors><author><name>bill</name><user>bill</user><email>bill@fowsolutions.com</email></author></authors>
|
13 |
+
<date>2016-08-05</date>
|
14 |
+
<time>11:15:43</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="MySolutions"><dir name="Signpost"><dir name="Helper"><file name="Api.php" hash="0363e4f5fbf376dbb88523877511d7b6"/><file name="Data.php" hash="663b68f8791edb68b858d8a98c06aa08"/></dir><dir name="Model"><file name="Observer.php" hash="be44956c2149d682782a86bfe9e710dd"/></dir><dir name="etc"><file name="adminhtml.xml" hash="538c8907978a7324957f6cfae1a9d5fd"/><file name="config.xml" hash="847b9ae6bd1df5d4878ba8f7213caaa4"/><file name="system.xml" hash="7444aaf16a152a4056ac1ff4e6d5ef83"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="MySolutions_Signpost.xml" hash="ee4d069d3d1220bda8e6c14d2b8abc35"/></dir></dir></dir><dir name="."><file name="Documentation.pdf" hash="ad955b2e71995768c4c3a0c91d6923c7"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>4.0.1</min><max>5.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|