sluice_connect - Version 0.1.5

Version Notes

Support multi websites magento.

Download this release

Release Info

Developer SluiceHq
Extension sluice_connect
Version 0.1.5
Comparing to
See all releases


Code changes from version 0.1.4 to 0.1.5

app/code/local/Sluice/Connect/Model/Api.php CHANGED
@@ -57,5 +57,4 @@ class Sluice_Connect_Model_Api extends Mage_Catalog_Model_Product_Api {
57
  }
58
  return $result;
59
  }
60
- }
61
- ?>
57
  }
58
  return $result;
59
  }
60
+ }
 
app/code/local/Sluice/Connect/Model/Observer.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  require_once(Mage::getBaseDir('lib').'/GA-client/GA-client.php');
4
  use UnitedPrototype\GoogleAnalytics;
5
  class Sluice_Connect_Model_Observer {
@@ -37,12 +36,21 @@ class Sluice_Connect_Model_Observer {
37
  //config save hook
38
  public function hookSavePluginConfig($observer) {
39
  $this->errorLog = 'sluice_error.log';
40
- $sluiceEmail = 'knight@sluicehq.com';
41
  $sluiceApiUrl = 'http://sluicehq.com/api/v.php?version=2&method=SetMagentoApi';
42
- $userName = 'sluice-connect';
43
- $roleName = 'sluice-connect-role';
44
 
45
- $token = Mage::getStoreConfig('sluice_section/sluice_group/sluice_field', Mage::app()->getStore());
 
 
 
 
 
 
 
 
 
 
 
 
46
  if (empty($token)) {
47
  Mage::log("Empty token", 3, $this->errorLog);
48
  Mage::getSingleton('core/session')->addError("Empty token");
@@ -51,7 +59,7 @@ class Sluice_Connect_Model_Observer {
51
 
52
  if (strlen(trim($token)) != 32) {
53
  Mage::log("Whrong token", 3, $this->errorLog);
54
- Mage::getSingleton('core/session')->addError("Whrong token");
55
  return;
56
  }
57
 
@@ -82,7 +90,7 @@ class Sluice_Connect_Model_Observer {
82
  Mage::getConfig()->reinit();
83
  Mage::app()->reinitStores();
84
  }
85
- $apiKey = Mage::getStoreConfig('sluice_section/sluice_group/api_field', Mage::app()->getStore());
86
  if(empty($apiKey)){
87
  Mage::log("Apy key is empty" . $ex->getMessage(), 3, $this->errorLog);
88
  Mage::getSingleton('core/session')->addError("Please delete 'sluice-connect' user and try agan");
@@ -99,7 +107,7 @@ class Sluice_Connect_Model_Observer {
99
  'username' => $userName,
100
  'apiKey' => $apiKey,
101
  'token' => trim($token),
102
- 'url'=>Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
103
  );
104
 
105
  $sluiceApiUrl = $sluiceApiUrl . '&' . http_build_query($data);
@@ -112,4 +120,3 @@ class Sluice_Connect_Model_Observer {
112
  }
113
  }
114
  }
115
- ?>
1
  <?php
 
2
  require_once(Mage::getBaseDir('lib').'/GA-client/GA-client.php');
3
  use UnitedPrototype\GoogleAnalytics;
4
  class Sluice_Connect_Model_Observer {
36
  //config save hook
37
  public function hookSavePluginConfig($observer) {
38
  $this->errorLog = 'sluice_error.log';
 
39
  $sluiceApiUrl = 'http://sluicehq.com/api/v.php?version=2&method=SetMagentoApi';
 
 
40
 
41
+ $websiteCode = Mage::getSingleton('adminhtml/config_data')->getWebsite();
42
+ $websiteId = Mage::getModel('core/website')->load($websiteCode)->getId();
43
+ $store = Mage::app()->getWebsite($websiteId)->getDefaultStore();
44
+
45
+
46
+ if(empty($websiteId)){
47
+ $websiteId = 'main';
48
+ }
49
+ $userName = 'sluice-connect-website#'.$websiteId;
50
+ $roleName = 'sluice-connect-role-website#'.$websiteId;
51
+ $sluiceEmail = 'sluice_email_'.$websiteId.'@sluicehq.com';
52
+
53
+ $token = Mage::getStoreConfig('sluice_section/sluice_group/sluice_field', $store);
54
  if (empty($token)) {
55
  Mage::log("Empty token", 3, $this->errorLog);
56
  Mage::getSingleton('core/session')->addError("Empty token");
59
 
60
  if (strlen(trim($token)) != 32) {
61
  Mage::log("Whrong token", 3, $this->errorLog);
62
+ Mage::getSingleton('core/session')->addError("Wrong token");
63
  return;
64
  }
65
 
90
  Mage::getConfig()->reinit();
91
  Mage::app()->reinitStores();
92
  }
93
+ $apiKey = Mage::getStoreConfig('sluice_section/sluice_group/api_field', $store);
94
  if(empty($apiKey)){
95
  Mage::log("Apy key is empty" . $ex->getMessage(), 3, $this->errorLog);
96
  Mage::getSingleton('core/session')->addError("Please delete 'sluice-connect' user and try agan");
107
  'username' => $userName,
108
  'apiKey' => $apiKey,
109
  'token' => trim($token),
110
+ 'url'=>$store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
111
  );
112
 
113
  $sluiceApiUrl = $sluiceApiUrl . '&' . http_build_query($data);
120
  }
121
  }
122
  }
 
app/code/local/Sluice/Connect/etc/config.xml CHANGED
@@ -1,84 +1,84 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <sluice_connect>
5
- <version>0.1.0</version>
6
- </sluice_connect>
7
- </modules>
8
-
9
- <global>
10
- <models>
11
- <sluice_connect>
12
- <class>Sluice_Connect_Model</class>
13
- </sluice_connect>
14
- </models>
15
-
16
- <helpers>
17
- <sluice_connect>
18
- <class>Sluice_Connect_Helper</class>
19
- </sluice_connect>
20
- </helpers>
21
-
22
- <events>
23
- <admin_system_config_changed_section_sluice_section>
24
- <observers>
25
- <config_change_ob>
26
- <type>singleton</type>
27
- <class>Sluice_Connect_Model_Observer</class>
28
- <method>hookSavePluginConfig</method>
29
- </config_change_ob>
30
- </observers>
31
- </admin_system_config_changed_section_sluice_section>
32
- </events>
33
- </global>
34
-
35
- <frontend>
36
- <events>
37
- <!-- Hooking to our own event "checkout_cart_product_add_after" -->
38
- <checkout_cart_product_add_after>
39
- <observers>
40
- <Sluice_Connect_Model_Observer>
41
- <type>singleton</type>
42
- <class>Sluice_Connect_Model_Observer</class>
43
- <method>hookToAddToCart</method>
44
- </Sluice_Connect_Model_Observer>
45
- </observers>
46
- </checkout_cart_product_add_after>
47
-
48
- <admin_system_config_changed_section_sluice_section>
49
- <observers>
50
- <config_change_ob>
51
- <type>singleton</type>
52
- <class>Sluice_Connect_Model_Observer</class>
53
- <method>hookSavePluginConfig</method>
54
- </config_change_ob>
55
- </observers>
56
- </admin_system_config_changed_section_sluice_section>
57
- </events>
58
- </frontend>
59
-
60
- <adminhtml>
61
- <acl>
62
- <resources>
63
- <all>
64
- <title>Allow Everything</title>
65
- </all>
66
- <admin>
67
- <children>
68
- <system>
69
- <children>
70
- <config>
71
- <children>
72
- <sluice_section translate="title" module="sluice_connect">
73
- <title>My Section</title>
74
- </sluice_section>
75
- </children>
76
- </config>
77
- </children>
78
- </system>
79
- </children>
80
- </admin>
81
- </resources>
82
- </acl>
83
- </adminhtml>
84
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <sluice_connect>
5
+ <version>0.1.0</version>
6
+ </sluice_connect>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <sluice_connect>
12
+ <class>Sluice_Connect_Model</class>
13
+ </sluice_connect>
14
+ </models>
15
+
16
+ <helpers>
17
+ <sluice_connect>
18
+ <class>Sluice_Connect_Helper</class>
19
+ </sluice_connect>
20
+ </helpers>
21
+
22
+ <events>
23
+ <admin_system_config_changed_section_sluice_section>
24
+ <observers>
25
+ <config_change_ob>
26
+ <type>singleton</type>
27
+ <class>Sluice_Connect_Model_Observer</class>
28
+ <method>hookSavePluginConfig</method>
29
+ </config_change_ob>
30
+ </observers>
31
+ </admin_system_config_changed_section_sluice_section>
32
+ </events>
33
+ </global>
34
+
35
+ <frontend>
36
+ <events>
37
+ <!-- Hooking to our own event "checkout_cart_product_add_after" -->
38
+ <checkout_cart_product_add_after>
39
+ <observers>
40
+ <Sluice_Connect_Model_Observer>
41
+ <type>singleton</type>
42
+ <class>Sluice_Connect_Model_Observer</class>
43
+ <method>hookToAddToCart</method>
44
+ </Sluice_Connect_Model_Observer>
45
+ </observers>
46
+ </checkout_cart_product_add_after>
47
+
48
+ <admin_system_config_changed_section_sluice_section>
49
+ <observers>
50
+ <config_change_ob>
51
+ <type>singleton</type>
52
+ <class>Sluice_Connect_Model_Observer</class>
53
+ <method>hookSavePluginConfig</method>
54
+ </config_change_ob>
55
+ </observers>
56
+ </admin_system_config_changed_section_sluice_section>
57
+ </events>
58
+ </frontend>
59
+
60
+ <adminhtml>
61
+ <acl>
62
+ <resources>
63
+ <all>
64
+ <title>Allow Everything</title>
65
+ </all>
66
+ <admin>
67
+ <children>
68
+ <system>
69
+ <children>
70
+ <config>
71
+ <children>
72
+ <sluice_section translate="title" module="sluice_connect">
73
+ <title>My Section</title>
74
+ </sluice_section>
75
+ </children>
76
+ </config>
77
+ </children>
78
+ </system>
79
+ </children>
80
+ </admin>
81
+ </resources>
82
+ </acl>
83
+ </adminhtml>
84
  </config>
app/code/local/Sluice/Connect/etc/system.xml CHANGED
@@ -1,49 +1,49 @@
1
- <?xml version="1.0" ?>
2
- <config>
3
- <tabs>
4
- <sluice_tab module="sluice_connect" translate="label">
5
- <label>Sluice Connect</label>
6
- <sort_order>100</sort_order>
7
- </sluice_tab>
8
- </tabs>
9
-
10
- <sections>
11
- <sluice_section module="sluice_connect" translate="label">
12
- <label>Settings</label>
13
- <sort_order>200</sort_order>
14
- <show_in_default>1</show_in_default>
15
- <show_in_website>1</show_in_website>
16
- <show_in_store>1</show_in_store>
17
- <tab>sluice_tab</tab>
18
- <groups>
19
- <sluice_group translate="label">
20
- <label>Token Settings</label>
21
- <sort_order>10</sort_order>
22
- <show_in_default>1</show_in_default>
23
- <show_in_website>1</show_in_website>
24
- <show_in_store>1</show_in_store>
25
- <fields>
26
- <sluice_field translate="label">
27
- <label>Token:</label>
28
- <comment>Token from sluice</comment>
29
- <show_in_default>1</show_in_default>
30
- <show_in_website>1</show_in_website>
31
- <show_in_store>1</show_in_store>
32
- <frontend_type>text</frontend_type>
33
- </sluice_field>
34
- <api_field translate="label">
35
- <label>Api Key:</label>
36
- <comment>Api Key</comment>
37
- <show_in_default>0</show_in_default>
38
- <show_in_website>0</show_in_website>
39
- <show_in_store>0</show_in_store>
40
- <frontend_type>hidden</frontend_type>
41
- </api_field>
42
- </fields>
43
- </sluice_group>
44
- </groups>
45
- </sluice_section>
46
- </sections>
47
-
48
-
49
  </config>
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <tabs>
4
+ <sluice_tab module="sluice_connect" translate="label">
5
+ <label>Sluice Connect</label>
6
+ <sort_order>100</sort_order>
7
+ </sluice_tab>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <sluice_section module="sluice_connect" translate="label">
12
+ <label>Settings</label>
13
+ <sort_order>200</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <tab>sluice_tab</tab>
18
+ <groups>
19
+ <sluice_group translate="label">
20
+ <label>Token Settings</label>
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <sluice_field translate="label">
27
+ <label>Token:</label>
28
+ <comment>Token from sluice</comment>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <frontend_type>text</frontend_type>
33
+ </sluice_field>
34
+ <api_field translate="label">
35
+ <label>Api Key:</label>
36
+ <comment>Api Key</comment>
37
+ <show_in_default>0</show_in_default>
38
+ <show_in_website>0</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ <frontend_type>hidden</frontend_type>
41
+ </api_field>
42
+ </fields>
43
+ </sluice_group>
44
+ </groups>
45
+ </sluice_section>
46
+ </sections>
47
+
48
+
49
  </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>sluice_connect</name>
4
- <version>0.1.4</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This extension helps connect your Magento Store to SluiceHQ service.</summary>
10
- <description>This extension helps connect your Magento Store to SluiceHQ service.</description>
11
- <notes>Extend standart Magento WebApi for SluiceHQ.</notes>
12
- <authors><author><name>Shavrukov Konstantin</name><user>flyb1z0n</user><email>flyb1z0n@gmail.com</email></author></authors>
13
- <date>2013-07-29</date>
14
- <time>11:41:32</time>
15
- <contents><target name="magelocal"><dir name="Sluice"><dir name="Connect"><dir name="Helper"><file name="Data.php" hash="72f7af6ab8f4dd94d7e0d56f2355e84a"/></dir><dir name="Model"><file name="Api.php" hash="9eec889ce6efe0e6574abe78d3b2e248"/><file name="Observer.php" hash="b96ce48bbe1df2b619cbfadc94053948"/></dir><dir name="etc"><file name="api.xml" hash="55bb4b5b4b09ae98c08095333b7ea584"/><file name="config.xml" hash="a0d266785b3068b867d5110c7df8b397"/><file name="system.xml" hash="a469061bfca6ddaf7d0625f713b3a160"/></dir></dir></dir></target><target name="magelib"><dir name="GA-client"><file name="GA-client.php" hash="9d36d0998d30e475d0417b790a244261"/></dir></target><target name="mageetc"><dir name="modules"><file name="Sluice_Connect.xml" hash="48740fb7c99b29de0af86399e578c5b9"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.8</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>sluice_connect</name>
4
+ <version>0.1.5</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Sluice Connect extension.</summary>
10
+ <description>This extension helps to connect your Magento store to SluiceHQ service.</description>
11
+ <notes>Support multi websites magento.</notes>
12
+ <authors><author><name>SluiceHq</name><user>sluicehq</user><email>sluicehq@gmail.com</email></author></authors>
13
+ <date>2014-06-24</date>
14
+ <time>12:59:59</time>
15
+ <contents><target name="magelocal"><dir name="Sluice"><dir name="Connect"><dir name="Helper"><file name="Data.php" hash="72f7af6ab8f4dd94d7e0d56f2355e84a"/></dir><dir name="Model"><file name="Api.php" hash="335cc36ac5be159fd2eb0530ddd0e757"/><file name="Observer.php" hash="31fac3dee59316b830c771b0060978e1"/></dir><dir name="etc"><file name="api.xml" hash="55bb4b5b4b09ae98c08095333b7ea584"/><file name="config.xml" hash="3cc6c785618a04ed7b515c4a1bb51219"/><file name="system.xml" hash="d73165324d0fa98e2f495d630accf3e5"/></dir></dir></dir></target><target name="magelib"><dir name="GA-client"><file name="GA-client.php" hash="9d36d0998d30e475d0417b790a244261"/></dir></target><target name="mageetc"><dir name="modules"><file name="Sluice_Connect.xml" hash="48740fb7c99b29de0af86399e578c5b9"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9.9.0</max></package><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
18
  </package>