recapture - Version 1.0.6

Version Notes

Added multi-site support.

Download this release

Release Info

Developer David Webber
Extension recapture
Version 1.0.6
Comparing to
See all releases


Code changes from version 1.0.5 to 1.0.6

app/code/local/Recapture/Connector/Block/Adminhtml/System/Config/Authenticate.php CHANGED
@@ -8,7 +8,7 @@ implements Varien_Data_Form_Element_Renderer_Interface {
8
 
9
  $data = array(
10
  'label' => Mage::helper('adminhtml')->__('Authenticate Account'),
11
- 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("recapture_admin/authenticate") . '\' )',
12
  'class' => '',
13
  );
14
 
8
 
9
  $data = array(
10
  'label' => Mage::helper('adminhtml')->__('Authenticate Account'),
11
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("recapture_admin/authenticate", Mage::helper('recapture')->getScopeForUrl()) . '\' )',
12
  'class' => '',
13
  );
14
 
app/code/local/Recapture/Connector/Block/Adminhtml/System/Config/Status.php CHANGED
@@ -4,7 +4,7 @@ class Recapture_Connector_Block_Adminhtml_System_Config_Status extends Mage_Admi
4
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
 
7
- $authenticated = Mage::getStoreConfig('recapture/configuration/authenticated');
8
 
9
  $image = $this->getSkinUrl('images/' . ($authenticated ? 'success' : 'error') . '_msg_icon.gif');
10
  $text = '<img style="float: left; margin-right: 6px;" src="' . $image . '" /> ';
4
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
 
7
+ $authenticated = Mage::getStoreConfig('recapture/configuration/authenticated', Mage::helper('recapture')->getScopeStoreId());
8
 
9
  $image = $this->getSkinUrl('images/' . ($authenticated ? 'success' : 'error') . '_msg_icon.gif');
10
  $text = '<img style="float: left; margin-right: 6px;" src="' . $image . '" /> ';
app/code/local/Recapture/Connector/Helper/Data.php CHANGED
@@ -14,6 +14,56 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
14
 
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  public function translateCartHash($hash = ''){
18
 
19
  if (empty($hash)) return false;
14
 
15
  }
16
 
17
+ public function getScopeStoreId(){
18
+
19
+ $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
20
+ $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
21
+
22
+ if (!$website && !$store) return '0';
23
+
24
+ if ($store) return Mage::getModel('core/store')->load($store)->getId();
25
+ if ($website) return Mage::getModel('core/website')->load($website)->getDefaultGroup()->getDefaultStoreId();
26
+
27
+
28
+
29
+ }
30
+
31
+ public function getCurrentScope(){
32
+
33
+ $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
34
+ $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
35
+
36
+ if (!$website && !$store) return 'default';
37
+
38
+ if ($store) return 'stores';
39
+ if ($website) return 'websites';
40
+
41
+ }
42
+
43
+ public function getScopeForUrl(){
44
+
45
+ $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
46
+ $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
47
+
48
+ if (!$website && !$store) return array();
49
+
50
+ if ($store) return array('website' => $website, 'store' => $store);
51
+ if ($website) return array('website' => $website);
52
+
53
+ }
54
+
55
+ public function getCurrentScopeId(){
56
+
57
+ $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
58
+ $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
59
+
60
+ if (!$website && !$store) return 0;
61
+
62
+ if ($store) return Mage::getModel('core/store')->load($store)->getId();
63
+ if ($website) return Mage::getModel('core/website')->load($website)->getId();
64
+
65
+ }
66
+
67
  public function translateCartHash($hash = ''){
68
 
69
  if (empty($hash)) return false;
app/code/local/Recapture/Connector/controllers/Adminhtml/AuthenticateController.php CHANGED
@@ -4,9 +4,27 @@ class Recapture_Connector_Adminhtml_AuthenticateController extends Mage_Adminhtm
4
 
5
  public function indexAction(){
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  $query = http_build_query(array(
8
- 'return' => Mage::helper('adminhtml')->getUrl('recapture_admin/authenticate/return', array('response_key' => 'API_KEY')),
9
- 'recapture' => Mage::getUrl('recapture/cart/index', array('hash' => 'CART_HASH'))
 
10
  ));
11
 
12
  $authenticateUrl = 'http://recapture.io/account/auth?' . $query;
@@ -18,11 +36,15 @@ class Recapture_Connector_Adminhtml_AuthenticateController extends Mage_Adminhtm
18
 
19
  $apiKey = $this->getRequest()->getParam('response_key');
20
 
 
 
 
 
21
  if ($apiKey){
22
 
23
  $config = new Mage_Core_Model_Config();
24
- $config->saveConfig('recapture/configuration/authenticated', true, 'default', 0);
25
- $config->saveConfig('recapture/configuration/api_key', $apiKey, 'default', 0);
26
 
27
  Mage::getSingleton('adminhtml/session')->addSuccess('Your account has been authenticated successfully!');
28
 
@@ -32,7 +54,21 @@ class Recapture_Connector_Adminhtml_AuthenticateController extends Mage_Adminhtm
32
 
33
  }
34
 
35
- return $this->_redirect('adminhtml/system_config/edit', array('section' => 'recapture'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  }
38
 
4
 
5
  public function indexAction(){
6
 
7
+ if (Mage::helper('recapture')->getCurrentScope() == 'default'){
8
+
9
+ Mage::getSingleton('adminhtml/session')->addError('You cannot authenticate the Default Config scope. Please select a Website or Store View from the scope dropdown on the left before authenticating.');
10
+
11
+ return $this->_redirect('adminhtml/system_config/edit', array('section' => 'recapture'));
12
+
13
+ }
14
+
15
+ $scope = Mage::helper('recapture')->getScopeForUrl();
16
+
17
+ $returnCancel = Mage::helper('adminhtml')->getUrl('recapture_admin/authenticate/cancel', $scope);
18
+
19
+ $scope['response_key'] = 'API_KEY';
20
+
21
+ $returnConfirm = Mage::helper('adminhtml')->getUrl('recapture_admin/authenticate/return', $scope);
22
+ $recaptureUrl = Mage::getUrl('recapture/cart/index', array('hash' => 'CART_HASH', '_store' => Mage::helper('recapture')->getScopeStoreId()));
23
+
24
  $query = http_build_query(array(
25
+ 'return' => $returnConfirm,
26
+ 'return_cancel' => $returnCancel,
27
+ 'recapture' => $recaptureUrl
28
  ));
29
 
30
  $authenticateUrl = 'http://recapture.io/account/auth?' . $query;
36
 
37
  $apiKey = $this->getRequest()->getParam('response_key');
38
 
39
+ $helper = Mage::helper('recapture');
40
+ $scope = $helper->getCurrentScope();
41
+ $scopeId = $helper->getCurrentScopeId();
42
+
43
  if ($apiKey){
44
 
45
  $config = new Mage_Core_Model_Config();
46
+ $config->saveConfig('recapture/configuration/authenticated', true, $scope, $scopeId);
47
+ $config->saveConfig('recapture/configuration/api_key', $apiKey, $scope, $scopeId);
48
 
49
  Mage::getSingleton('adminhtml/session')->addSuccess('Your account has been authenticated successfully!');
50
 
54
 
55
  }
56
 
57
+ $scope = Mage::helper('recapture')->getScopeForUrl();
58
+ $scope['section'] = 'recapture';
59
+
60
+ return $this->_redirect('adminhtml/system_config/edit', $scope);
61
+
62
+ }
63
+
64
+ public function cancelAction(){
65
+
66
+ Mage::getSingleton('adminhtml/session')->addError('Authentication has been cancelled.');
67
+
68
+ $scope = Mage::helper('recapture')->getScopeForUrl();
69
+ $scope['section'] = 'recapture';
70
+
71
+ return $this->_redirect('adminhtml/system_config/edit', $scope);
72
 
73
  }
74
 
package.xml CHANGED
@@ -1,20 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>recapture</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</summary>
10
  <description>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</description>
11
- <notes>Captures correct images for grouped and configurable products.&#xD;
12
- &#xD;
13
- Added lots more cool data for campaign segmenting.</notes>
14
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
15
- <date>2015-07-31</date>
16
- <time>21:23:01</time>
17
- <contents><target name="magelocal"><dir name="Recapture"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Authenticate.php" hash="b4def4c279d801f7e9c327d8ee87c414"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="003133a47fb37e6f522314778eec9632"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="0a55323dc217e54be74c91c4b92b6ecc"/></dir><file name="CartController.php" hash="b1a13eaa32a9d6af551b1b73c1573a0d"/><file name="RecaptureController.php" hash="987215ca928935afc9d4f9ce4fdf670c"/></dir><dir name="etc"><file name="config.xml" hash="972e1b80755b47428392e7ab8224bbd2"/><file name="system.xml" hash="12f5cd5932b919ba61f0cb366f252efc"/></dir><dir name="Helper"><file name="Data.php" hash="a8256fffe350a4bd82ba13a9af8ddd54"/><file name="Transport.php" hash="a13bf58b13e207f5260fe2bdbe86fb5e"/></dir><dir name="Model"><file name="Observer.php" hash="d092f076cef50c6b9e91a854e32a3cbf"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Recapture_Connector.xml" hash="e8fea9dc4237af6b34219c7f52bd02d8"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>recapture</name>
4
+ <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</summary>
10
  <description>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</description>
11
+ <notes>Added multi-site support.</notes>
 
 
12
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
13
+ <date>2015-08-03</date>
14
+ <time>20:04:37</time>
15
+ <contents><target name="magelocal"><dir name="Recapture"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Authenticate.php" hash="2433544256c447f96d1e4b4a823e724a"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="f19858c8bb476b05e7e86cbdce403323"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="99e88ec23f679320e9d1aa62101ecd2e"/></dir><file name="CartController.php" hash="b1a13eaa32a9d6af551b1b73c1573a0d"/><file name="RecaptureController.php" hash="987215ca928935afc9d4f9ce4fdf670c"/></dir><dir name="etc"><file name="config.xml" hash="972e1b80755b47428392e7ab8224bbd2"/><file name="system.xml" hash="12f5cd5932b919ba61f0cb366f252efc"/></dir><dir name="Helper"><file name="Data.php" hash="75303b11410e45bca05e1a70b5ef3ab2"/><file name="Transport.php" hash="a13bf58b13e207f5260fe2bdbe86fb5e"/></dir><dir name="Model"><file name="Observer.php" hash="d092f076cef50c6b9e91a854e32a3cbf"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Recapture_Connector.xml" hash="e8fea9dc4237af6b34219c7f52bd02d8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>