ShopLogin_ShopLogin - Version 0.9.1

Version Notes

Basis Extension for ShopLogin including the Plugins "Log in with ShopLogin" and "ShopLogin global Wish List".

Download this release

Release Info

Developer Shoplogin
Extension ShopLogin_ShopLogin
Version 0.9.1
Comparing to
See all releases


Version 0.9.1

app/code/community/ShopLogin/ShopLogin/Block/Default.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Log in with ShopLogin for Magento
4
+ * https://www.shoplogin.com/for-merchants/
5
+ * v0.9.1 for Magento
6
+ */
7
+
8
+ class ShopLogin_ShopLogin_Block_Default extends Mage_Core_Block_Template {
9
+ private $_helper;
10
+
11
+ private function _getHelper() {
12
+ if(null===$this->_helper) {
13
+ $this->_helper = Mage::helper('shoplogin');
14
+ }
15
+ return $this->_helper;
16
+ }
17
+
18
+ public function isEnabled() {
19
+ return $this->_getHelper()->isEnabled();
20
+ }
21
+
22
+ public function getClientId()
23
+ {
24
+ return $this->_getHelper()->getClientId();
25
+ }
26
+
27
+ public function getClientSecret()
28
+ {
29
+ return $this->_getHelper()->getClientSecret();
30
+ }
31
+
32
+ public function AffiliateisEnabled() {
33
+ return $this->_getHelper()->AffiliateisEnabled();
34
+ }
35
+
36
+ public function TrackingPlusisEnabled() {
37
+ return $this->_getHelper()->TrackingPlusisEnabled();
38
+ }
39
+
40
+ public function getIsUserConnected()
41
+ {
42
+ // is the session-user connected with ShopLogin?
43
+ return $this->_getHelper()->getIsUserConnected();
44
+ }
45
+
46
+ }
app/code/community/ShopLogin/ShopLogin/Helper/Data.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Log in with ShopLogin for Magento
4
+ * https://www.shoplogin.com/for-merchants/
5
+ * v0.9.1 for Magento
6
+ */
7
+
8
+ class ShopLogin_ShopLogin_Helper_Data {
9
+
10
+ protected $APP_ID;
11
+ protected $APP_SECRET;
12
+ protected $redirect_url_login;
13
+ protected $redirect_url_logout;
14
+ protected $data_url = 'https://data.shoplogin.com/v001/';
15
+
16
+ public function isEnabled()
17
+ {
18
+ if(Mage::getStoreConfig('shoplogin/settings_loginwith/enabled'))
19
+ {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+
25
+ public function AffiliateisEnabled()
26
+ {
27
+ if(Mage::getStoreConfig('shoplogin/settings_affiliate/enabled'))
28
+ {
29
+ return true;
30
+ }
31
+ return false;
32
+ }
33
+
34
+ public function TrackingPlusisEnabled()
35
+ {
36
+ if(Mage::getStoreConfig('shoplogin/settings_trackingplus/enabled'))
37
+ {
38
+ return true;
39
+ }
40
+ return false;
41
+ }
42
+
43
+ public function getClientId()
44
+ {
45
+ return Mage::getStoreConfig('shoplogin/settings/clientid');
46
+ }
47
+
48
+ public function getClientSecret()
49
+ {
50
+ return Mage::getStoreConfig('shoplogin/settings/clientsecret');
51
+ }
52
+
53
+ public function getIsUserConnected()
54
+ {
55
+ // is the session-user connected with ShopLogin?
56
+ if(Mage::getSingleton('customer/session')->isLoggedIn())
57
+ {
58
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
59
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
60
+ $results = $read->fetchAll() ->from(Mage::getSingleton('core/resource')->getTableName('shoplogin_customer')) ->where("customer_id='?'", $customer->getId());
61
+ if (count($results) && isset($results[0]['shoplogin_id']))
62
+ {
63
+ return $results[0]['shoplogin_id'];
64
+ }
65
+ }
66
+ return false;
67
+ }
68
+
69
+ public function init($APP_ID = false, $APP_SECRET = false, $redirect_url_login = 'auto', $redirect_url_logout = 'auto')
70
+ {
71
+
72
+ if ( !function_exists('json_encode') ) {
73
+ throw new Exception('Configuration error: ShopLogin needs the JSON extension');
74
+ }
75
+ if ( !function_exists('curl_init') ) {
76
+ throw new Exception('Configuration error: ShopLogin needs the CURL extension');
77
+ }
78
+
79
+ if(!$APP_ID || !$APP_SECRET)
80
+ {
81
+ die('Configuration error: ShopLogin needs your APP_ID and APP_SECRET');
82
+ }
83
+ $this->appid = $APP_ID;
84
+ $this->secret = $APP_SECRET;
85
+ $this->redirect_url_login = $redirect_url_login;
86
+ $this->redirect_url_logout = $redirect_url_logout;
87
+
88
+ $this->auto_login_logout();
89
+ }
90
+
91
+ public function get_user_isauthorized($signed_request = false)
92
+ {
93
+ if(isset($_COOKIE['shoplogin_'.$this->appid]) && $_COOKIE['shoplogin_'.$this->appid])
94
+ {
95
+ $result = $this->parse_signed_request($_COOKIE['shoplogin_'.$this->appid], $this->secret);
96
+ if(is_array($result) and isset($result['uid']))
97
+ {
98
+ return json_decode(json_encode($result));
99
+ }
100
+ }
101
+ if($signed_request)
102
+ {
103
+ $result = $this->parse_signed_request($signed_request, $this->secret);
104
+ if(is_array($result) and isset($result['uid']))
105
+ {
106
+ return json_decode(json_encode($result));
107
+ }
108
+ }
109
+ return false;
110
+ }
111
+
112
+ public function get_address_fromuser($addon='')
113
+ {
114
+ $user = $this->get_user_isauthorized();
115
+ if($user)
116
+ {
117
+ return $this->get_address_fromtoken($user->data_token, $addon);
118
+ }else
119
+ {
120
+ return json_decode(json_encode(array('authorized'=>false, 'error'=>'user_not_logined')));
121
+ }
122
+ }
123
+
124
+ public function get_address_fromtoken($data_token = '', $addon='')
125
+ {
126
+ if(strlen($data_token) != 74)
127
+ {
128
+ return json_decode(json_encode(array('authorized'=>false, 'error'=>'data_token_invalid')));
129
+ }
130
+ $url = $this->data_url.'public_connect_getaddressfromtoken/?appid='.$this->appid.'&data_token='.rawurlencode($data_token).$addon;
131
+ $temp = json_decode($this->do_curl($url));
132
+ if( !isset($temp->authorized))
133
+ {
134
+ $temp = json_decode(json_encode(array('authorized'=>false, 'error'=>'connection_error')));
135
+ }
136
+ return $temp;
137
+ }
138
+
139
+ public function do_login($typ = 'address', $state = '', $redirect_url = 'auto')
140
+ {
141
+ header("LOCATION:".$this->get_login_url($typ, $state, $redirect_url));
142
+ }
143
+
144
+ public function do_logout($state = '', $redirect_url = 'auto')
145
+ {
146
+ header("LOCATION:".$this->get_logout_url($state, $redirect_url));
147
+ }
148
+
149
+ public function get_login_url($typ = 'address', $state = '', $redirect_url = 'auto')
150
+ {
151
+ if(!in_array($typ, array('address', 'login'))) { $typ = 'address'; }
152
+ return 'https://www.shoplogin.com/account/?appid='.$this->appid.'&version=1&callback=redirect&method=connect&action='.$typ.'&redirect='.rawurlencode($redirect_url).'&state='.rawurlencode($state);
153
+ }
154
+
155
+ public function get_logout_url($state = '', $redirect_url = 'auto')
156
+ {
157
+ return 'https://www.shoplogin.com/account/?appid='.$this->appid.'&version=1&callback=redirect&method=connect&action=logout&redirect='.rawurlencode($redirect_url).'&state='.rawurlencode($state);
158
+ }
159
+
160
+ protected function auto_login_logout()
161
+ {
162
+ $domain = '';
163
+ $accesscode = '';
164
+ $authorized = '';
165
+ $redirect = '';
166
+
167
+ if(isset($_GET['sl_domain']))
168
+ {
169
+ $domain = $_GET['sl_domain'];
170
+ }
171
+ if(isset($_GET['sl_access']))
172
+ {
173
+ $accesscode = $_GET['sl_access'];
174
+ }
175
+ if(isset($_GET['sl_authorized']))
176
+ {
177
+ $authorized = $_GET['sl_authorized'];
178
+ }
179
+ if($authorized == 'false' || $authorized == 'true')
180
+ {
181
+ $redirect = $this->redirect_url_logout;
182
+ setcookie('shoplogin_'.$this->appid, '', 0, '/', $domain);
183
+ $_COOKIE['shoplogin_'.$this->appid] = '';
184
+ }
185
+ if($authorized == 'true' and $accesscode)
186
+ {
187
+ $redirect = $this->redirect_url_login;
188
+ if($this->get_user_isauthorized($accesscode))
189
+ {
190
+ setcookie('shoplogin_'.$this->appid, $accesscode, 0, '/', $domain);
191
+ $_COOKIE['shoplogin_'.$this->appid] = $accesscode;
192
+ }
193
+ }
194
+
195
+ if($domain || $accesscode || $authorized)
196
+ {
197
+ if( ($authorized == 'true' && $this->redirect_url_login == 'auto') )
198
+ {
199
+ $redirect = $this->clean_url(getenv('REQUEST_URI'));
200
+ }
201
+ if( ($authorized == 'false' && $this->redirect_url_logout == 'auto') )
202
+ {
203
+ $redirect = $this->clean_url(getenv('REQUEST_URI'));
204
+ }
205
+ header('LOCATION:'.$redirect);
206
+ }
207
+ }
208
+
209
+ protected function clean_url($url)
210
+ {
211
+ foreach(array('sl_access', 'sl_authorized', 'sl_domain') as $key)
212
+ {
213
+ if(isset($_GET[$key]))
214
+ {
215
+ $url = str_replace($key.'='.$_GET[$key], '', $url);
216
+ $url = str_replace('&&', '&', $url);
217
+ }
218
+ }
219
+ $url = str_replace('?&', '?', $url);
220
+ if(substr($url, strlen($url)-1) =='?' || substr($url, strlen($url)-1) == '&') { $url = substr($url,0, strlen($url)-1); }
221
+ return $url;
222
+ }
223
+
224
+ protected function do_curl($url)
225
+ {
226
+ $url = $url."&version=magento-".Mage::getConfig()->getModuleConfig("ShopLogin_ShopLogin")->version."&shop_system=magento-".Mage::getVersion();
227
+ $url = $url.'&checksum='.md5($url.'#'.$this->secret);
228
+ $ch = curl_init();
229
+
230
+ curl_setopt($ch, CURLOPT_URL, $url);
231
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 5);
232
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
233
+ curl_setopt($ch, CURLOPT_USERAGENT, 'sl-php-001');
234
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
235
+
236
+ $result = curl_exec($ch);
237
+ curl_close($ch);
238
+ return $result;
239
+ }
240
+
241
+ protected function parse_signed_request($signed_request, $APP_SECRET) {
242
+ $temp = explode('.', $signed_request);
243
+ if(!is_array($temp) || count($temp) != 2)
244
+ {
245
+ return null;
246
+ }
247
+
248
+ $data = json_decode($this->base64_url_decode($temp[1]), true);
249
+
250
+ if(is_array($data) and $this->base64_url_decode($temp[0]) == hash_hmac('sha256', json_encode($data), $APP_SECRET, true))
251
+ {
252
+ return $data;
253
+ }
254
+ return null;
255
+ }
256
+
257
+ protected function base64_url_decode($input) {
258
+ return base64_decode(strtr($input, '-_', '+/'));
259
+ }
260
+
261
+
262
+
263
+
264
+ }
265
+
266
+ ?>
app/code/community/ShopLogin/ShopLogin/Model/Shoplogin.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Log in with ShopLogin for Magento
4
+ * https://www.shoplogin.com/for-merchants/
5
+ * v0.9.1 for Magento
6
+ */
7
+
8
+ class ShopLogin_ShopLogin_Model_Shoplogin extends Mage_Core_Model_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('shoplogin/shoplogin');
14
+ }
15
+ }
16
+
17
+ class ShopLogin_ShopLogin_Model_Resource_Shoplogin extends Mage_Core_Model_Mysql4_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ $this->_init('shoplogin/shoplogin', 'id');
22
+ }
23
+ }
24
+
25
+ ?>
app/code/community/ShopLogin/ShopLogin/controllers/CustomerController.php ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Log in with ShopLogin for Magento
4
+ * https://www.shoplogin.com/for-merchants/
5
+ * v0.9.1 for Magento
6
+ */
7
+
8
+ class ShopLogin_ShopLogin_CustomerController extends Mage_Core_Controller_Front_Action
9
+ {
10
+
11
+ protected $helper;
12
+ protected $user_basic;
13
+ protected $user_address;
14
+ protected $shoplogin_id;
15
+ protected $customer_id;
16
+ protected $customer;
17
+ protected $addresses = array();
18
+ protected $required = array();
19
+
20
+ public function LoginAction()
21
+ {
22
+ $this->helper = Mage::helper('shoplogin');
23
+ if(! ($this->helper->isEnabled() && $this->helper->getClientId() && $this->helper->getClientSecret()) )
24
+ {
25
+ $this->user_redirect(); return;
26
+ }
27
+
28
+ $attributes = Mage::getModel('customer/entity_address_attribute_collection');
29
+ foreach ($attributes as $attribute)
30
+ {
31
+ if($attribute->getIsRequired())
32
+ {
33
+ $this->required[] = $attribute->getAttributeCode();
34
+ }
35
+ }
36
+
37
+ $this->helper->init($this->helper->getClientId(),$this->helper->getClientSecret());
38
+ $this->user_basic = $this->helper->get_user_isauthorized();
39
+ if(!$this->user_basic)
40
+ {
41
+ $message = $this->__('Error: Please verify the ShopLogin configuration settings of this store.');
42
+ Mage::getSingleton('core/session')->addError($message);
43
+ $this->user_redirect(); return;
44
+ }
45
+ $this->user_address = $this->helper->get_address_fromuser("&required_fields=".implode(",", $this->required));
46
+ if(!$this->user_address->authorized)
47
+ {
48
+ $message = $this->__('Error: You could not be logged in with ShopLogin, please try again.');
49
+ Mage::getSingleton('core/session')->addError($message);
50
+ $this->user_redirect(); return;
51
+ }
52
+ $this->shoplogin_id = $this->user_basic->uid;
53
+
54
+
55
+ if($this->user_already_registered_with_shoplogin())
56
+ {
57
+ $this->user_update_connect_with_shoplogin();
58
+ $this->user_do_login();
59
+ $this->user_insert_address();
60
+ $this->user_redirect(); return;
61
+ }
62
+
63
+ if($this->user_already_registered_with_email())
64
+ {
65
+ if($this->user_address->details_history->email_confirmed)
66
+ {
67
+ $this->user_connect_with_shoplogin();
68
+ $this->user_do_login();
69
+ $this->user_insert_address();
70
+ }else
71
+ {
72
+ $message = $this->__('Error: You could not be logged in with ShopLogin, because your ShopLogin account is not confirmed. ShopLogin sent you an activiation link to your email address. Please click on the included link to activate your account.');
73
+ $message .= "&nbsp; <font style='cursor:pointer; text-decoration:underline;' onclick='shoplogin.resend_activation()'>".$this->__('Resend&nbsp;Activation&nbsp;Email')."</font>";
74
+ Mage::getSingleton('core/session')->addError($message);
75
+ $this->user_redirect(); return;
76
+ die("ShopLogin-eMail not confirmed - User with address already exists");
77
+ }
78
+ $this->user_redirect(); return;
79
+ }
80
+
81
+ // Register new User
82
+ if($this->user_create_account())
83
+ {
84
+ $this->user_connect_with_shoplogin();
85
+ $this->user_do_login();
86
+ $this->user_insert_address();
87
+ }
88
+ $this->user_redirect(); return;
89
+
90
+ }
91
+
92
+ private function user_create_account()
93
+ {
94
+ $temp = Mage::getModel('customer/customer');
95
+ $temp->setFirstname($this->user_basic->first_name);
96
+ $temp->setLastname($this->user_basic->last_name);
97
+ $temp->setEmail($this->user_basic->email);
98
+ $temp->setPassword(md5(microtime().'#'.$this->user_basic->data_token));
99
+ $temp->setIsActive(1);
100
+ $temp->setWebsiteId(Mage::app()->getWebsite()->getId());
101
+ $temp->setConfirmation(null);
102
+ $temp->save();
103
+ if($temp->getId())
104
+ {
105
+ $this->customer = $temp;
106
+ $this->customer_id = $temp->getId();
107
+ return true;
108
+ }
109
+ return false;
110
+ }
111
+
112
+ private function user_insert_address()
113
+ {
114
+ // todo
115
+ // check ob aktuelle adresse eine andere?
116
+ // wenn ja, dann adresse eingeben und als neue Standardadressen eingeben
117
+
118
+ if($this->user_address->details_history->billing_same_as_shipping)
119
+ {
120
+ $this->user_add_address($this->user_address->shipping_address, true, true);
121
+ }else
122
+ {
123
+ $this->user_add_address($this->user_address->shipping_address, true, false);
124
+ $this->user_add_address($this->user_address->billing_address, false, true);
125
+ }
126
+
127
+ }
128
+
129
+ private function user_add_address($address, $shipping, $billing)
130
+ {
131
+
132
+ $addr = array (
133
+ 'firstname' => $address->first_name,
134
+ 'lastname' => $address->last_name,
135
+ 'street' => array (
136
+ '0' => $address->line1,
137
+ '1' => $address->line2,
138
+ ),
139
+ 'city' => $address->city,
140
+ 'region_id' => $address->state_county->mag_region_id,
141
+ 'region' => $address->state_county->name,
142
+ 'postcode' => $address->zip,
143
+ 'country_id' => $address->country->code,
144
+ 'telephone' => $address->phone
145
+ );
146
+
147
+
148
+ foreach($this->required as $v)
149
+ {
150
+ if(!isset($addr[$v]) or !(trim($addr[$v]) or is_array($addr[$v])) or $addr[$v] == "0")
151
+ {
152
+ // nicht ausgefüllte Pflichtfelder automatisch mit Dummy-Wert ausfüllen
153
+ $addr[$v] = "1";
154
+ }
155
+ }
156
+
157
+ $already_added = $this->address_already_exists($addr);
158
+ if($already_added)
159
+ {
160
+ if($shipping)
161
+ {
162
+ $already_added ->setIsDefaultShipping('1');
163
+ }
164
+ if($billing)
165
+ {
166
+ $already_added->setIsDefaultBilling('1');
167
+ }
168
+ $already_added->save();
169
+ return;
170
+ }
171
+
172
+ $temp = Mage::getModel('customer/address');
173
+ $temp->setData($addr);
174
+ $temp->setCustomerId($this->customer_id);
175
+ $temp->setSaveInAddressBook('1');
176
+ if($shipping)
177
+ {
178
+ $temp->setIsDefaultShipping('1');
179
+ }
180
+ if($billing)
181
+ {
182
+ $temp->setIsDefaultBilling('1');
183
+ }
184
+ $temp->save();
185
+ }
186
+
187
+ private function address_already_exists($addr)
188
+ {
189
+ $tempaddr = Mage::getSingleton('customer/session')->getCustomer();
190
+ foreach ($tempaddr->getAddresses() as $a)
191
+ {
192
+ $tempstr = array('', '');
193
+ $tempstr2 = explode("\n", $a['street']);
194
+ $tempstr[0] = $tempstr2[0];
195
+ if(count($tempstr2) > 1)
196
+ {
197
+ $tempstr[1] = $tempstr2[1];
198
+ }
199
+
200
+ $tempar = array (
201
+ 'firstname' => $a['firstname'],
202
+ 'lastname' => $a['lastname'],
203
+ 'street' => array (
204
+ '0' => $tempstr[0],
205
+ '1' => $tempstr[1],
206
+ ),
207
+ 'city' => $a['city'],
208
+ 'region_id' => $a['region_id'],
209
+ 'region' => $a['region'],
210
+ 'postcode' => $a['postcode'],
211
+ 'country_id' => $a['country_id'],
212
+ 'telephone' => $a['telephone']
213
+ );
214
+
215
+ if($addr == $tempar)
216
+ {
217
+ return $a;
218
+ }
219
+ }
220
+ return false;
221
+ }
222
+
223
+ private function user_connect_with_shoplogin()
224
+ {
225
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
226
+ $write->insert(Mage::getSingleton('core/resource')->getTableName('shoplogin_customer'), array("customer_id" => (int)$this->customer_id, "shoplogin_id" => (int)$this->shoplogin_id, "data_token" => $this->user_basic->data_token));
227
+ }
228
+
229
+ private function user_update_connect_with_shoplogin()
230
+ {
231
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
232
+ $write->update(Mage::getSingleton('core/resource')->getTableName('shoplogin_customer'), array("customer_id" => (int)$this->customer_id, "shoplogin_id" => (int)$this->shoplogin_id, "data_token" => $this->user_basic->data_token), "customer_id='".(int)$this->customer_id."' and shoplogin_id='".(int)$this->shoplogin_id."'");
233
+ }
234
+
235
+ private function user_already_registered_with_email()
236
+ {
237
+ if($temp = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($this->user_basic->email))
238
+ {
239
+ if($temp->getId())
240
+ {
241
+ $this->customer = $temp;
242
+ $this->customer_id = $temp->getId();
243
+ return true;
244
+ }
245
+ }
246
+ return false;
247
+ }
248
+
249
+ public function user_already_registered_with_shoplogin()
250
+ {
251
+ if($temp = Mage::getModel('shoplogin/shoplogin')->load($this->shoplogin_id, 'shoplogin_id'))
252
+ {
253
+ if($temp->getCustomerId())
254
+ {
255
+ $this->customer = $temp;
256
+ $this->customer_id = $temp->getCustomerId();
257
+ return true;
258
+ }
259
+ }
260
+ return false;
261
+ }
262
+
263
+ private function user_do_login() {
264
+ $session = Mage::getSingleton('customer/session');
265
+ $temp = Mage::getModel('customer/customer')->load($this->customer_id);
266
+ if($temp->getId())
267
+ {
268
+ $session->setCustomerAsLoggedIn($temp);
269
+ }
270
+ }
271
+
272
+ private function user_redirect()
273
+ {
274
+ $session = Mage::getSingleton('customer/session');
275
+
276
+ if (isset($_GET['redirect'])) {
277
+ $redirect = base64_decode(trim($_GET['redirect']));
278
+ if ( substr_count($redirect, str_replace('https://', '', str_replace('http://', '', Mage::app()->getStore()->getBaseUrl()))) )
279
+ {
280
+ $session->setBeforeAuthUrl($redirect);
281
+ } else
282
+ {
283
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
284
+ }
285
+ }
286
+ else
287
+ {
288
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl()); die(Mage::helper('customer')->getDashboardUrl());
289
+ }
290
+ $this->_redirectUrl($session->getBeforeAuthUrl(true));
291
+ }
292
+ }
293
+ ?>
app/code/community/ShopLogin/ShopLogin/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*
4
+ * Log in with ShopLogin for Magento
5
+ * https://www.shoplogin.com/for-merchants/
6
+ * v0.9.1 for Magento
7
+ */
8
+ -->
9
+ <config>
10
+ <acl>
11
+ <resources>
12
+ <all>
13
+ <title>Allow Everything</title>
14
+ </all>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <shoplogin translate="title">
22
+ <title>ShopLogin</title>
23
+ </shoplogin>
24
+ </children>
25
+ </config>
26
+ </children>
27
+ </system>
28
+ </children>
29
+ </admin>
30
+ </resources>
31
+ </acl>
32
+ </config>
app/code/community/ShopLogin/ShopLogin/etc/config.xml ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*
4
+ * Log in with ShopLogin for Magento
5
+ * https://www.shoplogin.com/for-merchants/
6
+ * v0.9.1 for Magento
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <ShopLogin_ShopLogin>
12
+ <version>0.9.1</version>
13
+ </ShopLogin_ShopLogin>
14
+ </modules>
15
+
16
+ <global>
17
+ <models>
18
+ <shoplogin>
19
+ <class>ShopLogin_ShopLogin_Model</class>
20
+ <resourceModel>shoplogin_mysql4</resourceModel>
21
+ </shoplogin>
22
+ <shoplogin_mysql4>
23
+ <class>ShopLogin_ShopLogin_Model_Resource</class>
24
+ <entities>
25
+ <shoplogin>
26
+ <table>shoplogin_customer</table>
27
+ </shoplogin>
28
+ </entities>
29
+ </shoplogin_mysql4>
30
+ </models>
31
+
32
+ <resources>
33
+ <shoplogin_setup>
34
+ <setup>
35
+ <module>ShopLogin_ShopLogin</module>
36
+ </setup>
37
+ <connection>
38
+ <use>core_setup</use>
39
+ </connection>
40
+ </shoplogin_setup>
41
+ <shoplogin_write>
42
+ <connection>
43
+ <use>core_write</use>
44
+ </connection>
45
+ </shoplogin_write>
46
+ <shoplogin_read>
47
+ <connection>
48
+ <use>core_read</use>
49
+ </connection>
50
+ </shoplogin_read>
51
+ </resources>
52
+
53
+ <blocks>
54
+ <shoplogin>
55
+ <class>ShopLogin_ShopLogin_Block</class>
56
+ </shoplogin>
57
+ </blocks>
58
+
59
+ <helpers>
60
+ <shoplogin>
61
+ <class>ShopLogin_ShopLogin_Helper</class>
62
+ </shoplogin>
63
+ </helpers>
64
+ </global>
65
+
66
+ <frontend>
67
+ <routers>
68
+ <shoplogin>
69
+ <use>standard</use>
70
+ <args>
71
+ <module>ShopLogin_ShopLogin</module>
72
+ <frontName>shoplogin</frontName>
73
+ </args>
74
+ </shoplogin>
75
+ </routers>
76
+
77
+ <translate>
78
+ <modules>
79
+ <ShopLogin_ShopLogin>
80
+ <files>
81
+ <default>ShopLogin_ShopLogin.csv</default>
82
+ </files>
83
+ </ShopLogin_ShopLogin>
84
+ </modules>
85
+ </translate>
86
+
87
+ <layout>
88
+ <updates>
89
+ <shoplogin>
90
+ <file>shoplogin.xml</file>
91
+ </shoplogin>
92
+ </updates>
93
+ </layout>
94
+ </frontend>
95
+
96
+ <default>
97
+ <shoplogin>
98
+ <settings>
99
+ <enabled>0</enabled>
100
+ </settings>
101
+ </shoplogin>
102
+ </default>
103
+ </config>
app/code/community/ShopLogin/ShopLogin/etc/system.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*
4
+ * Log in with ShopLogin for Magento
5
+ * https://www.shoplogin.com/for-merchants/
6
+ * v0.9.1 for Magento
7
+ */
8
+ -->
9
+ <config>
10
+ <sections>
11
+ <shoplogin translate="label">
12
+ <label>ShopLogin</label>
13
+ <tab>customer</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1000</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
+ <groups>
20
+ <settings translate="label">
21
+ <label>General Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>100</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
+ <comment>
28
+ </comment>
29
+ <fields>
30
+ <clientid translate="label">
31
+ <label>App ID</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>20</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </clientid>
38
+ <clientsecret translate="label">
39
+ <label>Client Secret</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>30</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
+ </clientsecret>
46
+ </fields>
47
+ </settings>
48
+ <settings_loginwith translate="label">
49
+ <label>Login with ShopLogin</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>101</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>
56
+ </comment>
57
+ <fields>
58
+ <enabled translate="label">
59
+ <label>Enabled</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </enabled>
67
+ </fields>
68
+ </settings_loginwith>
69
+ <settings_wishlist translate="label">
70
+ <label>Wishlist by ShopLogin</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>102</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <comment>
77
+ </comment>
78
+ <fields>
79
+ <enabled translate="label">
80
+ <label>Enabled</label>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
83
+ <sort_order>10</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </enabled>
88
+ </fields>
89
+ </settings_wishlist>
90
+ </groups>
91
+ </shoplogin>
92
+ </sections>
93
+ </config>
app/code/community/ShopLogin/ShopLogin/sql/shoplogin_setup/mysql4-install-0.9.1.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Log in with ShopLogin for Magento
4
+ * https://www.shoplogin.com/for-merchants/
5
+ * v0.9.1 for Magento
6
+ */
7
+
8
+ $installer = $this;
9
+ $installer->startSetup();
10
+
11
+ $installer->run("
12
+ CREATE TABLE IF NOT EXISTS {$this->getTable('shoplogin_customer')} (
13
+ `customer_id` int(11) NOT NULL,
14
+ `shoplogin_id` int(11) NOT NULL,
15
+ `data_token` VARCHAR( 74 ) NOT NULL,
16
+ UNIQUE KEY `customer_id` (`customer_id`),
17
+ UNIQUE KEY `shoplogin_id` (`shoplogin_id`)
18
+ ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
19
+ ");
20
+
21
+ $installer->endSetup();
22
+ ?>
app/design/frontend/base/default/layout/shoplogin.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*
4
+ * Log in with ShopLogin for Magento
5
+ * https://www.shoplogin.com/for-merchants/
6
+ * v0.9.1 for Magento
7
+ */
8
+ -->
9
+ <layout version="0.9.1">
10
+ <customer_account_login translate="label">
11
+ <reference name="content">
12
+ <block type="core/template" name="shoplogin.login.button" template="shoplogin/button.phtml" after="customer_form_login" />
13
+ </reference>
14
+ </customer_account_login>
15
+
16
+ <checkout_onepage_index translate="label">
17
+ <reference name="checkout.onepage.login">
18
+ <action method="setTemplate">
19
+ <template>shoplogin/checkout_login.phtml</template>
20
+ </action>
21
+ </reference>
22
+ </checkout_onepage_index>
23
+
24
+ <default translate="label">
25
+ <reference name="before_body_end">
26
+ <block type="shoplogin/default" after="-" name="shoplogin.footer" template="shoplogin/footer.phtml" />
27
+ </reference>
28
+ <reference name="head">
29
+ <block type="shoplogin/default" name="shoplogin.header" template="shoplogin/header.phtml" />
30
+ </reference>
31
+ </default>
32
+
33
+ <catalog_product_view translate="label">
34
+ <reference name="head">
35
+ <block type="shoplogin/default" after="shoplogin.header" name="shoplogin.product_header" template="shoplogin/product_header.phtml" />
36
+ </reference>
37
+ <reference name="product.info.addtocart">
38
+ <block type="shoplogin/default" name="shoplogin.add_wishlist_button" template="shoplogin/add_wishlist_button.phtml" />
39
+ </reference>
40
+ </catalog_product_view>
41
+
42
+ <checkout_onepage_success>
43
+ <reference name="content">
44
+ <block type="shoplogin/default" name="shoplogin.checkout_success" template="shoplogin/checkout_success.phtml"/>
45
+ </reference>
46
+ </checkout_onepage_success>
47
+
48
+ </layout>
app/design/frontend/base/default/template/shoplogin/add_wishlist_button.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if(Mage::getStoreConfig('shoplogin/settings_wishlist/enabled') && Mage::registry('current_product')) : ?>
2
+ <br><br><div class="shoplogin-wishlist" what-is="true" data-href="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getProductUrl())); ?>"></div>
3
+ <?php endif;?>
app/design/frontend/base/default/template/shoplogin/button.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?Php
2
+ if(Mage::getStoreConfig('shoplogin/settings_loginwith/enabled') && Mage::getStoreConfig('shoplogin/settings/clientid') && Mage::getStoreConfig('shoplogin/settings/clientsecret'))
3
+ {
4
+ ?>
5
+
6
+ <br>
7
+ <div class="col2-set account-login">
8
+ <div class="buttons-set">
9
+
10
+ <div class="shoplogin-button" onclick="account_loginwithshoplogin()" what-is="true" style="float:right"></div>
11
+ <div style="float:right; line-height:41px; font-weight:bold;"><?php echo $this->__('TIP: For easy Registration and Login we recommend:'); ?>&nbsp;&nbsp;&nbsp;</div>
12
+
13
+ </div>
14
+ </div>
15
+
16
+ <script language="JavaScript" type="text/javascript">
17
+
18
+ function account_loginwithshoplogin()
19
+ {
20
+
21
+ shoplogin.dialog_login("login",
22
+ function(response)
23
+ {
24
+ if(response && response.authorized)
25
+ {
26
+
27
+
28
+ document.location.href="<?php echo $this->getUrl('shoplogin/customer/login')?>?redirect=<?php echo base64_encode($this->helper('core/url')->getCurrentUrl())?>";
29
+
30
+
31
+ }
32
+
33
+ }
34
+ );
35
+
36
+ }
37
+
38
+ </script>
39
+
40
+ <?php
41
+ }
42
+ ?>
app/design/frontend/base/default/template/shoplogin/checkout_button.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?Php
2
+ if(Mage::getStoreConfig('shoplogin/settings_loginwith/enabled') && Mage::getStoreConfig('shoplogin/settings/clientid') && Mage::getStoreConfig('shoplogin/settings/clientsecret'))
3
+ {
4
+ ?>
5
+
6
+ <br>
7
+ <div class="col2-set">
8
+ <div class="buttons-set">
9
+
10
+ <div class="shoplogin-button" onclick="checkout_loginwithshoplogin()" what-is="true" style="float:right"></div>
11
+ <div style="float:right; line-height:41px; font-weight:bold;"><?php echo $this->__('TIP: For easy Registration and Login we recommend:'); ?>&nbsp;&nbsp;&nbsp;</div>
12
+
13
+ </div>
14
+ </div>
15
+
16
+ <script language="JavaScript" type="text/javascript">
17
+
18
+ function checkout_loginwithshoplogin()
19
+ {
20
+
21
+ shoplogin.dialog_login("address",
22
+ function(response)
23
+ {
24
+ if(response && response.authorized)
25
+ {
26
+
27
+
28
+ document.location.href="<?php echo $this->getUrl('shoplogin/customer/login')?>?redirect=<?php echo base64_encode($this->helper('core/url')->getCurrentUrl())?>";
29
+
30
+
31
+ }
32
+
33
+ }
34
+ );
35
+
36
+ }
37
+
38
+ </script>
39
+
40
+ <?php
41
+ }
42
+ ?>
app/design/frontend/base/default/template/shoplogin/checkout_login.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $orig = $this->getTemplate();
3
+
4
+ // Load original template
5
+ $this->setTemplate('persistent/checkout/onepage/login.phtml');
6
+ echo $this->fetchView($this->getTemplateFile());
7
+
8
+ // append LWA Button
9
+ $this->noclass=1;
10
+ $this->setTemplate('shoplogin/checkout_button.phtml');
11
+ echo $this->fetchView($this->getTemplateFile());
12
+
13
+ $this->setTemplate($orig); // reset
14
+ ?>
app/design/frontend/base/default/template/shoplogin/checkout_success.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $customerid = Mage::getSingleton('customer/session')->getCustomerId();
3
+ $lastorderid = Mage::getSingleton('checkout/session')->getLastOrderId();
4
+ $order = Mage::getSingleton('sales/order');
5
+ $order->load($lastorderid);
6
+
7
+ $ordernumber = $order->getIncrementId();
8
+ $totalamount = $order->getGrandTotal();
9
+ $subamount = $order->getSubtotal();
10
+ $currency = Mage::app()->getStore()->getCurrentCurrencyCode();
11
+ $shipping = $order->getShippingAmount();
12
+ $tax = $order->getTaxAmount();
13
+
14
+ $data_token = Mage::getModel('shoplogin/shoplogin')->load($customerid, 'customer_id');
15
+ $data_token = $data_token->data_token;
16
+ ?>
17
+ <script>
18
+ // minimum data
19
+ shoplogin_submit_order = new Object();
20
+ shoplogin_submit_order.order_number = '<?php echo $ordernumber; ?>';
21
+ shoplogin_submit_order.data_token = '<?Php echo $data_token; ?>';
22
+
23
+ // standard order data
24
+ shoplogin_submit_order.amount_currency = '<?Php echo $currency; ?>';
25
+ shoplogin_submit_order.amount_total = '<?php echo $totalamount; ?>';
26
+ shoplogin_submit_order.amount_items = '<?php echo $subamount; ?>';
27
+ shoplogin_submit_order.amount_shipping = '<?Php echo $shipping; ?>';
28
+ shoplogin_submit_order.amount_tax = '<?Php echo $tax; ?>';
29
+ shoplogin_submit_order.customer_id = '<?php echo $customerid; ?>';
30
+
31
+ // affiliate, set to "true" if order is not eligible for ShopLogin-Affiliate
32
+ // e.g. if you set up a tracking switch and the traffic came from a different affiliate network
33
+ shoplogin_submit_order.affiliate_trackingswitch_noprovision = false;
34
+
35
+ <?php
36
+ // order data (submit only if user is logined or tracking-plus is activated)
37
+ if($this->getIsUserConnected() || $this->TrackingPlusisEnabled)
38
+ {
39
+ ?>
40
+ // order data
41
+ shoplogin_submit_order.shoplogin_uid = '<?php echo $is_user_connected; ?>';
42
+ shoplogin_submit_order.shopping_cart = new Array();
43
+ <?php
44
+ $z = 0;
45
+ foreach($order->getAllItems() as $items)
46
+ {
47
+ $product = Mage::getModel('catalog/product')->load($items->getProductId());
48
+ ?>
49
+
50
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>] = new Object();
51
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>].url = '<?php echo addslashes(strip_tags(str_replace('\r', '', str_replace('\n', '', $product->getProductUrl())))); ?>';
52
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>].name = '<?php echo addslashes(strip_tags(str_replace('\r', '', str_replace('\n', '', $items->getName())))); ?>';
53
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>].product_id = '<?php echo addslashes(strip_tags(str_replace('\r', '', str_replace('\n', '', $items->getProductId())))); ?>';
54
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>].quantity = '<?php echo addslashes(strip_tags(str_replace('\r', '', str_replace('\n', '', $items->getQtyToInvoice())))); ?>';
55
+ shoplogin_submit_order.shopping_cart[<?php echo $z; ?>].price = '<?php echo addslashes(strip_tags(str_replace('\r', '', str_replace('\n', '', Mage::helper('core')->formatCurrency( $items->getPrice() ) )))); ?>';
56
+ <?php
57
+ $z++;
58
+ }
59
+ }
60
+ ?>
61
+ </script>
62
+
app/design/frontend/base/default/template/shoplogin/footer.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="shoplogin-root"></div>
2
+ <script language="JavaScript" type="text/javascript">
3
+ window.shoploginasyncinit = function() {
4
+ shoplogin.init({
5
+ appid : '<?php echo $this->getClientId(); ?>',
6
+ version : 'magento-<?php echo Mage::getConfig()->getModuleConfig("ShopLogin_ShopLogin")->version; ?>',
7
+ language : '<?php echo Mage::app()->getLocale()->getDefaultLocale(); ?>'
8
+ });
9
+ };
10
+
11
+ (function(d, s, id){
12
+ var js, fjs = d.getElementsByTagName(s)[0];
13
+ if (d.getElementById(id)) {return;}
14
+ js = d.createElement(s); js.id = id;
15
+ js.src = "//connect.shoplogin.com/connect.js"
16
+ fjs.parentNode.insertBefore(js, fjs);
17
+ }(document, 'script', 'shoplogin-connect'));
18
+ </script>
app/design/frontend/base/default/template/shoplogin/header.phtml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <meta property="shoplogin:version" content="magento-<?php echo Mage::getConfig()->getModuleConfig("ShopLogin_ShopLogin")->version; ?>" />
2
+ <meta property="shoplogin:appid" content="<?php echo $this->getClientId(); ?>" />
app/design/frontend/base/default/template/shoplogin/product_header.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::registry('current_product')) : ?>
2
+ <meta property="shoplogin:article_url" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getProductUrl())); ?>" />
3
+ <meta property="shoplogin:article_name" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getName())); ?>" />
4
+ <meta property="shoplogin:article_product_id" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getId())); ?>" />
5
+ <meta property="shoplogin:article_description" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getShortDescription())); ?>" />
6
+ <meta property="shoplogin:article_image" content="<?php echo str_replace('"', '&quot;', strip_tags(Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'image'))); ?>" />
7
+ <meta property="shoplogin:article_price" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::helper('core')->formatCurrency(Mage::registry('current_product')->getFinalPrice()))); ?>" />
8
+ <meta property="shoplogin:article_sku" content="<?php echo str_replace('"', '&quot;', strip_tags( Mage::registry('current_product')->getSku())); ?>" />
9
+ <meta property="shoplogin:article_instock" content="<?php echo (int)Mage::registry('current_product')->isSaleable(); ?>" />
10
+ <?php endif;?>
app/etc/modules/ShopLogin_ShopLogin.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*
4
+ * Log in with ShopLogin for Magento
5
+ * https://www.shoplogin.com/for-merchants/
6
+ * v0.9.1 for Magento
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <ShopLogin_ShopLogin>
12
+ <active>true</active>
13
+ <codePool>community</codePool>
14
+ <version>0.9.1</version>
15
+ </ShopLogin_ShopLogin>
16
+ </modules>
17
+ </config>
app/locale/de_DE/ShopLogin_ShopLogin.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ "TIP: For easy Registration and Login we recommend:","TIPP: Verwenden Sie f&uuml;r bequemes Registrieren und Anmelden:"
2
+ "Error: You could not be logged in with ShopLogin, because your ShopLogin account is not confirmed. ShopLogin sent you an activiation link to your email address. Please click on the included link to activate your account.", "Fehler: Sie konnten nicht mit ShopLogin angemeldet werden, da Ihr Shoplogin-Account nicht bestätigt wurde. ShopLogin hat Ihnen einen Aktivierungslink per E-Mail geschickt. Bitte klicken Sie auf den enthaltenen Link um Ihr Konto zu aktivieren."
3
+ "Resend&nbsp;Activation&nbsp;Email", "Aktivierungs-eMail&nbsp;erneut&nbsp;senden"
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ShopLogin_ShopLogin</name>
4
+ <version>0.9.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Basis Extension for ShopLogin including the Plugins "Log in with ShopLogin" and "ShopLogin global Wish List".</summary>
10
+ <description>This Extension is the Basis Extension for ShopLogin.&#xD;
11
+ It includes the Plugins "Log in with ShopLogin" and "ShopLogin global Wish List".&#xD;
12
+ &#xD;
13
+ More Comfort for your Customers.&#xD;
14
+ Better Usability. Higher Conversion Rate.&amp;#xD;&#xD;
15
+ Visit https://www.shoplogin.com/for-merchants/ for more informations and technical details.&#xD;
16
+ &#xD;
17
+ Register your Online Store (https://www.shoplogin.com/en/account/merchant/) and insert your App-ID and App Secret in the "ShopLogin"-Tab in your Magento configuration panel. After that you can easily activate the ShopLogin-Features.</description>
18
+ <notes>Basis Extension for ShopLogin including the Plugins "Log in with ShopLogin" and "ShopLogin global Wish List".</notes>
19
+ <authors><author><name>Shoplogin</name><user>ShopLogin</user><email>developers@shoplogin.com</email></author></authors>
20
+ <date>2014-08-04</date>
21
+ <time>01:35:00</time>
22
+ <contents><target name="magecommunity"><dir name="ShopLogin"><dir name="ShopLogin"><dir name="Block"><file name="Default.php" hash="aeb330326b940ae22216bca7bb523ebc"/></dir><dir name="controllers"><file name="CustomerController.php" hash="de602d16728b7ffa59e0ac122ebd220f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6c509d882d0e17084a1796d34e0e3f35"/><file name="config.xml" hash="a1f669649b5a973e7db0a5bea34281b0"/><file name="system.xml" hash="a452dea449525f4aea5898c9184d3ad0"/></dir><dir name="Helper"><file name="Data.php" hash="8ec899a6f392613ceef416be5cda1759"/></dir><dir name="Model"><file name="Shoplogin.php" hash="ca07181f612231d33e7e986678a3a460"/></dir><dir name="sql"><dir name="shoplogin_setup"><file name="mysql4-install-0.9.1.php" hash="a629494dfbe4a56189293c26ad39e117"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ShopLogin_ShopLogin.xml" hash="962ffd2bbf33a9a3ad86db93f3a5ce62"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="ShopLogin_ShopLogin.csv" hash="23ff0831c86652c987a1cabf8571376b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shoplogin.xml" hash="08df1896255090d0394a4b98f5979dbd"/></dir><dir name="template"><dir name="shoplogin"><file name="add_wishlist_button.phtml" hash="0611c3d710fc785f33e02bf8fe014c14"/><file name="button.phtml" hash="6014e749e66dc0eddb17ff6be33c0ebf"/><file name="checkout_button.phtml" hash="5be2b6c9554ba6b7b31dc07ba54466d6"/><file name="checkout_login.phtml" hash="26ccf5a880642ba022aa996ef2279bac"/><file name="checkout_success.phtml" hash="25a9e74b116623cf9b3af5e63bd5e06d"/><file name="footer.phtml" hash="9d8823be096d8b13288e0be23c04b956"/><file name="header.phtml" hash="dbc5caf220c55aa6db217e0e5313103b"/><file name="product_header.phtml" hash="7e82d0c7c30fdcc4782317395782d251"/></dir></dir></dir></dir></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies><required><php><min>5.1.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.1</max></package><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
25
+ </package>