LetsSyncroLLC_Oct8ne - Version 2.0.0

Version Notes

Minor bugs fixed

Download this release

Release Info

Developer Oct8ne
Extension LetsSyncroLLC_Oct8ne
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.2.0 to 2.0.0

Files changed (44) hide show
  1. app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php +248 -336
  2. app/code/community/LetsSyncroLLC/Oct8ne/Block/Html/Head.php +20 -16
  3. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Customer/Data.php +0 -80
  4. app/code/community/LetsSyncroLLC/Oct8ne/Helper/CustomerData.php +44 -0
  5. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php +285 -176
  6. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Image.php +32 -0
  7. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Url.php +46 -25
  8. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Version.php +13 -0
  9. app/code/community/LetsSyncroLLC/Oct8ne/Helper/Wishlist.php +46 -72
  10. app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Request.php +28 -29
  11. app/code/community/LetsSyncroLLC/Oct8ne/Model/Observer.php +68 -165
  12. app/code/community/LetsSyncroLLC/Oct8ne/controllers/FrameController.php +310 -665
  13. app/code/community/LetsSyncroLLC/Oct8ne/controllers/letssyncro.phtml +0 -41
  14. app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml +78 -98
  15. app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml.bak +0 -263
  16. app/code/community/LetsSyncroLLC/Oct8ne/etc/system.xml +7 -18
  17. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-0.5.0.php +0 -32
  18. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-1.0.0.php +0 -32
  19. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-2.0.0.php +83 -0
  20. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.0.0-1.1.0.php +1 -1
  21. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.1.6-1.1.7.php +1 -1
  22. app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-2.0.0.php +6 -0
  23. app/design/frontend/base/default/layout/oct8ne.xml +129 -170
  24. app/design/frontend/base/default/template/oct8ne/frame/add2cart.phtml +0 -16
  25. app/design/frontend/base/default/template/oct8ne/frame/addtowishlist.phtml +0 -10
  26. app/design/frontend/base/default/template/oct8ne/frame/customer/data.phtml +0 -75
  27. app/design/frontend/base/default/template/oct8ne/frame/customer/getversion.phtml +0 -9
  28. app/design/frontend/base/default/template/oct8ne/frame/customer/notifier.phtml +0 -6
  29. app/design/frontend/base/default/template/oct8ne/frame/getcart.phtml +0 -40
  30. app/design/frontend/base/default/template/oct8ne/frame/getreportdata.phtml +0 -1
  31. app/design/frontend/base/default/template/oct8ne/frame/getversion.phtml +0 -5
  32. app/design/frontend/base/default/template/oct8ne/frame/getwishlist.phtml +0 -41
  33. app/design/frontend/base/default/template/oct8ne/frame/json-page.phtml +0 -1
  34. app/design/frontend/base/default/template/oct8ne/frame/loginpost.phtml +0 -8
  35. app/design/frontend/base/default/template/oct8ne/frame/naked-page.phtml +0 -18
  36. app/design/frontend/base/default/template/oct8ne/frame/productinfo.phtml +0 -36
  37. app/design/frontend/base/default/template/oct8ne/frame/productrelated.phtml +0 -52
  38. app/design/frontend/base/default/template/oct8ne/frame/productview-FROM-SCRATCH.phtml +0 -121
  39. app/design/frontend/base/default/template/oct8ne/frame/removefromwishlist.phtml +0 -10
  40. app/design/frontend/base/default/template/oct8ne/frame/search.phtml +0 -70
  41. app/design/frontend/base/default/template/oct8ne/letssyncro.phtml +60 -75
  42. app/etc/modules/LetsSyncroLLC_Oct8ne.xml +1 -1
  43. app/locale/es_ES/LetsSyncroLLC_Oct8ne.csv +38 -38
  44. package.xml +18 -232
app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php CHANGED
@@ -1,122 +1,103 @@
1
  <?php
2
- class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
3
- {
4
- private $letssyncromodel;
5
- private $_html = '';
6
-
7
- protected function _toHtml()
8
- {
9
- $submitLetsSyncroCredentials = $this->getRequest()->getParam('submitLetsSyncroCredentials');
10
- $submitLetsSyncroSettings = $this->getRequest()->getParam('submitLetsSyncroSettings');
11
-
12
- $letssyncromodel = Mage::getModel('oct8ne/letssyncro')->load(1);
13
- $letssyncrooptions = $letssyncromodel->_data;
14
-
15
- if (isset($submitLetsSyncroCredentials))
16
- {
17
- $letssyncro_useremail = $this->getRequest()->getParam('letssyncro_useremail');
18
- $letssyncro_password = $this->getRequest()->getParam('letssyncro_password');
19
-
20
- if (empty($letssyncro_useremail)) {
21
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('The field (Email) cannot be empty.').'</div></li></ul></li></ul><br></div>';
22
- } elseif (empty($letssyncro_password)) {
23
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('The field (Password) cannot be empty.').'</div></li></ul></li></ul><br></div>';
24
- } elseif (!$this->updateLetsSyncroUserPassword($letssyncrooptions,$letssyncromodel,$letssyncro_useremail,$letssyncro_password)) {
25
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('There was an error on your credentials and cannot obtain OCT8NE integration data.').'</div></li></ul></li></ul><br></div>';
26
- } elseif (!$this->updateLetsSyncroEnabled('1',$letssyncrooptions,$letssyncromodel)) {
27
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('There was an error activating OCT8NE integration.').'</div></li></ul></li></ul><br></div>';
28
- } else {
29
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">'.$this->__('OCT8NE integration data obtained successfully!').'</div></li></ul></li></ul><br></div>';
30
- }
31
-
32
- $letssyncromodel->save();
33
- }
34
-
35
- if (isset($_GET['deactivate']) && !isset($submitLetsSyncroCredentials))
36
- {
37
- if (!$this->updateLetsSyncroEnabled('0',$letssyncrooptions,$letssyncromodel))
38
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('There was an error deactivating OCT8NE integration.').'</div></li></ul></li></ul><br></div>';
39
- else
40
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">'.$this->__('OCT8NE integration deactivated successfully!').'</div></li></ul></li></ul><br></div>';
41
-
42
- $letssyncromodel->save();
43
- }
44
-
45
- if (isset($_GET['activate']) && !isset($submitLetsSyncroCredentials))
46
- {
47
- if (!$this->updateLetsSyncroEnabled('1',$letssyncrooptions,$letssyncromodel))
48
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('There was an error activating OCT8NE integration.').'</div></li></ul></li></ul><br></div>';
49
- else
50
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">'.$this->__('OCT8NE integration activated successfully!').'</div></li></ul></li></ul><br></div>';
51
-
52
- $letssyncromodel->save();
53
- }
54
-
55
- if (isset($submitLetsSyncroSettings))
56
- {
57
- $letssyncro_urlapi = $this->getRequest()->getParam('letssyncro_urlapi');
58
-
59
- if (empty($letssyncro_urlapi))
60
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('The field (URL API) cannot be empty.').'</div></li></ul></li></ul><br></div>';
61
- elseif (!$this->updateLetsSyncroAPIToken($letssyncrooptions,$letssyncromodel) OR
62
- !$this->updateLetsSyncroLicenseID($letssyncrooptions,$letssyncromodel) OR
63
- !$this->updateLetsSyncroSyncroSettings($letssyncrooptions,$letssyncromodel))
64
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('There was an error saving your settings.').'</div></li></ul></li></ul><br></div>';
65
- elseif(!$this->updateLetsSyncroEnabled('1',$letssyncrooptions,$letssyncromodel))
66
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$this->__('The fields (License ID and API token) are invalid.').'</div></li></ul></li></ul><br></div>';
67
- else
68
- $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">'.$this->__('Settings updated successfully.').'</div></li></ul></li></ul><br></div>';
69
-
70
- $letssyncromodel->save();
71
- }
72
-
73
- $this->_html .= '
74
- <script type="text/javascript">
75
- function submitAccountSetup() {
76
- var passw = document.getElementById(\'letssyncro_password\').value;
77
- document.getElementById(\'submitLetsSyncroCredentials\').style.display = "none";
78
- document.getElementById(\'executing\').style.display = "block";
79
- document.getElementById(\'letssyncro_password\').value = Base64.encode(passw);
80
- document.getElementById(\'generalsettings\').submit();
81
- }
82
- </script>
83
- <link href="'.Mage::getStoreConfig('web/unsecure/base_url').'/app/design/adminhtml/default/default/template/oct8ne/letssyncro.css" rel="stylesheet" type="text/css" />
84
- <script type="text/javascript" src="'.Mage::getStoreConfig('web/unsecure/base_url').'/app/design/adminhtml/default/default/template/oct8ne/letssyncro.js"></script>
85
- <div class="content-header">
86
- <p><img src="'.$this->getSkinUrl('images/LetsSyncro_Logo.png').'" alt="Oct8ne" title="Oct8ne" /></p>
87
- </div>
88
- <div class="entry-edit">
89
- <div class="entry-edit-head collapseable">
90
- <div class="section-config active">
91
- <div class="entry-edit-head collapseable">
92
- <a id="letssyncro_setup-head" class="open" onclick="Fieldset.toggleCollapse(\'letssyncro_setup\', \'\'); return false;" href="#">'.$this->__('Account Setup').'</a>
93
- </div>
94
- <input type="hidden" value="1" name="config_state[letssyncro_setup]" id="letssyncro_setup-state">
95
- </div>
96
- </div>';
97
-
98
- $letssyncrooptions = $letssyncromodel->_data;
99
- $currentUrl_idx = strrpos($this->helper('core/url')->getCurrentUrl(), '/', -1);
100
- $currentUrl_ex = strlen(substr($this->helper('core/url')->getCurrentUrl(), $currentUrl_idx));
101
- $currentUrl = substr($this->helper('core/url')->getCurrentUrl(), 0, strlen($this->helper('core/url')->getCurrentUrl())-$currentUrl_ex);
102
-
103
- $linked_literal_deact = '<p class="LetsSyncro">'.$this->__('Status:').' <img src="'.$this->getSkinUrl('images/fam_bullet_success.gif').'" alt="'.$this->__('Enabled').'" title="'.$this->__('Enabled').'" />
104
- <a href="'.str_replace('/?activate', '', $currentUrl).'/?deactivate">'.$this->__('(Deactivate)').'</a></p>
105
- <p class="LetsSyncro">'.$this->__('Linked account:').' <strong>'.$letssyncrooptions['email'].'</strong></p><br />';
106
- $linked_literal_act = '<p class="LetsSyncro">'.$this->__('Status:').' <img src="'. $this->getSkinUrl('images/error_msg_icon.gif') .'" alt="'.$this->__('Disabled').'" title="'.$this->__('Disabled').'" />
107
- <a href="'.str_replace('/?deactivate', '', $currentUrl).'/?activate">'.$this->__('(Activate)').'</a></p>
108
- <p class="LetsSyncro">'.$this->__('Linked account:').' <strong>'.$letssyncrooptions['email'].'</strong></p><br />';
109
-
110
- $this->_html .= '
111
- <form method="get" action="'.$currentUrl.'/" id="generalsettings" name="generalsettings" style="display:'.((!isset($_GET['letssyncro_account']) && !isset($_GET['letssyncro_syncro'])) || (isset($_GET['letssyncro_account'])) ? 'block;' : 'none;').'" >
112
  <fieldset class="config collapseable" id="letssyncro_setup">';
113
- if($letssyncrooptions['licenseid'] != '' && $letssyncrooptions['enabled'] == '0')
114
  $this->_html .= str_replace('&amp;activate', '', $linked_literal_act);
115
- elseif($letssyncrooptions['licenseid'] != '' && $letssyncrooptions['enabled'] == '1')
116
  $this->_html .= str_replace('&amp;deactivate', '', $linked_literal_deact);
117
 
118
- $this->_html .= '
119
- <legend>'.$this->__('Account Setup').'</legend>
120
  <table cellspacing="0" class="form-list">
121
  <colgroup class="label"></colgroup>
122
  <colgroup class="value"></colgroup>
@@ -124,30 +105,30 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
124
  <tbody>
125
  <tr id="row_letssyncro_setup_email">
126
  <td class="label">
127
- <label for="letssyncro_useremail">'.$this->__('Email:').'</label>
128
  </td>
129
  <td class="value">
130
- <input type="text" class="validate-email input-text required-entry" name="letssyncro_useremail" id="letssyncro_useremail" value="'.(($this->error AND isset($_POST['letssyncro_useremail'])) ? $_POST['letssyncro_useremail'] : $letssyncrooptions['email']).'" />
131
- <p class="note"><span>'.$this->__('Oct8ne email').'</span></p>
132
- <div id="advice-validate-email-letssyncro_useremail" class="validation-advice" style="display:none;">'.$this->__('Please, write a valid email address. For example jdoe@domain.com').'</div>
133
  </td>
134
  <td class=""></td>
135
  </tr>
136
  <tr id="row_letssyncro_setup_password">
137
  <td class="label">
138
- <label for="letssyncro_password">'.$this->__('Password:').'</label>
139
  </td>
140
  <td class="value">
141
- <input type="password" class="input-text required-entry" name="letssyncro_password" id="letssyncro_password" value="'.(($this->error AND isset($_POST['letssyncro_password'])) ? $_POST['letssyncro_password'] : $this->urlsafe_b64decode($letssyncrooptions['password'])).'" />
142
- <p class="note"><span>'.$this->__('Oct8ne password').'</span></p>
143
  </td>
144
  <td class=""></td>
145
  </tr>
146
  <tr id="row_letssyncro_setup_linkup">
147
  <td class="label"></td>
148
  <td class="value" style="height:21px;">
149
- <img id="executing" src="'.Mage::getStoreConfig('web/unsecure/base_url').'/app/design/adminhtml/default/default/template/oct8ne/loading.gif" alt="'.$this->__('Executing...').'" title="LetsSyncro" style="display:none;padding-left:15px;padding-top:2px;" />
150
- <button type="button" id="submitLetsSyncroCredentials" onClick="submitAccountSetup();" class="scalable save" ><span>'.$this->__('Link Up').'</span></button>
151
  <input type="hidden" name="submitLetsSyncroCredentials" id="submitLetsSyncroCredentials" value="ok" />
152
  </td>
153
  <td class=""></td>
@@ -155,224 +136,155 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
155
  </tbody>
156
  </table>
157
  <br />
158
- <p class="LetsSyncro">'.$this->__('Don\'t have a OCT8NE account?').' <a href="https://secure.oct8ne.com/signup?planselected=platform" target="_blank">'.$this->__('Sign up now').'</a></p>
159
  </fieldset>
160
  </form><br />';
161
- $this->_html .= '
162
- <form method="get" action="'.$currentUrl.'/" id="advancedsettings" name="advancedsettings" style="display:none;">
163
- <fieldset>
164
- <legend>'.$this->__('Advanced settings').'</legend>
165
- <label>'.$this->__('Enabled:').'</label>
166
- <div class="margin-form">
167
- <input type="radio" name="letssyncro_enabled" id="on" value="1" '.($letssyncrooptions['enabled'] ? 'checked="checked" ' : '').'/>
168
- <label class="t" for="display_on"> <img src="'.Mage::getStoreConfig('web/unsecure/base_url').'/app/design/adminhtml/default/default/template/oct8ne/enabled.gif" alt="'.$this->__('Enabled').'" title="'.$this->__('Enabled').'" /></label>
169
- <input type="radio" name="letssyncro_enabled" id="off" value="0" '.(!$letssyncrooptions['enabled'] ? 'checked="checked" ' : '').'/>
170
- <label class="t" for="display_off"> <img src="'.Mage::getStoreConfig('web/unsecure/base_url').'/app/design/adminhtml/default/default/template/oct8ne/disabled.gif" alt="'.$this->__('Disabled').'" title="'.$this->__('Disabled').'" /></label>
171
- <p class="clear">'.$this->__('Enable the integration with OCT8NE').'</p>
172
- </div>
173
- <label>'.$this->__('User License ID:').'</label>
174
- <div class="margin-form">
175
- <input type="text" class="LetsSyncro" name="letssyncro_licenseid" id="letssyncro_licenseid" size="60" maxlength="32" value="'.(($this->error AND isset($_POST['letssyncro_licenseid'])) ? $_POST['letssyncro_licenseid'] : $letssyncrooptions['licenseid']).'" readonly />
176
- <!-- <p class="clear">'.$this->__('32 characters length LetsSyncro User License ID').'</p> -->
177
- </div>
178
- <label>'.$this->__('API Token:').'</label>
179
- <div class="margin-form">
180
- <input type="text" class="LetsSyncro" name="letssyncro_apitoken" id="letssyncro_apitoken" size="60" maxlength="32" value="'.(($this->error AND isset($_POST['letssyncro_apitoken'])) ? $_POST['letssyncro_apitoken'] : $letssyncrooptions['apitoken']).'" readonly />
181
- <!-- <p class="clear">'.$this->__('32 characters length LetsSyncro API Token').'</p> -->
182
- </div>
183
- <label>'.$this->__('URL API:').'</label>
184
- <div class="margin-form"">
185
- <input type="text" name="letssyncro_urlapi" id="letssyncro_urlapi" size="40" value="'.(($this->error AND isset($_POST['letssyncro_urlapi'])) ? $_POST['letssyncro_urlapi'] : $letssyncrooptions['urlapi']).'" />
186
- <p class="clear">'.$this->__('URL of the API OCT8NE service. Probably you don\'t have to modify it.').'</p>
187
- </div>
188
- <div class="margin-form">
189
- <input type="submit" class="button disable" name="submitLetsSyncroSettings" style="cursor: pointer;" value="'.$this->__('Save').'" id="submitLetsSyncroSettings" />
190
- </div>
191
- </fieldset>
192
- </form>
193
- </div>';
194
-
195
- return $this->_html;
196
- }
197
-
198
- public function updateLetsSyncroLicenseID($letssyncrooptions,$letssyncromodel)
199
- {
200
- $letssyncro_licenseid = '';
201
- if(isset($_GET['letssyncro_licenseid']))
202
- $letssyncro_licenseid = $_GET['letssyncro_licenseid'];
203
- return $letssyncromodel->setLicenseid($letssyncro_licenseid);
204
- }
205
-
206
- public function updateLetsSyncroAPIToken($letssyncrooptions,$letssyncromodel)
207
- {
208
- $letssyncro_apitoken = '';
209
- if(isset($_GET['letssyncro_apitoken']))
210
- $letssyncro_apitoken = $_GET['letssyncro_apitoken'];
211
- return $letssyncromodel->setApitoken($letssyncro_apitoken);
212
- }
213
-
214
- public function updateLetsSyncroEnabled($letssyncro_enabled,$letssyncrooptions,$letssyncromodel)
215
- {
216
- $letssyncromodel->save();
217
- $letssyncrooptions = $letssyncromodel->_data;
218
- $letssyncro_licenseid = $letssyncrooptions['licenseid'];
219
- $letssyncro_apitoken = $letssyncrooptions['apitoken'];
220
-
221
- if(isset($_GET['letssyncro_enabled']))
222
- $letssyncro_enabled = $_GET['letssyncro_enabled'];
223
-
224
- if($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
225
- return false;
226
-
227
- $letssyncro_useremail = $letssyncrooptions['email'];
228
- $letssyncro_password = $letssyncrooptions['password'];
229
-
230
- $xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password, $letssyncro_enabled ? 1: 0);
231
- $this->sendRequest($xmlData, 'logon', $letssyncrooptions['urlapi']);
232
-
233
- return $letssyncromodel->setEnabled($letssyncro_enabled);
234
- }
235
-
236
- public function updateLetsSyncroSyncroSettings($letssyncrooptions,$letssyncromodel)
237
- {
238
- $letssyncro_urlapi = '';
239
- if(isset($_GET['letssyncro_urlapi']))
240
- $letssyncro_urlapi = $_GET['letssyncro_urlapi'];
241
- return $letssyncromodel->setUrlapi($letssyncro_urlapi);
242
- }
243
-
244
- public function updateLetsSyncroUserPassword($letssyncrooptions,$letssyncromodel,$letssyncro_useremail,$letssyncro_password)
245
- {
246
- if(!$letssyncromodel->setEmail($letssyncro_useremail) || !$letssyncromodel->setPassword($letssyncro_password))
247
- return false;
248
-
249
- $letssyncromodel->setApitoken('');
250
- $letssyncromodel->setLicenseid('');
251
-
252
- $xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password);
253
-
254
- try
255
- {
256
- $response = $this->sendRequest($xmlData, 'logon', $letssyncrooptions['urlapi']);
257
-
258
- if(strripos($response, '<head>'))
259
  return false;
260
 
261
- $xml = new SimpleXmlElement($response);
 
 
 
 
 
 
 
 
262
 
263
- if(!isset($xml->LicenseId))
264
- {
265
- $letssyncromodel->setEnabled('0');
266
  return false;
267
- }
268
-
269
- if($xml)
270
- {
271
- if($letssyncromodel->setApitoken($xml->ApiToken) &&
272
- $letssyncromodel->setLicenseid($xml->LicenseId) &&
273
- $letssyncromodel->setEmail($letssyncro_useremail) &&
274
- $letssyncromodel->setPassword($letssyncro_password))
275
- return true;
276
- }
277
- else
278
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  return false;
280
- }
281
- }
282
- catch (Exception $e)
283
- {
284
- return false;
285
- }
286
-
287
- return true;
288
- }
289
-
290
- public function sendRequest($xmlData, $method = '', $letssyncro_url, $letssyncro_apitoken = '')
291
- {
292
- if($method == 'logon')
293
- $letssyncro_url = $letssyncro_url.'/'.$method;
294
- else
295
- $letssyncro_url = $letssyncro_url.'/updateNodes?userid='.$letssyncro_apitoken;
296
-
297
- if(function_exists('curl_init') == 1)
298
- {
299
- $ch = curl_init($letssyncro_url);
300
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
301
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
302
- curl_setopt($ch, CURLOPT_POST, 1);
303
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
304
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
305
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
306
- $response = curl_exec($ch);
307
- curl_close($ch);
308
- }
309
- else
310
- {
311
- $opts = array('http' =>
312
- array(
313
- 'method' => 'POST',
314
- 'header' => 'Content-type: text/xml',
315
- 'content' => $xmlData
316
- )
317
- );
318
- $context = stream_context_create($opts);
319
-
320
- $response = file_get_contents($letssyncro_url, false, $context);
321
- }
322
-
323
- return $response;
324
- }
325
-
326
- public function createXML_Logon($letssyncro_useremail, $letssyncro_password, $status_platform = null)
327
- {
328
- $DOM = new DOMDocument('1.0','UTF-8');
329
- $XML = $DOM->createElement('User');
330
- $XML->setAttribute('xmlns','http://schemas.datacontract.org/2004/07/Syncro.WebService');
331
- $XML->setAttribute('xmlns:i','http://www.w3.org/2001/XMLSchema-instance');
332
- $DOM->appendChild($XML);
333
-
334
- $Email = $DOM->createElement('Email', $letssyncro_useremail);
335
- $Pass = $DOM->createElement('Pass', $this->urlsafe_b64decode($letssyncro_password));
336
- $baseurl = $DOM->createElement('BaseUrl', Mage::getBaseUrl());
337
- $checkouturl = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
338
- $loginurl = $DOM->createElement('LoginUrl', Mage::helper('customer')->getLoginUrl());
339
- // $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
340
- $platform = $DOM->createElement('Platform', 'MAGENTO');
341
- $domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
342
-
343
- if(!is_null($status_platform))
344
- $StatusPlatform = $DOM->createElement('StatusPlatform', $status_platform);
345
-
346
- $XML->appendChild($baseurl);
347
- $XML->appendChild($checkouturl);
348
- // $XML->appendChild($currency); <-- habrá mas de 1 currency, preguntar que hacer
349
- $XML->appendChild($Email);
350
- $XML->appendChild($loginurl);
351
- $XML->appendChild($Pass);
352
- $XML->appendChild($platform);
353
-
354
- if(!is_null($status_platform))
355
- $XML->appendChild($StatusPlatform);
356
-
357
-
358
- $XML->appendChild($domain);
359
-
360
- return $DOM->saveXML($DOM->documentElement);
361
- }
362
-
363
- function urlsafe_b64encode($string)
364
- {
365
- $data = base64_encode($string);
366
- $data = str_replace(array('+','/','='),array('-','_','.'),$data);
367
- return $data;
368
- }
369
- function urlsafe_b64decode($string)
370
- {
371
- $data = str_replace(array('-','_','.'),array('+','/','='),$string);
372
- $mod4 = strlen($data) % 4;
373
- if ($mod4) {
374
- $data .= substr('====', $mod4);
375
- }
376
- return base64_decode($data);
377
- }
378
  }
1
  <?php
2
+
3
+ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template {
4
+
5
+ private $_html = '';
6
+
7
+ protected function _toHtml() {
8
+ $submitLetsSyncroCredentials = $this->getRequest()->getParam('submitLetsSyncroCredentials');
9
+
10
+ $letssyncromodel = Mage::getModel('oct8ne/letssyncro')->load(1);
11
+ $letssyncrooptions = $letssyncromodel->_data;
12
+
13
+ if (isset($submitLetsSyncroCredentials)) {
14
+ $letssyncro_useremail = $this->getRequest()->getParam('letssyncro_useremail');
15
+ $letssyncro_password = $this->getRequest()->getParam('letssyncro_password');
16
+
17
+ if (empty($letssyncro_useremail)) {
18
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('The field (Email) cannot be empty.') . '</div></li></ul></li></ul><br></div>';
19
+ } elseif (empty($letssyncro_password)) {
20
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('The field (Password) cannot be empty.') . '</div></li></ul></li></ul><br></div>';
21
+ } elseif (!$this->updateLetsSyncroUserPassword($letssyncrooptions, $letssyncromodel, $letssyncro_useremail, $letssyncro_password)) {
22
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('There was an error on your credentials and cannot obtain OCT8NE integration data.') . '</div></li></ul></li></ul><br></div>';
23
+ } elseif (!$this->updateLetsSyncroEnabled('1', $letssyncrooptions, $letssyncromodel)) {
24
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('There was an error activating OCT8NE integration.') . '</div></li></ul></li></ul><br></div>';
25
+ } else {
26
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">' . $this->__('OCT8NE integration data obtained successfully!') . '</div></li></ul></li></ul><br></div>';
27
+ }
28
+
29
+ $letssyncromodel->save();
30
+ }
31
+
32
+ if (isset($_GET['deactivate']) && !isset($submitLetsSyncroCredentials)) {
33
+ if (!$this->updateLetsSyncroEnabled('0', $letssyncrooptions, $letssyncromodel))
34
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('There was an error deactivating OCT8NE integration.') . '</div></li></ul></li></ul><br></div>';
35
+ else
36
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">' . $this->__('OCT8NE integration deactivated successfully!') . '</div></li></ul></li></ul><br></div>';
37
+
38
+ $letssyncromodel->save();
39
+ }
40
+
41
+ if (isset($_GET['activate']) && !isset($submitLetsSyncroCredentials)) {
42
+ if (!$this->updateLetsSyncroEnabled('1', $letssyncrooptions, $letssyncromodel))
43
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">' . $this->__('There was an error activating OCT8NE integration.') . '</div></li></ul></li></ul><br></div>';
44
+ else
45
+ $this->_html .= '<div id="messagesbox"><ul class="messages"><li class="success-msg"><ul><li><div id="themessage">' . $this->__('OCT8NE integration activated successfully!') . '</div></li></ul></li></ul><br></div>';
46
+
47
+ $letssyncromodel->save();
48
+ }
49
+
50
+ $this->_html .= '
51
+ <script type="text/javascript">
52
+ function submitAccountSetup() {
53
+ var passw = document.getElementById(\'letssyncro_password\').value;
54
+ document.getElementById(\'submitLetsSyncroCredentials\').style.display = "none";
55
+ document.getElementById(\'executing\').style.display = "block";
56
+ document.getElementById(\'letssyncro_password\').value = Base64.encode(passw);
57
+ document.getElementById(\'generalsettings\').submit();
58
+ }
59
+ </script>
60
+ <link href="' . Mage::getStoreConfig('web/unsecure/base_url') . '/app/design/adminhtml/default/default/template/oct8ne/letssyncro.css" rel="stylesheet" type="text/css" />
61
+ <script type="text/javascript" src="' . Mage::getStoreConfig('web/unsecure/base_url') . '/app/design/adminhtml/default/default/template/oct8ne/letssyncro.js"></script>
62
+ <div class="content-header">
63
+ <p><img src="' . $this->getSkinUrl('images/LetsSyncro_Logo.png') . '" alt="Oct8ne" title="Oct8ne" /></p>
64
+ </div>
65
+ <div class="entry-edit">
66
+ <div class="entry-edit-head collapseable">
67
+ <div class="section-config active">
68
+ <div class="entry-edit-head collapseable">
69
+ <a id="letssyncro_setup-head" class="open" onclick="Fieldset.toggleCollapse(\'letssyncro_setup\', \'\'); return false;" href="#">' . $this->__('Account Setup') . '</a>
70
+ </div>
71
+ <input type="hidden" value="1" name="config_state[letssyncro_setup]" id="letssyncro_setup-state">
72
+ </div>
73
+ </div>
74
+ </div>
75
+ ';
76
+
77
+ $letssyncrooptions = $letssyncromodel->_data;
78
+ $currentUrl_idx = strrpos($this->helper('core/url')->getCurrentUrl(), '/', -1);
79
+ $currentUrl_ex = strlen(substr($this->helper('core/url')->getCurrentUrl(), $currentUrl_idx));
80
+ $currentUrl = substr($this->helper('core/url')->getCurrentUrl(), 0, strlen($this->helper('core/url')->getCurrentUrl()) - $currentUrl_ex);
81
+
82
+ $oct8neSignupUrl = Mage::helper('oct8ne/url')->getOct8neSignupUrl();
83
+
84
+ $linked_literal_deact = '<p class="LetsSyncro">' . $this->__('Status:') . ' <img src="' . $this->getSkinUrl('images/fam_bullet_success.gif') . '" alt="' . $this->__('Enabled') . '" title="' . $this->__('Enabled') . '" />
85
+ <a href="' . str_replace('/?activate', '', $currentUrl) . '/?deactivate">' . $this->__('(Deactivate)') . '</a></p>
86
+ <p class="LetsSyncro">' . $this->__('Linked account:') . ' <strong>' . $letssyncrooptions['email'] . '</strong></p><br />';
87
+ $linked_literal_act = '<p class="LetsSyncro">' . $this->__('Status:') . ' <img src="' . $this->getSkinUrl('images/error_msg_icon.gif') . '" alt="' . $this->__('Disabled') . '" title="' . $this->__('Disabled') . '" />
88
+ <a href="' . str_replace('/?deactivate', '', $currentUrl) . '/?activate">' . $this->__('(Activate)') . '</a></p>
89
+ <p class="LetsSyncro">' . $this->__('Linked account:') . ' <strong>' . $letssyncrooptions['email'] . '</strong></p><br />';
90
+
91
+ $this->_html .= '
92
+ <form method="get" action="' . $currentUrl . '/" id="generalsettings" name="generalsettings" style="display:' . ((!isset($_GET['letssyncro_account']) && !isset($_GET['letssyncro_syncro'])) || (isset($_GET['letssyncro_account'])) ? 'block;' : 'none;') . '" >
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  <fieldset class="config collapseable" id="letssyncro_setup">';
94
+ if ($letssyncrooptions['licenseid'] != '' && $letssyncrooptions['enabled'] == '0')
95
  $this->_html .= str_replace('&amp;activate', '', $linked_literal_act);
96
+ elseif ($letssyncrooptions['licenseid'] != '' && $letssyncrooptions['enabled'] == '1')
97
  $this->_html .= str_replace('&amp;deactivate', '', $linked_literal_deact);
98
 
99
+ $this->_html .= '
100
+ <legend>' . $this->__('Account Setup') . '</legend>
101
  <table cellspacing="0" class="form-list">
102
  <colgroup class="label"></colgroup>
103
  <colgroup class="value"></colgroup>
105
  <tbody>
106
  <tr id="row_letssyncro_setup_email">
107
  <td class="label">
108
+ <label for="letssyncro_useremail">' . $this->__('Email:') . '</label>
109
  </td>
110
  <td class="value">
111
+ <input type="text" class="validate-email input-text required-entry" name="letssyncro_useremail" id="letssyncro_useremail" value="' . (($this->error AND isset($_POST['letssyncro_useremail'])) ? $_POST['letssyncro_useremail'] : $letssyncrooptions['email']) . '" />
112
+ <p class="note"><span>' . $this->__('Oct8ne email') . '</span></p>
113
+ <div id="advice-validate-email-letssyncro_useremail" class="validation-advice" style="display:none;">' . $this->__('Please, write a valid email address. For example jdoe@domain.com') . '</div>
114
  </td>
115
  <td class=""></td>
116
  </tr>
117
  <tr id="row_letssyncro_setup_password">
118
  <td class="label">
119
+ <label for="letssyncro_password">' . $this->__('Password:') . '</label>
120
  </td>
121
  <td class="value">
122
+ <input type="password" class="input-text required-entry" name="letssyncro_password" id="letssyncro_password" value="' . (($this->error AND isset($_POST['letssyncro_password'])) ? $_POST['letssyncro_password'] : $this->urlsafe_b64decode($letssyncrooptions['password'])) . '" />
123
+ <p class="note"><span>' . $this->__('Oct8ne password') . '</span></p>
124
  </td>
125
  <td class=""></td>
126
  </tr>
127
  <tr id="row_letssyncro_setup_linkup">
128
  <td class="label"></td>
129
  <td class="value" style="height:21px;">
130
+ <div id="executing" style="display:none;padding-top:2px;font-weight: bold">' . $this->__('Executing, please wait...') . '</div>
131
+ <button type="button" id="submitLetsSyncroCredentials" onClick="submitAccountSetup();" class="scalable save" ><span>' . $this->__('Link Up') . '</span></button>
132
  <input type="hidden" name="submitLetsSyncroCredentials" id="submitLetsSyncroCredentials" value="ok" />
133
  </td>
134
  <td class=""></td>
136
  </tbody>
137
  </table>
138
  <br />
139
+ <p class="LetsSyncro">' . $this->__('Don\'t have a OCT8NE account?') . ' <a href="' . $oct8neSignupUrl . '?planselected=platform" target="_blank">' . $this->__('Sign up now') . '</a></p>
140
  </fieldset>
141
  </form><br />';
142
+
143
+ return $this->_html;
144
+ }
145
+
146
+ public function updateLetsSyncroEnabled($letssyncro_enabled, $letssyncrooptions, $letssyncromodel) {
147
+ $letssyncromodel->save();
148
+ $letssyncrooptions = $letssyncromodel->_data;
149
+ $letssyncro_licenseid = $letssyncrooptions['licenseid'];
150
+ $letssyncro_apitoken = $letssyncrooptions['apitoken'];
151
+
152
+ if (isset($_GET['letssyncro_enabled']))
153
+ $letssyncro_enabled = $_GET['letssyncro_enabled'];
154
+
155
+ if ($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  return false;
157
 
158
+ $letssyncro_useremail = $letssyncrooptions['email'];
159
+ $letssyncro_password = $letssyncrooptions['password'];
160
+
161
+ $xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password, $letssyncro_enabled ? 1 : 0);
162
+ $linkup = Mage::helper('oct8ne/url')->getOct8neLinkupServiceUrl();
163
+ $this->sendRequest($xmlData, 'logon', $linkup);
164
+
165
+ return $letssyncromodel->setEnabled($letssyncro_enabled);
166
+ }
167
 
168
+ public function updateLetsSyncroUserPassword($letssyncrooptions, $letssyncromodel, $letssyncro_useremail, $letssyncro_password) {
169
+ if (!$letssyncromodel->setEmail($letssyncro_useremail) || !$letssyncromodel->setPassword($letssyncro_password))
 
170
  return false;
171
+
172
+ $letssyncromodel->setApitoken('');
173
+ $letssyncromodel->setLicenseid('');
174
+
175
+ $xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password);
176
+
177
+ try {
178
+ $response = $this->sendRequest($xmlData, 'logon', $letssyncrooptions['urlapi']);
179
+
180
+ if (strripos($response, '<head>'))
181
+ return false;
182
+
183
+ $xml = new SimpleXmlElement($response);
184
+
185
+ if (!isset($xml->LicenseId)) {
186
+ $letssyncromodel->setEnabled('0');
187
+ return false;
188
+ }
189
+
190
+ if ($xml) {
191
+ if ($letssyncromodel->setApitoken($xml->ApiToken) &&
192
+ $letssyncromodel->setLicenseid($xml->LicenseId) &&
193
+ $letssyncromodel->setEmail($letssyncro_useremail) &&
194
+ $letssyncromodel->setPassword($letssyncro_password))
195
+ return true;
196
+ }
197
+ else {
198
+ return false;
199
+ }
200
+ } catch (Exception $e) {
201
  return false;
202
+ }
203
+
204
+ return true;
205
+ }
206
+
207
+ public function sendRequest($xmlData, $method = '', $letssyncro_url, $letssyncro_apitoken = '') {
208
+ if ($method == 'logon')
209
+ $letssyncro_url = $letssyncro_url . '/' . $method;
210
+ else
211
+ $letssyncro_url = $letssyncro_url . '/updateNodes?userid=' . $letssyncro_apitoken;
212
+
213
+ if (function_exists('curl_init') == 1) {
214
+ $ch = curl_init($letssyncro_url);
215
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
216
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
217
+ curl_setopt($ch, CURLOPT_POST, 1);
218
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
219
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
220
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
221
+ $response = curl_exec($ch);
222
+ curl_close($ch);
223
+ } else {
224
+ $opts = array('http' =>
225
+ array(
226
+ 'method' => 'POST',
227
+ 'header' => 'Content-type: text/xml',
228
+ 'content' => $xmlData
229
+ )
230
+ );
231
+ $context = stream_context_create($opts);
232
+
233
+ $response = file_get_contents($letssyncro_url, false, $context);
234
+ }
235
+
236
+ return $response;
237
+ }
238
+
239
+ public function createXML_Logon($letssyncro_useremail, $letssyncro_password, $status_platform = null) {
240
+ $DOM = new DOMDocument('1.0', 'UTF-8');
241
+ $XML = $DOM->createElement('User');
242
+ $XML->setAttribute('xmlns', 'http://schemas.datacontract.org/2004/07/Syncro.WebService');
243
+ $XML->setAttribute('xmlns:i', 'http://www.w3.org/2001/XMLSchema-instance');
244
+ $DOM->appendChild($XML);
245
+
246
+ $Email = $DOM->createElement('Email', $letssyncro_useremail);
247
+ $Pass = $DOM->createElement('Pass', $this->urlsafe_b64decode($letssyncro_password));
248
+ $baseurl = $DOM->createElement('BaseUrl', Mage::getBaseUrl());
249
+ $checkouturl = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
250
+ $loginurl = $DOM->createElement('LoginUrl', Mage::helper('customer')->getLoginUrl());
251
+ // $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
252
+ $platform = $DOM->createElement('Platform', 'MAGENTO');
253
+ $domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
254
+
255
+ if (!is_null($status_platform))
256
+ $StatusPlatform = $DOM->createElement('StatusPlatform', $status_platform);
257
+
258
+ $XML->appendChild($baseurl);
259
+ $XML->appendChild($checkouturl);
260
+ // $XML->appendChild($currency); <-- habrá mas de 1 currency, preguntar que hacer
261
+ $XML->appendChild($Email);
262
+ $XML->appendChild($loginurl);
263
+ $XML->appendChild($Pass);
264
+ $XML->appendChild($platform);
265
+
266
+ if (!is_null($status_platform))
267
+ $XML->appendChild($StatusPlatform);
268
+
269
+
270
+ $XML->appendChild($domain);
271
+
272
+ return $DOM->saveXML($DOM->documentElement);
273
+ }
274
+
275
+ function urlsafe_b64encode($string) {
276
+ $data = base64_encode($string);
277
+ $data = str_replace(array('+', '/', '='), array('-', '_', '.'), $data);
278
+ return $data;
279
+ }
280
+
281
+ function urlsafe_b64decode($string) {
282
+ $data = str_replace(array('-', '_', '.'), array('+', '/', '='), $string);
283
+ $mod4 = strlen($data) % 4;
284
+ if ($mod4) {
285
+ $data .= substr('====', $mod4);
286
+ }
287
+ return base64_decode($data);
288
+ }
289
+
 
 
 
 
 
 
 
 
 
 
290
  }
app/code/community/LetsSyncroLLC/Oct8ne/Block/Html/Head.php CHANGED
@@ -1,9 +1,11 @@
1
  <?php
 
2
  /*
3
- Añadimos la posibilidad de meter javascript inline
4
- */
5
- class LetsSyncroLLC_Oct8ne_Block_Html_Head extends Mage_Page_Block_Html_Head
6
- {
 
7
  /**
8
  * Classify HTML head item and queue it into "lines" array
9
  *
@@ -15,19 +17,21 @@ class LetsSyncroLLC_Oct8ne_Block_Html_Head extends Mage_Page_Block_Html_Head
15
  * @param string $itemName
16
  * @param array $itemThe
17
  */
18
- protected function _separateOtherHtmlHeadElements(&$lines, $itemIf, $itemType, $itemParams, $itemName, $itemThe)
19
- {
20
- $tmp = count($lines[$itemIf]['other']);
21
  parent::_separateOtherHtmlHeadElements($lines, $itemIf, $itemType, $itemParams, $itemName, $itemThe);
22
-
23
- if($tmp == count($lines[$itemIf]['other'])) {
24
- $params = $itemParams ? ' ' . $itemParams : '';
25
- $href = $itemName;
26
- switch ($itemType) {
27
- case 'script':
28
- $lines[$itemIf]['other'][] = sprintf('<script type="text/javascript">%s</script>', $params);
29
- break;
 
 
 
30
  }
31
  }
32
  }
33
- }
 
1
  <?php
2
+
3
  /*
4
+ Añadimos la posibilidad de meter javascript inline
5
+ */
6
+
7
+ class LetsSyncroLLC_Oct8ne_Block_Html_Head extends Mage_Page_Block_Html_Head {
8
+
9
  /**
10
  * Classify HTML head item and queue it into "lines" array
11
  *
17
  * @param string $itemName
18
  * @param array $itemThe
19
  */
20
+ protected function _separateOtherHtmlHeadElements(&$lines, $itemIf, $itemType, $itemParams, $itemName, $itemThe) {
 
 
21
  parent::_separateOtherHtmlHeadElements($lines, $itemIf, $itemType, $itemParams, $itemName, $itemThe);
22
+ $line = $lines[$itemIf];
23
+ if (key_exists('other', $line)) {
24
+ $tmp = count($line['other']);
25
+ if ($tmp == count($lines[$itemIf]['other'])) {
26
+ $params = $itemParams ? ' ' . $itemParams : '';
27
+ $href = $itemName;
28
+ switch ($itemType) {
29
+ case 'script':
30
+ $lines[$itemIf]['other'][] = sprintf('<script type="text/javascript">%s</script>', $params);
31
+ break;
32
+ }
33
  }
34
  }
35
  }
36
+
37
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Customer/Data.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- class LetsSyncroLLC_Oct8ne_Helper_Customer_Data extends Mage_Core_Helper_Abstract {
4
-
5
- static public function getCurrency() {
6
- $raw = Mage::app()->getLocale()->currency( Mage::app()->getStore()->getCurrentCurrencyCode() )->toCurrency();
7
- return mb_substr( $raw, 0, 1, mb_detect_encoding($raw) );
8
- }
9
-
10
- public function gatherLoginData() {
11
- if ( !Mage::getSingleton('customer/session')->isLoggedIn() )
12
- return null;
13
- else {
14
- $customer = Mage::getSingleton('customer/session')->getCustomer();
15
-
16
- return
17
- array(
18
- 'id' => $customer->getId(),
19
- 'first_name' => $customer->getFirstname(),
20
- 'last_name' => $customer->getLastname(),
21
- 'email' => $customer->getEmail()
22
- );
23
- }
24
- }
25
-
26
- public function gatherCartData() {
27
- $currency = self::getCurrency();
28
- $quote = Mage::getSingleton('checkout/session')->getQuote();
29
- $items = $quote->getAllVisibleItems();
30
- $v = array();
31
- foreach( $items as $item ) {
32
- $product = $item->getProduct();
33
- /*
34
- $vi = $item->getData();
35
- if ( is_numeric( @$vi['special_price'] ) )
36
- $vi['price'] = $vi['special_price'];
37
- // $vi['price'] = sprintf( "%.02f$currency", $vi['price'] );
38
- $vi['price'] = number_format($vi['price'], '2', '.', ',');
39
- //$vi['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
40
- $vi['img_url'] = Mage::helper('catalog/image')->init( $item->getProduct(), 'thumbnail' );
41
- */
42
- $v[] = Mage::helper('oct8ne')->getProductInfo($product->getId(), $item->getQty());
43
- }
44
-
45
- return $v;
46
- /*
47
- $cart = Mage::getSingleton('checkout/cart');
48
- foreach($cart->getItems() as $item)
49
- {
50
- $vi = $item->getData();
51
- if ( is_numeric( @$vi['special_price'] ) )
52
- $vi['price'] = $vi['special_price'];
53
- $vi['price'] = $vi['price']; // sprintf( "%.02f$currency", $vi['price'] );
54
- $vi['img_url'] = Mage::helper('catalog/image')->init( $item->getProduct(), 'thumbnail' );
55
- $v[] = $vi;
56
- }
57
- return $v;
58
- */
59
- }
60
-
61
- public function gatherWishlistData() {
62
- $currency = self::getCurrency();
63
- $collection = Mage::helper('wishlist')->getWishlistItemCollection();
64
- $v = array();
65
- foreach( $collection as $item ) {
66
- /*
67
- $vi = $item->getData();
68
- $vi['price'] = number_format($vi['price'], '2', '.', ','); // sprintf( "%.02f".$currency, $vi['price'] );
69
- // $vi['price'] = Mage::getModel('directory/currency')->format( $vi['price'] );
70
- $vi['img_url'] = Mage::helper('catalog/image')->init( $item->getProduct(), 'thumbnail' );
71
- $v[] = $vi;
72
- */
73
- $product = $item->getProduct();
74
- $v[] = Mage::helper('oct8ne')->getProductInfo($product->getId());
75
- }
76
-
77
- return $v;
78
- }
79
-
80
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/LetsSyncroLLC/Oct8ne/Helper/CustomerData.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LetsSyncroLLC_Oct8ne_Helper_CustomerData extends Mage_Core_Helper_Abstract {
4
+
5
+ static public function getCurrency() {
6
+ $raw = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->toCurrency();
7
+ return mb_substr($raw, 0, 1, mb_detect_encoding($raw));
8
+ }
9
+
10
+ public function getLoginData() {
11
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
12
+ return null;
13
+ } else {
14
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
15
+ return array(
16
+ 'id' => $customer->getId(),
17
+ 'first_name' => $customer->getFirstname(),
18
+ 'last_name' => $customer->getLastname(),
19
+ 'email' => $customer->getEmail()
20
+ );
21
+ }
22
+ }
23
+
24
+ public function getCartData() {
25
+ $currency = self::getCurrency();
26
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
27
+ $items = $quote->getAllVisibleItems();
28
+
29
+ $productIds = array();
30
+ $qtysPerProduct = array();
31
+ foreach ($items as $item) {
32
+ $id = $item->getProductId();
33
+ $productIds[] = $id;
34
+ $qtysPerProduct[$id] = $item->getQty();
35
+ }
36
+ $dataHelper = Mage::helper("oct8ne"); /* @var $dataHelper LetsSyncroLLC_Oct8ne_Helper_Data */
37
+ return $dataHelper->getProductsInfoByIds($productIds, $qtysPerProduct);
38
+ }
39
+
40
+ public function getWishlistData() {
41
+ return Mage::helper("oct8ne/wishlist")->getWishList();
42
+ }
43
+
44
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php CHANGED
@@ -1,176 +1,285 @@
1
- <?php
2
- class LetsSyncroLLC_Oct8ne_Helper_Data extends Mage_Core_Helper_Abstract {
3
-
4
- static public function getProductFullUrl($product) {
5
- $categories = $product -> getCategoryIds();
6
- $category = Mage::getModel('catalog/category') -> load($categories[0]);
7
- //$url = Mage::getUrl( $category->getUrlPath() ).basename( $product->getProductUrl() );
8
- $url = Mage::getUrl(basename($product -> getProductUrl()));
9
- return $url;
10
- }
11
-
12
- static public function getProductImagesUrl($product) {
13
- $v = array();
14
- $gallery_data = $product -> getData('media_gallery');
15
-
16
- // $url = parse_url(self::_remove_http(Mage::getUrl('oct8ne/frame/image'));
17
- // $url['query']['file'] = 'catalog/product'.$image['file'];
18
- $url = Mage::getUrl('oct8ne/frame/image');
19
- $join = (strstr($url, "?") === FALSE) ? '?' : '&';
20
-
21
- $gallery_info = $gallery_data['images'];
22
- if (array_key_exists('configurable_images', $gallery_data))
23
- $gallery_info = $gallery_data['configurable_images'];
24
-
25
- foreach ($gallery_info as $j => $image) {
26
- $file = $image['file'];
27
- if (strpos($file, '/') !== 0)
28
- $file = "/$file";
29
-
30
- $v[] = array(
31
- // 'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
32
- // 'url' => Mage::getUrl('oct8ne/frame/image', array('file' => 'catalog/product'.$image['file']))
33
- 'Id' => $j, 'FileName' => self::_remove_http($url) . $join . 'file=catalog/product' . $file);
34
- }
35
-
36
- return $v;
37
- }
38
-
39
- static protected $_productThumbnail = array();
40
- static public function getProductThumbnail($product, $width = null) {
41
- $id = $product -> getId();
42
- if (array_key_exists($id, self::$_productThumbnail)) {
43
- return self::$_productThumbnail[$id];
44
- }
45
- $thumb = Mage::helper('catalog/image') -> init($product, 'image');
46
-
47
- if (!is_null($width))
48
- $thumb -> resize($width);
49
-
50
- $file = (string)$thumb;
51
-
52
- self::$_productThumbnail[$id] = $file;
53
-
54
- return $file;
55
- }
56
-
57
- static public function getProductInfo($product_id, $qty = null) {
58
- $product = Mage::getModel('catalog/product') -> load($product_id);
59
- // $description = str_replace( array("\r\n", "\n", "\r"), "\\n", htmlentities ($product->getDescription()) );
60
- $description = htmlspecialchars($product -> getDescription(), ENT_QUOTES, "UTF-8");
61
- $description = trim($description, "\r\n\t ");
62
- $description = str_replace("\r", "", $description);
63
- $description = str_replace("\t", "", $description);
64
- $description = str_replace("\n", "&lt;br\/&gt;", $description);
65
- $tmp = is_null($qty) ? array() : array('Qty' => $qty);
66
- return array_merge($tmp, array('InternalId' => $product -> getId(), 'Title' => htmlspecialchars($product -> getName(), ENT_QUOTES, "UTF-8"), // htmlentities( $product->getName() ),
67
- // 'price' => sprintf( "%.02f$currency", is_numeric($product->getSpecialPrice()) ? $product->getSpecialPrice() : $product->getPrice() ),
68
- // 'price' => Mage::helper('core')->currency(number_format($product->getFinalPrice(), '2', '.', ',')),
69
- 'PrevPrice' => number_format(Mage::helper('core') -> currency($product -> getPrice(), false, false), '2', '.', ','), 'Price' => number_format(Mage::helper('core') -> currency($product -> getFinalPrice(), false, false), '2', '.', ','),
70
- 'Description' => trim($description),
71
- 'Stock' => intval($product->getStockItem()->getQty()),
72
- 'Rating' => self::getProductRating($product_id), 'RouteTo' => self::_remove_http(Mage::helper('oct8ne') -> getProductFullUrl($product)), 'BuyURL' => self::getProductBuyUrl($product_id), 'Medias' => Mage::helper('oct8ne') -> getProductImagesUrl($product), 'Thumbnail' => self::_remove_http(Mage::helper('oct8ne') -> getProductThumbnail($product, 120)), 'HasOptions' => self::getProductOptions($product_id), 'Visibility' => $product -> getVisibility()));
73
- }
74
-
75
- static public function getProductOptions($productId) {
76
- $has_options = "false";
77
- $product_load = Mage::getModel('catalog/product') -> load($productId);
78
-
79
- /** Options **/
80
- $product_options = $product_load -> getTypeInstance(true) -> hasOptions($product_load);
81
- $has_options = ($product_options ? "true" : $has_options);
82
-
83
- /** Grouped Product **/
84
- $product_grouped = $product_load -> getTypeId();
85
- $has_options = ($product_grouped == "grouped" ? "true" : $has_options);
86
-
87
- return $has_options;
88
- }
89
-
90
- static public function getProductBuyUrl($productId) {
91
- $product = Mage::getModel('catalog/product') -> load($productId);
92
- $full_url = Mage::helper('checkout/cart') -> getAddUrl($product);
93
-
94
- $buy_url = preg_replace('#^https?:#', '', $full_url);
95
-
96
- return $buy_url;
97
- }
98
-
99
- static public function getProductRating($productId) {
100
- // Obtener la colección de reviews
101
- $reviews = Mage::getModel('review/review') -> getResourceCollection() -> addStoreFilter(Mage::app() -> getStore() -> getId()) -> addEntityFilter('product', $productId) -> addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED) -> setDateOrder() -> addRateVotes();
102
- // Calcular la media de ratings/reviews
103
- $avg = 0;
104
- $ratings = array();
105
- if (count($reviews) > 0) {
106
- foreach ($reviews->getItems() as $review) {
107
- foreach ($review->getRatingVotes() as $vote) {
108
- $ratings[] = $vote -> getPercent();
109
- }
110
- }
111
- $avg = array_sum($ratings) / count($ratings);
112
- } else {
113
- return 'no-rating';
114
- }
115
- return $avg;
116
- }
117
-
118
- static public function getRelatedProducts($productId) {
119
- $start = Mage::registry("oct8ne_product_related_start");
120
- $items = Mage::registry("oct8ne_product_related_num_items");
121
-
122
- if ($start < 0)
123
- $start = 0;
124
- if ($items < 1)
125
- $items = 1;
126
-
127
- // obtener categorias del producto $productId
128
- $product = Mage::getModel('catalog/product') -> load($productId);
129
- $cats = $product -> getCategoryIds();
130
-
131
- // buscar todos los productos de las categorias obtenidas
132
- $productsInfo = array();
133
- $productIds = array();
134
- foreach ($cats as $category_id) {
135
- $cat = Mage::getModel('catalog/category') -> load($category_id);
136
-
137
- $collection = $cat -> getProductCollection();
138
- $collection -> addAttributeToFilter('visibility', 4);
139
-
140
- //get all products in this category
141
- $current = 0;
142
- foreach ($collection as $product) {
143
- if ($current > $start + $items)
144
- return $productsInfo;
145
- // ya hemos terminado
146
- if (!in_array($product -> getId(), $productIds) && $product -> getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
147
- if ($current >= $start) {
148
- $productIds[$product -> getId()] = $product -> getId();
149
- $productsInfo[] = self::getProductInfo($product -> getId());
150
- }
151
- $current++;
152
- }
153
- }
154
- }
155
-
156
- // retornar array de getProductInfo();
157
- return $productsInfo;
158
- }
159
-
160
- static public function getExtensionVersion() {
161
- return (string)Mage::getConfig() -> getNode() -> modules -> LetsSyncroLLC_Oct8ne -> version;
162
- }
163
-
164
- static public function _remove_http($str) {
165
- return preg_replace('#^https?:#', '', $str);
166
- }
167
-
168
- /*
169
- static public function getOrderReport($from, $to)
170
- {
171
- // obtener categorias del producto $productId
172
- $items = Mage::getModel('oct8ne/orderproducts')->getCollection();
173
- return $productsInfo;
174
- }
175
- */
176
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LetsSyncroLLC_Oct8ne_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ static protected $_productThumbnail = array();
6
+
7
+ static public function getProductsInfoByIds($productIds, $qtyPerProduct = null) {
8
+ if (empty($productIds)) {
9
+ return array();
10
+ }
11
+
12
+ $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
13
+ $products = Mage::getModel('catalog/product')
14
+ ->getCollection()
15
+ ->addAttributeToFilter('entity_id', array('in' => $productIds))
16
+ ->addAttributeToSelect($attributes)
17
+ ->addAttributeToSelect('description')
18
+ ->addAttributeToSelect('image')
19
+ ->addFinalPrice();
20
+
21
+ // Add stock information
22
+ Mage::getModel('catalogInventory/stock')->addItemsToProducts($products);
23
+
24
+ // Loads the media gallery for every product
25
+ self::addMediaGalleryAttributeToCollection($products);
26
+
27
+ // Store the products in a dictionary
28
+ $productDict = array();
29
+ foreach ($products as $product) {
30
+ $id = $product->getId();
31
+ $qty = $qtyPerProduct && array_key_exists($id, $qtyPerProduct)? $qtyPerProduct[$id]: null;
32
+ $productDict[$id] = self::createProductInfoFromProduct($product, $qty);
33
+ }
34
+
35
+ // Return the products in the same order that they were queried
36
+ $result = array();
37
+ foreach ($productIds as $id) {
38
+ if (array_key_exists($id, $productDict)) {
39
+ $result[] = $productDict[$id];
40
+ }
41
+ }
42
+ return $result;
43
+ }
44
+
45
+ static public function getProductInfo($product_id, $qty = null) {
46
+ $product = Mage::getModel('catalog/product')->load($product_id);
47
+ return self::createProductInfoFromProduct($product, $qty);
48
+ }
49
+
50
+ static public function createProductInfoFromProduct($product, $qty = null) {
51
+ $product_id = $product->getId();
52
+ $description = htmlspecialchars($product->getDescription(), ENT_QUOTES, "UTF-8");
53
+ $description = trim($description, "\r\n\t ");
54
+ $description = str_replace("\r", "", $description);
55
+ $description = str_replace("\t", "", $description);
56
+ $description = str_replace("\n", "&lt;br\/&gt;", $description);
57
+
58
+ $prevPrice = Mage::helper('core')->currency($product->getPrice(), false, false);
59
+ $finalPrice = Mage::helper('core')->currency($product->getFinalPrice(), false, false);
60
+ $productUrl = self::_remove_http($product->getProductUrl());
61
+ $thumbnail = self::_remove_http(self::getProductThumbnail($product, 120));
62
+
63
+ $useProductUrl = true;
64
+ if (self::isSaleable($product)) {
65
+ if (!self::productHasOptions($product)) {
66
+ $useProductUrl = false;
67
+ }
68
+ }
69
+ $medias = self::getProductImagesUrl($product); // Requires a database query
70
+
71
+ $tmp = is_null($qty) ? array() : array('qty' => $qty);
72
+
73
+ $result = array_merge($tmp, array(
74
+ 'internalId' => $product_id,
75
+ 'title' => htmlspecialchars($product->getName(), ENT_QUOTES, "UTF-8"),
76
+ 'prevPrice' => number_format($prevPrice, '2', '.', ','),
77
+ 'price' => number_format($finalPrice, '2', '.', ','),
78
+ 'description' => trim($description),
79
+ 'rating' => 'no-rating',
80
+ 'productUrl' => $productUrl,
81
+ 'addToCartUrl' => self::getProductBuyUrl($product),
82
+ 'useProductUrl' => $useProductUrl,
83
+ 'medias' => $medias,
84
+ 'thumbnail' => $thumbnail,
85
+ ));
86
+ return $result;
87
+ }
88
+
89
+ static private function isSaleable($product) {
90
+
91
+ $stockItem = $product->getStockItem();
92
+ if (!$stockItem) {
93
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
94
+ }
95
+
96
+ if ($stockItem->getManageStock() > 0) {
97
+ $stock = intval($stockItem->getQty());
98
+ if ($stock > 0) {
99
+ $saleable = true;
100
+ } else if ($stockItem->getBackorders()) {
101
+ $saleable = true;
102
+ } else {
103
+ $saleable = false;
104
+ }
105
+ } else {
106
+ $saleable = true;
107
+ }
108
+ return $saleable;
109
+ }
110
+
111
+ static public function getRelatedProducts($productId, $page, $pageSize) {
112
+
113
+ $product = Mage::getModel('catalog/product')->load($productId);
114
+
115
+ // First, try to get related products specified by admins
116
+ $relatedCollection = $product->getRelatedProductCollection()
117
+ ->AddStoreFilter()
118
+ ->addAttributeToSelect('id')
119
+ ->addAttributeToSort('price', 'asc')
120
+ ->setPageSize($pageSize)
121
+ ->setCurPage($page);
122
+
123
+ if ($relatedCollection->count() > 0) {
124
+ return self::loadRelatedProductsFromCollectionOfIds($relatedCollection, $page, $pageSize);
125
+ }
126
+
127
+ // If no related products specified by admins, get them by category
128
+ $categoryIds = $product->getCategoryIds();
129
+ if (empty($categoryIds)) {
130
+ return array();
131
+ }
132
+
133
+ $collection = mage::getModel('catalog/product')->getCollection()
134
+ ->addAttributeToSelect('id')
135
+ ->addAttributeToFilter('visibility', 4)
136
+ ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
137
+ ->addAttributeToFilter('entity_id', array('neq' => $productId))
138
+ ->addAttributeToSort('price', 'asc');
139
+
140
+ Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
141
+
142
+ $collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')
143
+ ->addAttributeToFilter('category_id', array('in' => $categoryIds));
144
+
145
+ $collection->getSelect()->group('e.entity_id');
146
+ $collection->setPageSize($pageSize)
147
+ ->setCurPage($page);
148
+
149
+ return self::loadRelatedProductsFromCollectionOfIds($collection, $page, $pageSize);
150
+ }
151
+
152
+ static private function loadRelatedProductsFromCollectionOfIds($collection, $page, $pageSize) {
153
+ $relatedProductIds = array();
154
+ foreach ($collection as $relatedProduct) {
155
+ $relatedProductIds[] = $relatedProduct->getId();
156
+ }
157
+
158
+ // Until the coviewer supports pagination, just
159
+ // return as total the number of related products in the first page
160
+ $productsCount = sizeof($relatedProductIds);
161
+
162
+ $result[] = array(
163
+ 'total' => $productsCount,
164
+ 'results' => self::getProductsInfoByIds($relatedProductIds)
165
+ );
166
+
167
+ return $result;
168
+ }
169
+
170
+ static public function getProductThumbnail($product, $width = null) {
171
+ $id = $product->getId();
172
+ if (array_key_exists($id, self::$_productThumbnail)) {
173
+ return self::$_productThumbnail[$id];
174
+ }
175
+ $thumb = Mage::helper('catalog/image')->init($product, 'image');
176
+ if (!is_null($width)) {
177
+ $thumb->resize($width);
178
+ }
179
+ $file = (string) $thumb;
180
+ self::$_productThumbnail[$id] = $file;
181
+
182
+ return $file;
183
+ }
184
+
185
+ static private function _remove_http($str) {
186
+ return preg_replace('#^https?:#', '', $str);
187
+ }
188
+
189
+ static private function getProductBuyUrl($product) {
190
+ $full_url = Mage::helper('checkout/cart')->getAddUrl($product);
191
+ $buy_url = preg_replace('#^https?:#', '', $full_url);
192
+ return $buy_url;
193
+ }
194
+
195
+ // TODO: Simplify this method
196
+ static private function productHasOptions($product) {
197
+ $has_options = false;
198
+
199
+ /** Options * */
200
+ $product_options = $product->getTypeInstance(true)->hasOptions($product);
201
+ $has_options = ($product_options ? true : $has_options);
202
+
203
+ /** Grouped Product * */
204
+ $product_grouped = $product->getTypeId();
205
+ $has_options = ($product_grouped == "grouped" ? true : $has_options);
206
+
207
+ return $has_options;
208
+ }
209
+
210
+ static private function getProductImagesUrl($product) {
211
+ $v = array();
212
+ $gallery_data = $product->getData('media_gallery');
213
+ if (!$gallery_data) {
214
+ $product->load('media_gallery');
215
+ $gallery_data = $product->getData('media_gallery');
216
+ }
217
+ $url = Mage::getUrl('oct8ne/frame/image');
218
+ $join = (strstr($url, "?") === FALSE) ? '?' : '&';
219
+ $gallery_info = $gallery_data['images'];
220
+
221
+ if (array_key_exists('configurable_images', $gallery_data))
222
+ $gallery_info = $gallery_data['configurable_images'];
223
+
224
+ foreach ($gallery_info as $image) {
225
+ $file = $image['file'];
226
+ if (strpos($file, '/') !== 0)
227
+ $file = "/$file";
228
+
229
+ $v[] = array(
230
+ 'url' => self::_remove_http($url) . $join . 'file=catalog/product' . $file
231
+ );
232
+ }
233
+ return $v;
234
+ }
235
+
236
+ // Loads the media for all products in just one query
237
+ // Hack found in http://stackoverflow.com/questions/7890616/get-product-media-gallery-images-from-a-product-collection-in-magento
238
+ private static function addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Product_Collection $_productCollection) {
239
+ $_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
240
+ $_read = Mage::getSingleton('core/resource')->getConnection('catalog_read');
241
+
242
+ $pageCur = $_productCollection->getCurPage();
243
+ $pageSize = $_productCollection->getPageSize();
244
+ $offset = $pageSize * ($pageCur - 1);
245
+
246
+ $ids = $_productCollection->getAllIds($pageSize, $offset);
247
+
248
+ if (count($ids) > 0) {
249
+ $sql = '
250
+ SELECT
251
+ main.entity_id, `main`.`value_id`, `main`.`value` AS `file`, `value`.`disabled`,
252
+ `default_value`.`disabled` AS `disabled_default`
253
+ FROM `catalog_product_entity_media_gallery` AS `main`
254
+ LEFT JOIN `catalog_product_entity_media_gallery_value` AS `value`
255
+ ON main.value_id=value.value_id AND value.store_id=' . Mage::app()->getStore()->getId() . '
256
+ LEFT JOIN `catalog_product_entity_media_gallery_value` AS `default_value`
257
+ ON main.value_id=default_value.value_id AND default_value.store_id=0
258
+ WHERE (
259
+ main.attribute_id = ' . $_read->quote($_mediaGalleryAttributeId) . ')
260
+ AND (main.entity_id IN (' . $_read->quote($_productCollection->getAllIds()) . '))
261
+ ';
262
+ $_mediaGalleryData = $_read->fetchAll($sql);
263
+
264
+ $_mediaGalleryByProductId = array();
265
+ foreach ($_mediaGalleryData as $_galleryImage) {
266
+ $k = $_galleryImage['entity_id'];
267
+ unset($_galleryImage['entity_id']);
268
+ if (!isset($_mediaGalleryByProductId[$k])) {
269
+ $_mediaGalleryByProductId[$k] = array();
270
+ }
271
+ $_mediaGalleryByProductId[$k][] = $_galleryImage;
272
+ }
273
+ unset($_mediaGalleryData);
274
+ foreach ($_productCollection as &$_product) {
275
+ $_productId = $_product->getData('entity_id');
276
+ if (isset($_mediaGalleryByProductId[$_productId])) {
277
+ $_product->setData('media_gallery', array('images' => $_mediaGalleryByProductId[$_productId]));
278
+ }
279
+ }
280
+ unset($_mediaGalleryByProductId);
281
+ }
282
+ return $_productCollection;
283
+ }
284
+
285
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Image.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LetsSyncroLLC_Oct8ne_Helper_Image extends Mage_Core_Helper_Url {
4
+
5
+ public function resizeImg($fileName, $width, $height = null) {
6
+ $folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
7
+ $imageURL = $folderURL . $fileName;
8
+
9
+ $basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . $fileName;
10
+ $newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "catalog" . DS . "product" . DS . "cache" . DS . "resized" . DS . $width . DS . $fileName;
11
+ //if width empty then return original size image's URL
12
+ if ($width != '') {
13
+ //if image has already resized then just return URL
14
+ if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
15
+ $imageObj = new Varien_Image($basePath);
16
+ if ($imageObj->getOriginalWidth() <= $width) {
17
+ return $basePath;
18
+ }
19
+ $imageObj->constrainOnly(TRUE);
20
+ $imageObj->keepAspectRatio(FALSE);
21
+ $imageObj->keepFrame(FALSE);
22
+ $imageObj->keepTransparency(TRUE);
23
+ $imageObj->resize($width, $height);
24
+ $imageObj->save($newPath);
25
+ }
26
+ $resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "catalog" . DS . "product" . DS . "cache" . DS . "resized" . DS . $fileName;
27
+ } else {
28
+ $resizedURL = $imageURL;
29
+ }
30
+ return $newPath; // $resizedURL;
31
+ }
32
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Url.php CHANGED
@@ -1,33 +1,54 @@
1
  <?php
2
 
3
- class LetsSyncroLLC_Oct8ne_Helper_Url extends Mage_Core_Helper_Url {
4
 
5
- public function getAdd2CartUrl( $product, $additional = array() ) {
6
-
7
- // .: Checkout/Helper/Cart.php::getAddUrl :. \\
8
- $route_params = array(
9
- 'product' => $product->getEntityId()
10
- );
11
-
12
- if ( !empty( $additional ) )
13
- $route_params = array_merge( $route_params, $additional );
14
 
15
- if ( $product->hasUrlDataObject() ) {
16
- $route_params['_store'] = $product->getUrlDataObject()->getStoreId();
17
- $route_params['_store_to_url'] = true;
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
 
21
- return $this->_remove_http(
22
- $this->_getUrl( 'oct8ne/frame/add2cart', $route_params )
23
- );
24
- }
25
-
26
- protected function _remove_http($str)
27
- {
28
- return preg_replace('#^https?:#', '', $str);
29
- }
30
 
31
- };
 
 
32
 
33
- ?>
1
  <?php
2
 
3
+ class LetsSyncroLLC_Oct8ne_Helper_Url extends Mage_Core_Helper_Url {
4
 
5
+ public function getOct8neHostName() {
6
+ $hostName = Mage::registry('oct8neHostName');
7
+ if (!$hostName) {
8
+ $hostName = "backoffice.oct8ne.com";
9
+ }
10
+ return $hostName;
11
+ }
 
 
12
 
13
+ public function getOct8neSignupUrl() {
14
+ $signupUrl = Mage::registry('oct8neSignupUrl');
15
+ if (!$signupUrl) {
16
+ $signupUrl = "https://secure.oct8ne.com/signup";
17
+ }
18
+ return $signupUrl;
19
+ }
20
+
21
+ public function getOct8neLinkupServiceUrl() {
22
+ $linkupUrl = Mage::registry('oct8neLinkupServiceUrl');
23
+ if (!$linkupUrl) {
24
+ $linkupUrl = "https://webservice.oct8ne.com/syncroservice";
25
+ }
26
+ return $linkupUrl;
27
+ }
28
+
29
+ public function getAdd2CartUrl($product, $additional = array()) {
30
+
31
+ // .: Checkout/Helper/Cart.php::getAddUrl :. \\
32
+ $route_params = array(
33
+ 'product' => $product->getEntityId()
34
+ );
35
+
36
+ if (!empty($additional))
37
+ $route_params = array_merge($route_params, $additional);
38
+
39
+ if ($product->hasUrlDataObject()) {
40
+ $route_params['_store'] = $product->getUrlDataObject()->getStoreId();
41
+ $route_params['_store_to_url'] = true;
42
+ }
43
 
44
 
45
+ return $this->_remove_http(
46
+ $this->_getUrl('oct8ne/frame/add2cart', $route_params)
47
+ );
48
+ }
 
 
 
 
 
49
 
50
+ protected function _remove_http($str) {
51
+ return preg_replace('#^https?:#', '', $str);
52
+ }
53
 
54
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Version.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LetsSyncroLLC_Oct8ne_Helper_Version extends Mage_Core_Helper_Abstract {
4
+
5
+ static public function getAdapterVersion() {
6
+ // Defined in etc/config.xml
7
+ return (string) Mage::getConfig()->getNode()->modules->LetsSyncroLLC_Oct8ne->version;
8
+ }
9
+
10
+ static public function getApiVersion() {
11
+ return "2.0";
12
+ }
13
+ }
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Wishlist.php CHANGED
@@ -1,92 +1,66 @@
1
  <?php
2
- class LetsSyncroLLC_Oct8ne_Helper_wishlist extends Mage_Core_Helper_Abstract
3
- {
4
- private function _getWishlist($customer_id = null)
5
- {
6
- if( $customer_id == null )
7
- {
8
- if ( !Mage::getSingleton('customer/session')->isLoggedIn() )
9
- {
10
- return null;
11
- }
12
- $customer = Mage::getSingleton('customer/session')->getCustomer();
13
- $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer);
14
- }
15
- else
16
- {
17
- $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer_id, true);
18
- }
19
- return $wishList;
20
- }
21
-
22
- public function getWishlist($customer_id = null)
23
- {
24
- $wishList = $this->_getWishlist($customer_id);
25
- if($wishList == null)
26
- return array();
27
-
28
- $wishListItemCollection = $wishList->getItemCollection();
29
 
30
- $result = array();
31
- if (count($wishListItemCollection)) {
32
- foreach ($wishListItemCollection as $item) {
33
- /* @var $product Mage_Catalog_Model_Product */
34
- $product = $item->getProduct();
35
- $result[] = Mage::helper('oct8ne')->getProductInfo($product->getId()); // array('id' => $product->getId(), 'name' => $product->getName());
36
- }
37
- }
38
- return $result;
39
- }
40
-
41
- public function addToWishlist($productId, $customer_id = null)
42
- {
43
- if(is_null($customer_id)){
44
- if(Mage::getSingleton('customer/session')->isLoggedIn()) {
45
- $customer_id = Mage::getSingleton('customer/session')->getId();
46
- }
47
- }
48
- $wishList = $this->_getWishlist($customer_id);
49
- if($wishList == null)
50
  return false;
51
-
52
- /*
53
- $requestParams = $this->getRequest()->getParams();
54
- $buyRequest = new Varien_Object($requestParams);
55
- */
56
 
57
  $buyRequest = new Varien_Object(array(
58
  'storeId' => Mage::app()->getStore()->getId()
59
  ));
60
-
61
  $product = Mage::getModel('catalog/product')->load($productId);
62
-
63
  $wishList->addNewItem($product, $buyRequest);
64
- if (is_string($result)) {
65
- Mage::throwException($result);
66
- }
67
  $wishList->save();
68
  return true;
69
  }
70
-
71
- public function removeFromWishlist($productId, $customer_id = null)
72
- {
73
- $wishList = $this->_getWishlist($customer_id);
74
- if($wishList == null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  return false;
76
-
 
77
  $wishListItemCollection = $wishList->getItemCollection();
78
 
79
- if (count($wishListItemCollection)) {
80
- foreach ($wishListItemCollection as $item) {
81
- /* @var $product Mage_Catalog_Model_Product */
82
- if($item->getProductId() == $productId)
83
- $item->delete();
84
  }
85
  }
 
 
 
 
 
86
 
87
- $wishList->save();
88
- return true;
 
 
 
 
 
89
  }
90
-
91
-
92
  }
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ class LetsSyncroLLC_Oct8ne_Helper_wishlist extends Mage_Core_Helper_Abstract {
4
+
5
+ public function addToWishlist($productId) {
6
+ $wishList = $this->getCurrentCustomerWishlist();
7
+ if ($wishList == null) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  return false;
9
+ }
 
 
 
 
10
 
11
  $buyRequest = new Varien_Object(array(
12
  'storeId' => Mage::app()->getStore()->getId()
13
  ));
 
14
  $product = Mage::getModel('catalog/product')->load($productId);
15
+
16
  $wishList->addNewItem($product, $buyRequest);
 
 
 
17
  $wishList->save();
18
  return true;
19
  }
20
+
21
+ public function getWishlist() {
22
+ $wishList = $this->getCurrentCustomerWishlist();
23
+ if ($wishList == null) {
24
+ return array();
25
+ }
26
+
27
+ $wishListItemCollection = $wishList->getItemCollection();
28
+
29
+ $productIds = array();
30
+ foreach ($wishListItemCollection as $item) {
31
+ $productIds[] = $item->getProductId();
32
+ }
33
+ $dataHelper = Mage::helper("oct8ne"); /* @var $dataHelper LetsSyncroLLC_Oct8ne_Helper_Data */
34
+ return $dataHelper->getProductsInfoByIds($productIds);
35
+ }
36
+
37
+ public function removeFromWishlist($productId) {
38
+ $wishList = $this->getCurrentCustomerWishlist();
39
+ if ($wishList == null)
40
  return false;
41
+
42
+ $found = false;
43
  $wishListItemCollection = $wishList->getItemCollection();
44
 
45
+ foreach ($wishListItemCollection as $item) {
46
+ if ($item->getProductId() == $productId) {
47
+ $item->delete();
48
+ $found = true;
49
+ break;
50
  }
51
  }
52
+ if ($found) {
53
+ $wishList->save();
54
+ }
55
+ return $found;
56
+ }
57
 
58
+ private function getCurrentCustomerWishlist() {
59
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
60
+ return null;
61
+ }
62
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
63
+ $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer);
64
+ return $wishList;
65
  }
 
 
66
  }
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Request.php CHANGED
@@ -1,38 +1,37 @@
1
  <?php
 
2
  class LetsSyncroLLC_Oct8ne_Model_Mage_Request extends Mage_Core_Model_Url_Rewrite_Request
3
  {
4
- /**
5
- * Add location header and disable browser page caching
6
- *
7
- * @param string $url
8
- * @param bool $isPermanent
9
- */
10
- /*
11
- protected function _sendRedirectHeaders($url, $isPermanent = false)
12
  {
13
- / *
14
- if ($isPermanent) {
15
- header('HTTP/1.1 301 Moved Permanently');
16
- }
17
-
18
- header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
19
- header('Pragma: no-cache');
20
- header('Location: ' . $url);
21
- exit;
22
- * /
23
-
24
- if(Mage::registry('oct8ne_rewrite') === 1)
25
  return false;
26
-
27
- return parent::_sendRedirectHeaders($url, $isPermanent);
28
  }
29
- */
30
-
31
- public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Controller_Response_Http $response=null)
32
  {
33
- if(Mage::registry('oct8ne_rewrite') === 1)
34
- return false;
35
-
36
- return parent::rewrite($request, $response);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
  }
1
  <?php
2
+
3
  class LetsSyncroLLC_Oct8ne_Model_Mage_Request extends Mage_Core_Model_Url_Rewrite_Request
4
  {
5
+ public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null)
 
 
 
 
 
 
 
6
  {
7
+ if (Mage::registry('oct8ne_rewrite') === 1)
 
 
 
 
 
 
 
 
 
 
 
8
  return false;
9
+
10
+ return parent::rewrite($request, $response);
11
  }
12
+
13
+ protected function _rewriteConfig()
 
14
  {
15
+ // *****************************************
16
+ // Begin patch for GoMage_Checkout extension
17
+ // *****************************************
18
+ $requestPath = trim($this->_request->getPathInfo(), '/');
19
+
20
+ if ($requestPath == 'checkout/onepage' || $requestPath == 'checkout/onepage/index') {
21
+ if (Mage::getConfig()->getNode('modules/GoMage_Checkout')) { // Check if extension exists
22
+ $h = Mage::helper('gomage_checkout');
23
+ if ($h->getConfigData('general/enabled')) {
24
+ if ($h->isAvailableWebsite() && $h->isCompatibleDevice()) {
25
+ $this->_request->setPathInfo('gomage_checkout/onepage');
26
+ return true;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ // *************************************************
32
+ // End patch for GoMage_Checkout extension
33
+ // *************************************************
34
+
35
+ return parent::_rewriteConfig();
36
  }
37
  }
app/code/community/LetsSyncroLLC/Oct8ne/Model/Observer.php CHANGED
@@ -1,228 +1,131 @@
1
  <?php
2
 
3
- class LetsSyncroLLC_Oct8ne_Model_Observer
4
- {
5
- public function interceptMethod($observer)
6
- {
7
- $request = $observer->getEvent()->getData('front')->getRequest();
8
-
9
- if(isset($request->oct8ne))
10
- {
11
  $theme = Mage::getStoreConfig('design/oct8nedesign/theme');
12
-
13
- if($request->oct8ne != 'defaultpackage')
14
- {
15
  $package = Mage::getStoreConfig('design/oct8nedesign/package');
16
- if(empty($package))
17
  $package = "default";
 
18
  } else {
19
  Mage::register('oct8ne_defaultpackage', 1);
20
  }
21
-
22
- if(empty($theme))
23
  $theme = "oct8ne";
 
24
 
25
- // $th = Mage::getDesign()->getFallbackTheme();
26
  Mage::getDesign()->setPackageName($package);
27
  Mage::getDesign()->setTheme($theme);
28
  Mage::register('oct8ne', 1);
29
- // Mage::getModel('core/url')->setRouteParam('oct8ne', 1);
30
  }
31
-
32
- if(strpos($request->getPathInfo(), '/oct8ne/frame') !== FALSE)
33
- {
34
  Mage::register('oct8ne_rewrite', 1); // lo usamos para deshabilitar el redirect
35
  }
36
  }
37
-
38
- public function layoutRenderBefore($observer)
39
- {
40
- $session = Mage::getSingleton('core/session');
41
- $logged_in = $session->getData("notify_oct8ne", null);
42
- if(!is_null($logged_in))
43
- {
44
- $customer = Mage::getSingleton('customer/session')->getCustomer();
45
-
46
- $session->unsetData("notify_oct8ne");
47
- $layout = Mage::getSingleton('core/layout');
48
-
49
- $head = $layout->getBlock('root')->getChild('head');
50
- if (is_object($head)) {
51
- $head->addItem("script", "oct8ne-notify", <<<EOT
52
- function lookForOct8neIFrameLoaded() {
53
- var iframe = document.getElementById( 'oct8ne-iframe-return' );
54
- if ( iframe == null )
55
- setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
56
- else {
57
- var post_data = {
58
- user: {
59
- id: {$customer->getId()},
60
- firstName: "{$customer->getFirstname()}",
61
- lastName: "{$customer->getLastname()}",
62
- email: "{$customer->getEmail()}"
63
- }
64
- };
65
- iframe.contentWindow.postMessage( JSON.stringify(post_data), '*' );
66
- }
67
- };
68
- lookForOct8neIFrameLoaded();
69
- EOT
70
- );
71
-
72
- }
73
- }
74
-
75
- $logged_out = $session->getData("notify_oct8ne_logout", null);
76
- if(!is_null($logged_out))
77
- {
78
- // $customer = Mage::getSingleton('customer/session')->getCustomer();
79
-
80
- $session->unsetData("notify_oct8ne_logout");
81
- $layout = Mage::getSingleton('core/layout');
82
-
83
- $head = $layout->getBlock('root')->getChild('head');
84
- if (is_object($head)) {
85
- $head->addItem("script", "oct8ne-notify", <<<EOT
86
- function lookForOct8neIFrameLoaded() {
87
- var iframe = document.getElementById( 'oct8ne-iframe-return' );
88
- if ( iframe == null )
89
- setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
90
- else
91
- iframe.contentWindow.postMessage( 'logout', '*' );
92
- }
93
- lookForOct8neIFrameLoaded();
94
- EOT
95
- );
96
-
97
- }
98
- }
99
- }
100
-
101
  /**
102
- * Get checkout session model instance
103
- *
104
- * @return Mage_Checkout_Model_Session
105
- */
106
- protected function _getSession() { return Mage::getSingleton('checkout/session'); }
107
-
108
- public function placeOrderBefore($observer)
109
- {
 
110
  $order = $observer->getEvent()->getOrder();
111
- $oct8ne_products = $this->_getSession()->getOct8neProducts();
112
- if(!is_array($oct8ne_products))
113
- $oct8ne_products = array();
114
 
115
- $items = $order->getAllItems();
116
- foreach($items as $item)
117
- {
118
  $product = $item->getProduct();
119
  $qty = $item->getQtyOrdered();
120
- /*
121
- foreach($oct8ne_products as $op)
122
- {
123
- $found = false;
124
- if($op->getId() == $product->getId())
125
- $found = true;
126
- }
127
- */
128
- $found = in_array($product->getId(), $oct8ne_products);
129
  $session = Mage::getModel('core/cookie')->get('oct8ne-session');
130
-
131
  $model = Mage::getModel('oct8ne/orderproducts');
132
  $model->setOrderId($order->getId());
133
  $model->setCustomerId($order->getCustomerId());
134
  $model->setProductId($product->getId());
135
- $model->setProductPrice($product->getPrice());
136
- $model->setOrderPrice($order->getGrandTotal());
137
  $model->setCreatedAt($order->getCreatedAt());
138
- // $model->setOct8ne($found?'Y':'N');
139
  $model->setOct8ne($session);
140
  $model->setQty($qty);
141
  $model->setCurrency($order->getOrderCurrency()->getCode());
142
  $model->save();
143
  }
144
  }
145
-
146
- public function saveQuoteAfter($observer)
147
- {
148
  $quote = $observer->getEvent()->getQuote();
 
149
  // Eliminar los datos anteriores
150
- foreach (Mage::getModel('oct8ne/quoteproducts')->getCollection()->addFilter('quote_id', $quote->getId()) as $ccitem) {
 
 
 
 
151
  $ccitem->delete();
152
  }
 
 
 
 
153
 
154
- // Añadir los nuevos
155
- $items = $quote->getAllItems();
156
- foreach($items as $item)
157
- {
158
  $product = $item->getProduct();
159
  $qty = $item->getQty();
160
 
161
- $session = Mage::getModel('core/cookie')->get('oct8ne-session');
162
-
163
  $model = Mage::getModel('oct8ne/quoteproducts');
164
  $model->setQuoteId($quote->getId());
165
  $model->setCustomerId($quote->getCustomerId());
166
  $model->setProductId($product->getId());
167
- $model->setProductPrice($product->getPrice());
168
- $model->setQuotePrice($quote->getGrandTotal());
169
  $model->setCreatedAt($quote->getCreatedAt());
170
  $model->setOct8ne($session);
171
  $model->setQty($qty);
172
  $model->setCurrency($quote->getQuoteCurrencyCode());
173
  $model->save();
174
-
175
- // echo $order->getOrderCurrency()->getCode(); /* $item['oct8ne']; */
176
  }
177
  }
178
-
179
- public function checkDomainPolicyHeader($observer)
180
- {
181
- if(Mage::registry('oct8ne') === 1 || Mage::registry('oct8ne_rewrite') === 1)
182
- {
183
  $action = $observer->getControllerAction();
184
 
185
  $response = $action->getResponse();
186
  $response->setHeader('X-Frame-Options', null, true);
187
  }
188
-
189
  return $this;
190
  }
191
-
192
- public function addToCartAjaxOct($observer) /*DEPRECATED ??*/
193
- {
194
- if($_GET['oct8ne'] == '1'){
195
- $productId = $observer->getProduct()->getId();
196
- echo '<script type="text/javascript">
197
- parent.postMessage("qty:<?php echo $qty ?>", "*");
198
- parent.postMessage("closeIframe", "*");
199
- </script>';
200
-
201
- // Mage::log("ERROR !!!!!", null, 'addToCartAjaxOctLog.log');
202
- }
203
- }
204
-
205
-
206
- public function updatedCartOct($observer)
207
- {
208
- $quote_data = Mage::helper('oct8ne/customer_data')->gatherCartData();
209
  $quote_data = json_encode($quote_data); // Esta es la variable que se tiene que mandar por POST
210
- $quote_data = str_replace("&","#0#",$quote_data);
211
-
212
- $oct8ne_url = "backoffice.oct8ne.com/PlatformConnection/UpdateCart";
213
- $visitor = $_COOKIE["TokenVisitor"];
214
-
215
- if ($visitor != null){
216
- if(function_exists('curl_init') == 1)
217
- {
218
- $ch = curl_init($oct8ne_url);
219
- curl_setopt($ch, CURLOPT_POST, 1);
220
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'cart='.$quote_data.'&visitor='.$visitor);
221
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
222
- $response = curl_exec($ch);
223
- curl_close($ch);
224
- }
225
- }
226
-
227
  }
228
  }
1
  <?php
2
 
3
+ class LetsSyncroLLC_Oct8ne_Model_Observer {
4
+
5
+ public function interceptMethod($observer) {
6
+ $request = $observer->getEvent()->getData('front')->getRequest();
7
+
8
+ if (isset($request->oct8ne)) {
 
 
9
  $theme = Mage::getStoreConfig('design/oct8nedesign/theme');
10
+
11
+ if ($request->oct8ne != 'defaultpackage') {
 
12
  $package = Mage::getStoreConfig('design/oct8nedesign/package');
13
+ if (empty($package)) {
14
  $package = "default";
15
+ }
16
  } else {
17
  Mage::register('oct8ne_defaultpackage', 1);
18
  }
19
+
20
+ if (empty($theme)) {
21
  $theme = "oct8ne";
22
+ }
23
 
 
24
  Mage::getDesign()->setPackageName($package);
25
  Mage::getDesign()->setTheme($theme);
26
  Mage::register('oct8ne', 1);
 
27
  }
28
+
29
+ if (strpos($request->getPathInfo(), '/oct8ne/frame') !== FALSE) {
 
30
  Mage::register('oct8ne_rewrite', 1); // lo usamos para deshabilitar el redirect
31
  }
32
  }
33
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /**
35
+ * Get checkout session model instance
36
+ *
37
+ * @return Mage_Checkout_Model_Session
38
+ */
39
+ protected function _getSession() {
40
+ return Mage::getSingleton('checkout/session');
41
+ }
42
+
43
+ public function placeOrderBefore($observer) {
44
  $order = $observer->getEvent()->getOrder();
45
+ $items = $order->getAllVisibleItems();
 
 
46
 
47
+ foreach ($items as $item) {
 
 
48
  $product = $item->getProduct();
49
  $qty = $item->getQtyOrdered();
 
 
 
 
 
 
 
 
 
50
  $session = Mage::getModel('core/cookie')->get('oct8ne-session');
 
51
  $model = Mage::getModel('oct8ne/orderproducts');
52
  $model->setOrderId($order->getId());
53
  $model->setCustomerId($order->getCustomerId());
54
  $model->setProductId($product->getId());
55
+ $model->setProductPrice($product->getPrice()); // getFinalPrice?
56
+ $model->setOrderPrice($order->getGrandTotal()); // getSubtotal?
57
  $model->setCreatedAt($order->getCreatedAt());
 
58
  $model->setOct8ne($session);
59
  $model->setQty($qty);
60
  $model->setCurrency($order->getOrderCurrency()->getCode());
61
  $model->save();
62
  }
63
  }
64
+
65
+ public function saveQuoteAfter($observer) {
66
+
67
  $quote = $observer->getEvent()->getQuote();
68
+
69
  // Eliminar los datos anteriores
70
+ $items = Mage::getModel('oct8ne/quoteproducts')
71
+ ->getCollection()
72
+ ->addFilter('quote_id', $quote->getId());
73
+
74
+ foreach ($items as $ccitem) {
75
  $ccitem->delete();
76
  }
77
+
78
+ // Añadir el estado actual del carrito
79
+ $session = Mage::getModel('core/cookie')->get('oct8ne-session');
80
+ $items = $quote->getAllVisibleItems();
81
 
82
+ foreach ($items as $item) {
 
 
 
83
  $product = $item->getProduct();
84
  $qty = $item->getQty();
85
 
 
 
86
  $model = Mage::getModel('oct8ne/quoteproducts');
87
  $model->setQuoteId($quote->getId());
88
  $model->setCustomerId($quote->getCustomerId());
89
  $model->setProductId($product->getId());
90
+ $model->setProductPrice($product->getPrice()); // getFinalPrice?
91
+ $model->setQuotePrice($quote->getGrandTotal()); // getSubtotal?
92
  $model->setCreatedAt($quote->getCreatedAt());
93
  $model->setOct8ne($session);
94
  $model->setQty($qty);
95
  $model->setCurrency($quote->getQuoteCurrencyCode());
96
  $model->save();
 
 
97
  }
98
  }
99
+
100
+ public function checkDomainPolicyHeader($observer) {
101
+ if (Mage::registry('oct8ne') === 1 || Mage::registry('oct8ne_rewrite') === 1) {
 
 
102
  $action = $observer->getControllerAction();
103
 
104
  $response = $action->getResponse();
105
  $response->setHeader('X-Frame-Options', null, true);
106
  }
 
107
  return $this;
108
  }
109
+
110
+ public function updatedCartOct($observer) {
111
+ $quote_data = Mage::helper('oct8ne/customerData')->getCartData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  $quote_data = json_encode($quote_data); // Esta es la variable que se tiene que mandar por POST
113
+ $quote_data = str_replace("&", "#0#", $quote_data);
114
+
115
+ $oct8neHostName = Mage::helper("oct8ne/url")->getOct8neHostName();
116
+ $oct8ne_url = $oct8neHostname . "/PlatformConnection/UpdateCart";
117
+
118
+ $visitor = $_COOKIE["TokenVisitor"];
119
+
120
+ if ($visitor != null) {
121
+ if (function_exists('curl_init') == 1) {
122
+ $ch = curl_init($oct8ne_url);
123
+ curl_setopt($ch, CURLOPT_POST, 1);
124
+ curl_setopt($ch, CURLOPT_POSTFIELDS, 'cart=' . $quote_data . '&visitor=' . $visitor);
125
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
126
+ $response = curl_exec($ch);
127
+ curl_close($ch);
128
+ }
129
+ }
130
  }
131
  }
app/code/community/LetsSyncroLLC/Oct8ne/controllers/FrameController.php CHANGED
@@ -2,57 +2,29 @@
2
 
3
  class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Action {
4
 
5
- protected function _checkApitoken()
6
- {
7
- $letssyncromodel = Mage::getModel('oct8ne/letssyncro')->load(1);
8
-
9
- $token = $letssyncromodel->getApitoken();
10
-
11
- $apitoken = $this->getRequest()->getParam('apitoken', null);
12
- if($apitoken != $token)
13
- die("Access denied.");
14
- }
15
-
16
- public function indexAction() {
17
- // $this->_checkApitoken();
18
-
19
- $this->loadLayout();
20
- $this->renderLayout();
21
- }
22
-
23
- public function customerdataAction() {
24
- // $this->_checkApitoken();
25
- $callback = $this->getRequest()->getParam('callback', null);
26
-
27
- $login_data = Mage::helper('oct8ne/customer_data')->gatherLoginData();
28
- $wishlist_data = Mage::helper('oct8ne/customer_data')->gatherWishlistData();
29
- $quote_data = Mage::helper('oct8ne/customer_data')->gatherCartData();
30
 
31
  $results = array(
32
- 'user' => array(
33
- 'id' => $login_data['id'],
34
- 'firstName' => $login_data['first_name'],
35
- 'lastName' => $login_data['last_name'],
36
- 'email' => $login_data['email'],
37
- 'whislist' => $wishlist_data,
38
- 'cart' => $quote_data
39
- )
40
  );
41
-
42
- $response = json_encode($results);
43
- $response = $callback."(".$response.");";
44
-
45
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
46
- $this->getResponse()->setBody($response);
47
  }
48
 
 
49
  public function productviewAction() {
50
  Mage::register('oct8ne_rewrite', 1, true); // lo usamos para deshabilitar el redirect
51
- // $this->_checkApitoken();
52
 
53
- // Get initial data from request
54
  $categoryId = (int) $this->getRequest()->getParam('category', false);
55
- $productId = (int) $this->getRequest()->getParam('id');
56
  $specifyOptions = $this->getRequest()->getParam('options');
57
 
58
  // Prepare helper and params
@@ -67,7 +39,7 @@ class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Ac
67
  $viewHelper->prepareAndRender($productId, $this, $params);
68
  } catch (Exception $e) {
69
  if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
70
- if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
71
  $this->_redirect('');
72
  } elseif (!$this->getResponse()->isRedirect()) {
73
  $this->_forward('noRoute');
@@ -79,462 +51,111 @@ class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Ac
79
  }
80
  }
81
 
82
- /**
83
- * Initialize product instance from request data
84
- *
85
- * @return Mage_Catalog_Model_Product || false
86
- */
87
- protected function _initProduct() {
88
- $productId = (int) $this->getRequest()->getParam('product');
89
-
90
- if ($productId) {
91
- $product = Mage::getModel('catalog/product')
92
- ->setStoreId(Mage::app()->getStore()->getId())
93
- ->load($productId);
94
- if ($product->getId())
95
- return $product;
96
- }
97
-
98
- return false;
99
- }
100
-
101
- public function add2cartAction() {
102
- // $this->_checkApitoken();
103
-
104
- $cart = $this->_getCart();
105
- $params = $this->getRequest()->getParams();
106
- try {
107
- if (isset($params['qty'])) {
108
- $filter = new Zend_Filter_LocalizedToNormalized(
109
- array('locale' => Mage::app()->getLocale()->getLocaleCode())
110
- );
111
- $params['qty'] = $filter->filter($params['qty']);
112
- }
113
 
114
- $product = $this->_initProduct();
115
- $related = $this->getRequest()->getParam('related_product');
 
116
 
117
- /**
118
- * Check product availability
119
- */
120
- if ( !$product ) {
121
- $this->_goBack();
122
- return;
123
- }
124
-
125
- $cart->addProduct($product, $params);
126
-
127
- if (!empty($related)) {
128
- $cart->addProductsByIds(explode(',', $related));
129
- }
130
-
131
- $cart->save();
132
-
133
- $this->_getSession()->setCartWasUpdated(true);
134
-
135
- /**
136
- * @todo remove wishlist observer processAddToCart
137
- */
138
- Mage::dispatchEvent('checkout_cart_add_product_complete',
139
- array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
140
- );
141
-
142
- if (!$cart->getQuote()->getHasError()){
143
- $products = $this->_getSession()->getOct8neProducts();
144
- if(!is_array($products))
145
- $products = array();
146
- $products[] = $product->getId();
147
- $this->_getSession()->setOct8neProducts($products);
148
-
149
- // Este mensaje se deshabilita porque sale a destiempo, cuando el parámetro no sea oct8ne
150
- // $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
151
- // $this->_getSession()->addSuccess($message);
152
- }
153
-
154
- $this->loadLayout();
155
- $this->renderLayout();
156
-
157
- } catch (Mage_Core_Exception $e) {
158
- if ($this->_getSession()->getUseNotice(true)) {
159
- $this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
160
- } else {
161
- $messages = array_unique(explode("\n", $e->getMessage()));
162
- foreach ($messages as $message)
163
- $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
164
- }
165
- } catch (Exception $e) {
166
- // $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
167
- Mage::logException($e);
168
- $this->_goBack();
169
- }
170
- }
171
-
172
- /**
173
- * Retrieve child categories of current category
174
- *
175
- * @return Varien_Data_Tree_Node_Collection
176
- */
177
- public function getCurrentChildCategories()
178
- {
179
- $layer = Mage::getSingleton('catalog/layer');
180
- $category = $layer->getCurrentCategory();
181
- /* @var $category Mage_Catalog_Model_Category */
182
- $categories = $category->getChildrenCategories();
183
- $productCollection = Mage::getResourceModel('catalog/product_collection');
184
- $layer->prepareProductCollection($productCollection);
185
- $productCollection->addCountToCategories($categories);
186
- return $categories;
187
- }
188
 
189
- /**
190
- * Retrieve request object
191
- *
192
- * @return Mage_Core_Controller_Request_Http
193
- * @throws Exception
194
- */
195
- public function getRequest()
196
- {
197
- $controller = Mage::app()->getFrontController();
198
- if ($controller) {
199
- $this->_request = $controller->getRequest();
200
- } else {
201
- throw new Exception(Mage::helper('core')->__("Can't retrieve request object"));
202
- }
203
- return $this->_request;
204
  }
205
 
206
- protected function searchAction()
207
- {
208
- // $this->_checkApitoken();
209
-
210
- $search_criteria = $this->getRequest()->getParam('search', null);
211
- $search_order = $this->getRequest()->getParam('orderby', null);
212
- $search_dir = $this->getRequest()->getParam('dir', null);
213
-
214
  $storeId = $this->getRequest()->getParam('store', null);
215
  $currency = $this->getRequest()->getParam('currency', null);
216
 
217
- if(is_null($storeId))
218
- {
219
  $storeId = Mage::app()->getStore()->getId();
220
  $initialEnvironmentInfo = null;
221
- }
222
- else
223
- {
224
  $appEmulation = Mage::getSingleton('core/app_emulation');
225
  // Start environment emulation of the specified store
226
  $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
227
  }
228
 
229
  $currentCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
230
- if(!is_null($currency))
231
  Mage::app()->getStore()->setCurrentCurrencyCode($currency);
232
 
233
- $callback = $this->getRequest()->getParam('callback', null);
234
  $this->getRequest()->setParam('q', $search_criteria);
235
-
236
- if(is_null($search_criteria) || strlen($search_criteria)==0){
237
- //passem totes les dades buides per tal que no mostri resultats
238
- Mage::register('total_search_results', 0);
239
- Mage::register('search_result_collection', array());
240
- Mage::register('partial_search', false);
241
- Mage::register('callback', $callback);
242
- Mage::register('search_result_attrs', array());
243
- Mage::register('search_result_attrs_applied', array());
244
- Mage::register('search_result_attrs_available', array());
245
-
246
  Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
247
-
248
  $results = array(
249
  'total' => 0,
250
  'results' => array(),
251
  'filters' => array(
252
- 'Applied' => array(),
253
- 'Available' => array()
254
  )
255
  );
256
-
257
- $response = json_encode($results);
258
- $response = $callback."(".$response.");";
259
-
260
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
261
- $this->getResponse()->setBody($response);
262
  return;
263
  }
264
- // $this->getRequest()->setParam('order', $search_sort);
265
- // $this->getRequest()->setParam('dir', $search_order);
266
-
267
- // de esto se encarga Magento $search_criteria = Mage::helper('core/string')->cleanString( $search_criteria );
268
- //die(Mage::app()->getStore()->getId());
269
- $query = Mage::helper('catalogsearch')->getQuery();
270
- $query->setStoreId($storeId);
271
- if ($query->getId()) {
272
- $query->setPopularity($query->getPopularity()+1);
273
- }
274
- else {
275
- $query->setPopularity(1);
276
- }
277
- $query->prepare();
278
- Mage::helper('catalogsearch')->checkNotes();
279
-
280
- $query = Mage::getModel('catalogsearch/layer');
281
-
282
- $filterableAttributes = $query->getFilterableAttributes();
283
- $attrs = array();
284
-
285
- if(!empty($filterableAttributes))
286
- {
287
- $tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();
288
- $tmp->SetAttributeCode('category');
289
- $tmp->setFrontendLabel('Category');
290
- $filterableAttributes->addItem($tmp);
291
- }
292
-
293
- foreach ($filterableAttributes as $attribute)
294
- {
295
- $code = $attribute->getAttributeCode();
296
- $name = $attribute->getFrontendLabel();
297
-
298
- // INIT
299
- $items = array();
300
- switch($code)
301
- {
302
- case 'price':
303
- $_filterModelName = "catalog/layer_filter_price";
304
- break;
305
- case 'decimal':
306
- $_filterModelName = "catalog/layer_filter_decimal";
307
- break;
308
- case 'category':
309
- $_filterModelName = "catalog/layer_filter_category";
310
- break;
311
- default:
312
- $_filterModelName = "catalog/layer_filter_attribute";
313
- break;
314
- }
315
-
316
- $filter = Mage::getModel($_filterModelName)
317
- ->setLayer($query)
318
- ->setAttributeModel($attribute);
319
- $filter->apply($this->getRequest(), $this);
320
- $items = $filter->getItems();
321
- // INIT
322
-
323
- // En los filtros aplicados no nos viene el nombre, solo el id, lo obtenemos aqui
324
- $optionId = $this->getRequest()->getParam($filter->getRequestVar());
325
- $featurename = "";
326
- if(!is_null($optionId)) {
327
- switch($code)
328
- {
329
- case 'price':
330
- $featurename = $this->getRequest()->get($code);
331
- break;
332
- case 'decimal':
333
- $featurename = $this->getRequest()->get($code);
334
- break;
335
- case 'category':
336
- $featurename = $filter->getCategory()->getName();
337
- break;
338
- default:
339
- $featurename = $filter->getAttributeModel()->getFrontend()->getOption($optionId);
340
- break;
341
- }
342
-
343
- }
344
-
345
- $options = array();
346
- foreach($items as $item)
347
- {
348
- if($item->getCount() > 0)
349
- $options[] = array("Name" => $item->getLabel(), "Param" => $item->getValue(), "Qty" => $item->getCount());
350
- }
351
-
352
- $attrs[] = array(
353
- 'Param' => $code,
354
- 'Name' => $name,
355
- 'Features' => $options,
356
- 'FeatureName' => $featurename
357
- );
358
- }
359
 
360
  $attrs_applied = array();
361
  $attrs_available = array();
362
- foreach($attrs as $attr)
363
- {
364
- if(!is_null($this->getRequest()->getParam($attr['Param'])))
365
- {
366
- $attr['value'] = $this->getRequest()->getParam($attr['Param']);
367
- $attrs_applied[] = $attr;
368
- }
369
- else
370
- {
371
- $attrs_available[] = $attr;
372
- }
373
- }
374
 
375
- $result_collection = $query->getProductCollection();
376
-
377
- $order = Mage::getSingleton('catalog/session')->getSortOrder();
378
- $dir = Mage::getSingleton('catalog/session')->getSortDirection();
379
-
380
- if(!$order)
381
- $order = "relevance"; // Mage::getStoreConfig( Mage_Catalog_Model_Config::XML_PATH_LIST_DEFAULT_SORT_BY );
382
- if(!$dir)
383
- $dir = "asc";
384
-
385
- if($search_order)
386
- {
387
- if(!$search_dir)
388
- $search_dir = "asc";
389
- $result_collection->setOrder($search_order, $search_dir);
390
- } else if ($order) {
391
- $result_collection->setOrder($order, $dir);
392
- }
393
 
394
- $total_search_results = $result_collection->count();
395
 
396
- $currency = Mage::helper('oct8ne/customer_data')->getCurrency();
397
- $v = array();
398
- if ( is_numeric( $this->getRequest()->getParam('start') ) )
399
- $start = $this->getRequest()->getParam('start');
400
- else
401
- $start = 0;
402
- if ( is_numeric( $this->getRequest()->getParam('items') ) )
403
- $items = $this->getRequest()->getParam('items');
404
- else
405
- $items = 10;
406
-
407
- $new_collection = array();
408
- $i0 = $start;
409
- $i1 = $i0 + $items;
410
- $i = 0;
411
- foreach( $result_collection as $item ) {
412
- if ( $i >= $i0 && $i < $i1 )
413
- $new_collection[] = $item;
414
- $i++;
415
- }
416
- $result_collection = $new_collection;
417
 
418
- foreach( $result_collection as $item ) {
419
- $id = $item->getId();
420
- $v[] = Mage::helper('oct8ne')->getProductInfo($id);
 
 
 
 
 
421
  }
422
-
 
423
  $results = array(
424
  'total' => $total_search_results,
425
- 'results' => $v,
426
  'filters' => array(
427
- 'Applied' => $attrs_applied,
428
- 'Available' => $attrs_available
429
  )
430
  );
431
 
432
- if(!is_null($initialEnvironmentInfo))
433
- {
434
  //Stop environment emulation and restore original store
435
  $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
436
  }
437
 
438
  Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
439
 
440
- $callback = $this->getRequest()->getParam('callback', null);
441
- $response = json_encode($results);
442
- $response = $callback."(".$response.");";
443
-
444
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
445
- $this->getResponse()->setBody($response);
446
- }
447
-
448
- /**
449
- * Get checkout session model instance
450
- *
451
- * @return Mage_Checkout_Model_Session
452
- */
453
- protected function _getSession() { return Mage::getSingleton('checkout/session'); }
454
-
455
- /**
456
- * Set back redirect url to response
457
- *
458
- * @return Mage_Checkout_CartController
459
- */
460
- protected function _goBack() {
461
- $returnUrl = $this->getRequest()->getParam('return_url');
462
- if ( $returnUrl ) {
463
-
464
- if (!$this->_isUrlInternal($returnUrl))
465
- throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
466
-
467
- $this->_getSession()->getMessages(true);
468
- $this->getResponse()->setRedirect($returnUrl);
469
-
470
- } elseif ( $backUrl = $this->_getRefererUrl() )
471
- $this->getResponse()->setRedirect($backUrl);
472
-
473
- return $this;
474
  }
475
 
476
- /**
477
- * Retrieve shopping cart model object
478
- *
479
- * @return Mage_Checkout_Model_Cart
480
- */
481
- protected function _getCart() { return Mage::getSingleton('checkout/cart'); }
482
-
483
- public function search2Action() {
484
- // $this->_checkApitoken();
485
-
486
- $query = Mage::helper('oct8ne/search')->getQuery();
487
- /* @var $query Mage_CatalogSearch_Model_Query */
488
-
489
- $query->setStoreId(Mage::app()->getStore()->getId());
490
-
491
- if ($query->getQueryText() != '') {
492
- if (Mage::helper('catalogsearch')->isMinQueryLength())
493
- $query->setId(0)
494
- ->setIsActive(1)
495
- ->setIsProcessed(1);
496
- else {
497
- if ($query->getId())
498
- $query->setPopularity($query->getPopularity()+1);
499
- else
500
- $query->setPopularity(1);
501
-
502
- if ($query->getRedirect()) {
503
- $query->save();
504
- $this->getResponse()->setRedirect($query->getRedirect());
505
- return;
506
- } else
507
- $query->prepare();
508
- }
509
-
510
- Mage::helper('catalogsearch')->checkNotes();
511
-
512
- $this->loadLayout();
513
- $this->_initLayoutMessages('catalog/session');
514
- $this->_initLayoutMessages('checkout/session');
515
- $this->renderLayout();
516
 
517
- if (!Mage::helper('catalogsearch')->isMinQueryLength())
518
- $query->save();
519
- }
520
-
521
- }
522
-
523
- public function getcartAction()
524
- {
525
- // $this->_checkApitoken();
526
- $result = array();
527
- $cart = $this->_getCart();
528
- foreach($cart->getItems() as $item)
529
- {
530
  $product = $item->getProduct();
531
  $qty = $item->getQty();
532
  $type = $product->getTypeId();
533
 
534
- if($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
535
- || $type == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL
536
- ){
537
- $result[] = Mage::helper('oct8ne')->getProductInfo($product->getId(), $qty);
538
  }
539
  }
540
 
@@ -543,165 +164,188 @@ class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Ac
543
  'results' => $result
544
  );
545
 
546
- $callback = $this->getRequest()->getParam('callback', null);
547
- $response = json_encode($results);
548
- $response = $callback."(".$response.");";
549
-
550
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
551
- $this->getResponse()->setBody($response);
552
  }
553
 
554
- public function getwishlistAction()
555
- {
556
- // $this->_checkApitoken();
557
- $customer = $this->getRequest()->getParam('customer', null);
 
 
 
 
 
 
 
 
558
 
559
- $result_collection = Mage::helper( 'oct8ne/wishlist' )->getWishlist($customer);
 
 
 
 
 
 
 
560
 
 
 
561
  $results = array(
562
  'total' => count($result_collection),
563
  'results' => $result_collection
564
  );
565
-
566
- $callback = $this->getRequest()->getParam('callback', null);
567
- $response = json_encode($results);
568
- $response = $callback."(".$response.");";
569
-
570
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
571
- $this->getResponse()->setBody($response);
572
  }
573
 
574
- public function addtowishlistAction()
575
- {
576
- // $this->_checkApitoken();
577
- $api = Mage::helper( 'oct8ne/wishlist' );
 
 
 
 
 
 
 
578
 
579
- $result = $api->addToWishlist(
580
- $this->getRequest()->getParam('product', null),
581
- $this->getRequest()->getParam('customer', null)
582
- );
 
 
 
583
 
584
- $results = array(
585
- 'result' => $result
586
- );
 
 
 
 
587
 
588
- $callback = $this->getRequest()->getParam('callback', null);
589
- $response = json_encode($results);
590
- $response = $callback."(".$response.");";
591
 
592
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
593
- $this->getResponse()->setBody($response);
 
 
 
 
594
  }
595
 
596
- public function removefromwishlistAction()
597
- {
598
- // $this->_checkApitoken();
599
- $api = Mage::helper( 'oct8ne/wishlist' );
600
- $result = $api->removeFromWishlist(
601
- $this->getRequest()->getParam('product', null),
602
- $this->getRequest()->getParam('customer', null)
603
- );
604
-
605
- $results = array(
606
- 'result' => $result
607
- );
608
 
609
- $callback = $this->getRequest()->getParam('callback', null);
610
- $response = json_encode($results);
611
- $response = $callback."(".$response.");";
612
 
613
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
614
- $this->getResponse()->setBody($response);
615
- }
 
 
616
 
617
- public function productInfoAction()
618
- {
619
- // $this->_checkApitoken();
620
- $products = $this->getRequest()->getParam('id', null);
621
- $products_Id = explode(',', $products);
 
 
 
 
 
622
 
623
- $result_collection = array();
624
- foreach($products_Id as $id)
625
- $result_collection[] = Mage::helper('oct8ne')->getProductInfo($id);
 
 
 
 
 
 
 
 
 
 
 
 
626
 
627
  $results = array(
628
- 'results' => $result_collection
 
629
  );
630
-
631
- $callback = $this->getRequest()->getParam('callback', null);
632
- $response = json_encode($results);
633
- $response = $callback."(".$response.");";
634
-
635
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
636
- $this->getResponse()->setBody($response);
637
  }
638
 
639
- public function getVersionAction()
640
- {
641
- $version = Mage::helper('oct8ne')->getExtensionVersion();
 
 
 
 
 
642
 
643
  $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
644
- $this->getResponse()->setBody(json_encode($version));
645
  }
646
 
647
- public function productRelatedAction()
648
- {
649
- // $this->_checkApitoken();
650
- $product_id = $this->getRequest()->getParam('id', null);
651
-
652
- $results = array(
653
- 'results' => Mage::helper('oct8ne')->getRelatedProducts($product_id)
654
- );
655
-
656
- $callback = $this->getRequest()->getParam('callback', null);
657
- $response = json_encode($results);
658
- $response = $callback."(".$response.");";
659
 
 
 
 
 
 
 
660
  $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
661
  $this->getResponse()->setBody($response);
662
  }
663
 
664
- protected function resizeImg($fileName, $width, $height = null)
665
- {
666
- $folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
667
- $imageURL = $folderURL . $fileName;
668
-
669
- $basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . $fileName;
670
- $newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "resized" . DS . $width . DS . $fileName;
671
- //if width empty then return original size image's URL
672
- if ($width != '') {
673
- //if image has already resized then just return URL
674
- if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
675
- $imageObj = new Varien_Image($basePath);
676
- if($imageObj->getOriginalWidth() <= $width)
677
- return $basePath;
678
- $imageObj->constrainOnly(TRUE);
679
- $imageObj->keepAspectRatio(FALSE);
680
- $imageObj->keepFrame(FALSE);
681
- $imageObj->resize($width, $height);
682
- $imageObj->save($newPath);
683
- }
684
- $resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "resized" . DS . $fileName;
685
- } else {
686
- $resizedURL = $imageURL;
687
- }
688
- return $newPath; // $resizedURL;
689
  }
690
 
691
- public function imageAction()
692
- {
693
- // $this->_checkApitoken();
 
 
694
 
695
- $base = Mage::getBaseDir('media');
696
- $file = $this->getRequest()->getParam('file', null);
697
- $width = $this->getRequest()->getParam('width', null);
 
 
698
 
699
- if($width == null)
700
- $newfile = "$base/$file";
701
- else
702
- $newfile = $this->resizeImg($file, $width);
 
 
 
 
703
 
704
- $mime_types = array(
 
705
  'png' => 'image/png',
706
  'jpe' => 'image/jpeg',
707
  'jpeg' => 'image/jpeg',
@@ -714,118 +358,119 @@ class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Ac
714
  'svg' => 'image/svg+xml',
715
  'svgz' => 'image/svg+xml',
716
  );
717
- $path_parts = pathinfo($newfile);
718
- $mime = $mime_types[strtolower($path_parts['extension'])];
719
-
720
- $this->getResponse()->clearHeaders();
721
- $this->getResponse()->setHeader('Content-Type', $mime, true);
722
- $this->getResponse()->setHeader('Cache-Control', 'max-age: 300', true);
723
- $this->getResponse()->setHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 86400), true);
724
- $this->getResponse()->setHeader('Pragma', 'cache', true);
725
- $this->getResponse()->setHeader('Age', '0', true);
726
 
727
- $this->getResponse()->setBody(file_get_contents($newfile));
 
 
 
 
 
 
 
 
728
  }
729
 
730
- public function getReportDataAction()
731
- {
732
- $this->_checkApitoken();
 
 
 
 
 
 
 
733
 
734
- $callback = $this->getRequest()->getParam('callback', null);
735
- $from = $this->getRequest()->getParam('from', null);
736
- $to = $this->getRequest()->getParam('to', null);
737
- $report = $this->getRequest()->getParam('report', null);
738
 
739
- $result_collection = Mage::getModel('oct8ne/'.$report.'products')->getCollection();
740
- if( !empty($from) )
741
- $result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
742
- if( !empty($to) )
743
- $result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
744
-
745
- $v = array();
746
- foreach( $result_collection as $i => $item){
747
- $values = array(
748
- 'ProductId' => $item['product_id'],
749
- 'Qty' => $item['qty'],
750
- 'UserId' => $item['customer_id'],
751
- 'Oct8neSession' => $item['oct8ne'],
752
- 'Date' => $item['created_at'],
753
- 'ProductPrice' => $item['product_price'],
754
- 'Currency' => $item['currency'],
755
- );
756
 
757
- if($report == 'order')
758
- {
759
- $order = Mage::getModel('sales/order')->load($item['order_id']);
760
- if($order != null)
761
- {
762
- $orderValid = 1;
763
- $incrementId = $order->getIncrementId();
764
- $status = $order->getStatus();
765
- }
766
- else
767
- {
768
- $orderValid = 0;
769
- }
770
-
771
- $values += array(
772
- 'InternalId' => $item['orderproducts_id'],
773
- 'OrderId' => $item['order_id'],
774
- 'OrderValid' => $orderValid,
775
- 'IncrementId' => $incrementId,
776
- 'OrderPrice' => $item[$report . '_price'],
777
- 'Status' => $status
778
- );
779
- }else if($report == 'quote')
780
- {
781
- $quote = Mage::getModel('sales/order')->load($item['quoteproducts_id']);
782
- if($quote != null)
783
- {
784
- $quoteValid = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  }
786
- else
787
- {
788
- $quoteValid = 0;
 
 
 
 
 
 
 
789
  }
790
-
791
- $values += array(
792
- 'InternalId' => $item['quoteproducts_id'],
793
- 'QuoteId' => $item['quote_id'],
794
- 'QuoteValid' => $quoteValid,
795
- 'QuotePrice' => $item[$report . '_price'],
796
- );
797
  }
798
 
799
- $v[] = $values;
 
 
 
 
 
800
  }
801
 
802
- $results = array(
803
- 'total' => $result_collection->getSize(),
804
- 'results' => $v
805
- );
806
- $response = json_encode($results);
807
- // $response = $callback."(".$response.");";
 
 
808
 
809
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
810
- $this->getResponse()->setBody($response);
811
- }
812
-
813
- public function systemcheckAction()
814
- {
815
- $text = array();
816
- $text[] = get_class( Mage::getModel('core/url') );
817
- $text[] = get_class( Mage::getModel('core/url_rewrite') );
818
- // $text[] = get_class( Mage::getModel('core/url_rewrite_request') );
819
- $text[] = get_class( Mage::getModel('core/design_package') );
820
- $text[] = get_class( Mage::getModel('checkout/type_onepage') );
821
- // $text[] = get_class( Mage::getModel('core/domainpolicy') );
822
- // $text[] = get_class( Mage::getBlock('catalog/product_view') );
823
- $text[] = get_class( $this->getLayout()->createBlock('catalog/product_view') );
824
- $text[] = get_class( $this->getLayout()->createBlock('page/html_head') );
825
-
826
- $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
827
- $this->getResponse()->setBody(implode("\n", $text));
828
- //echo get_class( Mage::getModel('Mage_Core_Model_Url') );
829
- //die;
830
  }
831
- };
 
2
 
3
  class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Action {
4
 
5
+ public function customerDataAction() {
6
+ $customerDataHelper = Mage::helper('oct8ne/customerData');
7
+ $login_data = $customerDataHelper->getLoginData();
8
+ $wishlist_data = $customerDataHelper->getWishlistData();
9
+ $cart = $customerDataHelper->getCartData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  $results = array(
12
+ 'id' => $login_data['id'],
13
+ 'firstName' => $login_data['first_name'],
14
+ 'lastName' => $login_data['last_name'],
15
+ 'email' => $login_data['email'],
16
+ 'wishlist' => $wishlist_data,
17
+ 'cart' => $cart
 
 
18
  );
19
+ $this->returnJson($results);
 
 
 
 
 
20
  }
21
 
22
+ // REVIEW: Remove this function?
23
  public function productviewAction() {
24
  Mage::register('oct8ne_rewrite', 1, true); // lo usamos para deshabilitar el redirect
 
25
 
 
26
  $categoryId = (int) $this->getRequest()->getParam('category', false);
27
+ $productId = (int) $this->getRequest()->getParam('id');
28
  $specifyOptions = $this->getRequest()->getParam('options');
29
 
30
  // Prepare helper and params
39
  $viewHelper->prepareAndRender($productId, $this, $params);
40
  } catch (Exception $e) {
41
  if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
42
+ if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
43
  $this->_redirect('');
44
  } elseif (!$this->getResponse()->isRedirect()) {
45
  $this->_forward('noRoute');
51
  }
52
  }
53
 
54
+ public function getAdapterInfoAction() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ $versionHelper = Mage::helper("oct8ne/version");
57
+ $apiVersion = $versionHelper->getApiVersion();
58
+ $adapterVersion = $versionHelper->getAdapterVersion();
59
 
60
+ $results = array(
61
+ "platform" => "Magento",
62
+ "adapterName" => "Oct8ne official adapter for Magento",
63
+ "adapterVersion" => $adapterVersion,
64
+ "developedBy" => "Oct8ne Inc",
65
+ "supportUrl" => "http://www.oct8ne.com/support/magento",
66
+ "apiVersion" => $apiVersion
67
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ $this->returnJson($results);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
 
72
+ public function searchAction() {
 
 
 
 
 
 
 
73
  $storeId = $this->getRequest()->getParam('store', null);
74
  $currency = $this->getRequest()->getParam('currency', null);
75
 
76
+ if (is_null($storeId)) {
 
77
  $storeId = Mage::app()->getStore()->getId();
78
  $initialEnvironmentInfo = null;
79
+ } else {
 
 
80
  $appEmulation = Mage::getSingleton('core/app_emulation');
81
  // Start environment emulation of the specified store
82
  $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
83
  }
84
 
85
  $currentCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
86
+ if (!is_null($currency))
87
  Mage::app()->getStore()->setCurrentCurrencyCode($currency);
88
 
89
+ $search_criteria = $this->getRequest()->getParam('search', null);
90
  $this->getRequest()->setParam('q', $search_criteria);
91
+ if (is_null($search_criteria) || strlen($search_criteria) == 0) {
 
 
 
 
 
 
 
 
 
 
92
  Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
 
93
  $results = array(
94
  'total' => 0,
95
  'results' => array(),
96
  'filters' => array(
97
+ 'applied' => array(),
98
+ 'available' => array()
99
  )
100
  );
101
+ $this->returnJson($results);
 
 
 
 
 
102
  return;
103
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  $attrs_applied = array();
106
  $attrs_available = array();
107
+ $products = $this->getFilteredProducts($storeId, $attrs_applied, $attrs_available);
 
 
 
 
 
 
 
 
 
 
 
108
 
109
+ $total_search_results = $products->getSize();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
+ $currency = Mage::helper('oct8ne/customerData')->getCurrency();
112
 
113
+ $search_order = $this->getRequest()->getParam('orderby', 'relevance');
114
+ $search_dir = $this->getRequest()->getParam('dir', 'asc');
115
+ $products->setOrder($search_order, $search_dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+ $page = $this->getRequest()->getParam("page", 1);
118
+ $pageSize = $this->getRequest()->getParam('pageSize', 10);
119
+ $products->setPageSize($pageSize)
120
+ ->setCurPage($page);
121
+
122
+ $ids = array();
123
+ foreach ($products as $item) {
124
+ $ids[] = $item->getId();
125
  }
126
+
127
+ $productInfos = Mage::helper('oct8ne')->getProductsInfoByIds($ids);
128
  $results = array(
129
  'total' => $total_search_results,
130
+ 'results' => $productInfos,
131
  'filters' => array(
132
+ 'applied' => $attrs_applied,
133
+ 'available' => $attrs_available
134
  )
135
  );
136
 
137
+ if (!is_null($initialEnvironmentInfo)) {
 
138
  //Stop environment emulation and restore original store
139
  $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
140
  }
141
 
142
  Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
143
 
144
+ $this->returnJson($results);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
 
147
+ public function getCartAction() {
148
+ $result = array();
149
+ $cart = Mage::getSingleton('checkout/cart');
150
+ $helper = Mage::helper('oct8ne');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
+ foreach ($cart->getItems() as $item) {
 
 
 
 
 
 
 
 
 
 
 
 
153
  $product = $item->getProduct();
154
  $qty = $item->getQty();
155
  $type = $product->getTypeId();
156
 
157
+ if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE || $type == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL) {
158
+ $result[] = $helper->getProductInfo($product->getId(), $qty);
 
 
159
  }
160
  }
161
 
164
  'results' => $result
165
  );
166
 
167
+ $this->returnJson($results);
 
 
 
 
 
168
  }
169
 
170
+ public function addToWishlistAction() {
171
+ $productIds = $this->getRequest()->getParam('productIds', null);
172
+ $result = false;
173
+ if ($productIds) {
174
+ $helper = Mage::helper('oct8ne/wishlist');
175
+ $result = $helper->addToWishlist($productIds);
176
+ }
177
+ $results = array(
178
+ 'result' => $result
179
+ );
180
+ $this->returnJson($results);
181
+ }
182
 
183
+ public function removeFromWishlistAction() {
184
+ $helper = Mage::helper('oct8ne/wishlist');
185
+ $productId = $this->getRequest()->getParam('productId', null);
186
+ $results = array(
187
+ 'result' => $productId ? $helper->removeFromWishlist($productId) : false
188
+ );
189
+ $this->returnJson($results);
190
+ }
191
 
192
+ public function getWishlistAction() {
193
+ $result_collection = Mage::helper('oct8ne/wishlist')->getWishlist();
194
  $results = array(
195
  'total' => count($result_collection),
196
  'results' => $result_collection
197
  );
198
+ $this->returnJson($results);
 
 
 
 
 
 
199
  }
200
 
201
+ public function productInfoAction() {
202
+ $products = $this->getRequest()->getParam('productIds', null);
203
+ $product_Ids = explode(',', $products);
204
+ if (count($product_Ids) > 0) {
205
+ $helper = Mage::helper('oct8ne');
206
+ $result = $helper->getProductsInfoByIds($product_Ids);
207
+ } else {
208
+ $result = array();
209
+ }
210
+ $this->returnJson($result);
211
+ }
212
 
213
+ public function productRelatedAction() {
214
+ $product_id = $this->getRequest()->getParam('productId', null);
215
+ $page = $this->getRequest()->getParam('page', 1);
216
+ $pageSize = $this->getRequest()->getParam('pageSize', 10);
217
+ $results = Mage::helper('oct8ne')->getRelatedProducts($product_id, $page, $pageSize);
218
+ $this->returnJson($results);
219
+ }
220
 
221
+ public function imageAction() {
222
+ $imageHelper = Mage::helper("oct8ne/image"); /* @var $imageHelper LetsSyncroLLC_Oct8ne_Helper_Image */
223
+ $file = $this->getRequest()->getParam('file', null);
224
+ if ($file == null) {
225
+ $this->returnNoContent();
226
+ return;
227
+ }
228
 
229
+ $base = Mage::getBaseDir('media');
230
+ $width = $this->getRequest()->getParam('width', null);
 
231
 
232
+ if ($width == null) {
233
+ $newFile = "$base" . DS . "$file";
234
+ } else {
235
+ $newFile = $imageHelper->resizeImg($file, $width);
236
+ }
237
+ $this->returnImage($newFile);
238
  }
239
 
240
+ public function getReportDataAction() {
241
+ if (!$this->checkApiToken()) {
242
+ $this->returnNotAuthorized();
243
+ return false;
244
+ }
 
 
 
 
 
 
 
245
 
246
+ $from = $this->getRequest()->getParam('from', null);
247
+ $to = $this->getRequest()->getParam('to', null);
248
+ $report = $this->getRequest()->getParam('report', null);
249
 
250
+ $result_collection = Mage::getModel('oct8ne/' . $report . 'products')->getCollection();
251
+ if (!empty($from))
252
+ $result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
253
+ if (!empty($to))
254
+ $result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
255
 
256
+ $v = array();
257
+ foreach ($result_collection as $i => $item) {
258
+ $values = array(
259
+ 'productId' => $item['product_id'],
260
+ 'qty' => $item['qty'],
261
+ 'userId' => $item['customer_id'],
262
+ 'oct8neSession' => $item['oct8ne'],
263
+ 'productPrice' => $item['product_price'],
264
+ 'currency' => $item['currency'],
265
+ );
266
 
267
+ if ($report == 'order') {
268
+ $order = Mage::getModel('sales/order')->load($item['order_id']);
269
+ if ($order != null) {
270
+ $orderValid = 1;
271
+ $incrementId = $order->getIncrementId();
272
+ $status = $order->getStatus();
273
+ } else {
274
+ $orderValid = 0;
275
+ }
276
+ $values += array(
277
+ 'internalId' => $item['orderproducts_id']
278
+ );
279
+ }
280
+ $v[] = $values;
281
+ }
282
 
283
  $results = array(
284
+ 'total' => $result_collection->getSize(),
285
+ 'results' => $v
286
  );
287
+ $this->returnJson($results, false /* <- Don't use JSONP */);
 
 
 
 
 
 
288
  }
289
 
290
+ public function systemCheckAction() {
291
+ $text = array();
292
+ $text[] = get_class(Mage::getModel('core/url'));
293
+ $text[] = get_class(Mage::getModel('core/url_rewrite'));
294
+ $text[] = get_class(Mage::getModel('core/design_package'));
295
+ $text[] = get_class(Mage::getModel('checkout/type_onepage'));
296
+ $text[] = get_class($this->getLayout()->createBlock('catalog/product_view'));
297
+ $text[] = get_class($this->getLayout()->createBlock('page/html_head'));
298
 
299
  $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
300
+ $this->getResponse()->setBody(implode("\n", $text));
301
  }
302
 
303
+ private function checkApiToken() {
304
+ $letssyncromodel = Mage::getModel('oct8ne/letssyncro')->load(1);
305
+ $token = $letssyncromodel->getApitoken();
306
+ $apitoken = $this->getRequest()->getParam('apitoken', null);
307
+ return ($apitoken == $token);
308
+ }
 
 
 
 
 
 
309
 
310
+ private function returnJson($jsonData, $isJsonp = true) {
311
+ $response = json_encode($jsonData);
312
+ if ($isJsonp) {
313
+ $callback = $this->getRequest()->getParam('callback', 'callback');
314
+ $response = $callback . "(" . $response . ");";
315
+ }
316
  $this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
317
  $this->getResponse()->setBody($response);
318
  }
319
 
320
+ private function returnNotAuthorized() {
321
+ $response = $this->getResponse();
322
+ $response->clearHeaders();
323
+ $response->setHeader('HTTP/1.0', '401', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  }
325
 
326
+ private function returnNoContent() {
327
+ $response = $this->getResponse();
328
+ $response->clearHeaders();
329
+ $response->setHeader('HTTP/1.0', '204', true);
330
+ }
331
 
332
+ private function returnImage($physicalFilePath) {
333
+ $response = $this->getResponse();
334
+ $mime_types = $this->getMimeTypes();
335
+ $path_parts = pathinfo($physicalFilePath);
336
+ $mime = $mime_types[strtolower($path_parts['extension'])];
337
 
338
+ $response->clearHeaders();
339
+ $response->setHeader('Content-Type', $mime, true);
340
+ $response->setHeader('Cache-Control', 'max-age: 300', true);
341
+ $response->setHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 86400), true);
342
+ $response->setHeader('Pragma', 'cache', true);
343
+ $response->setHeader('Age', '0', true);
344
+ $response->setBody(file_get_contents($physicalFilePath));
345
+ }
346
 
347
+ private function getMimeTypes() {
348
+ return array(
349
  'png' => 'image/png',
350
  'jpe' => 'image/jpeg',
351
  'jpeg' => 'image/jpeg',
358
  'svg' => 'image/svg+xml',
359
  'svgz' => 'image/svg+xml',
360
  );
361
+ }
 
 
 
 
 
 
 
 
362
 
363
+ //
364
+ // For debugging purposes
365
+ // Usage: $this->returnContent($anyObject)
366
+ //
367
+ private function returnContent($object) {
368
+ $response = $this->getResponse();
369
+ $response->clearHeaders();
370
+ $response->setHeader('Content-type', 'text/plain; charset=UTF8', true);
371
+ print_r($object);
372
  }
373
 
374
+ private function getFilteredProducts($storeId, &$attrs_applied, &$attrs_available) {
375
+ $query = Mage::helper('catalogsearch')->getQuery();
376
+ $query->setStoreId($storeId);
377
+ if ($query->getId()) {
378
+ $query->setPopularity($query->getPopularity() + 1);
379
+ } else {
380
+ $query->setPopularity(1);
381
+ }
382
+ $query->prepare();
383
+ Mage::helper('catalogsearch')->checkNotes();
384
 
385
+ $query = Mage::getModel('catalogsearch/layer');
 
 
 
386
 
387
+ $filterableAttributes = $query->getFilterableAttributes();
388
+ $attrs = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
 
390
+ if (!empty($filterableAttributes)) {
391
+ $tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();
392
+ $tmp->SetAttributeCode('category');
393
+ $tmp->setFrontendLabel('Category');
394
+ $filterableAttributes->addItem($tmp);
395
+ }
396
+
397
+ foreach ($filterableAttributes as $attribute) {
398
+ $code = $attribute->getAttributeCode();
399
+ $name = $attribute->getFrontendLabel();
400
+
401
+ // INIT
402
+ $items = array();
403
+ switch ($code) {
404
+ case 'price':
405
+ $_filterModelName = "catalog/layer_filter_price";
406
+ break;
407
+ case 'decimal':
408
+ $_filterModelName = "catalog/layer_filter_decimal";
409
+ break;
410
+ case 'category':
411
+ $_filterModelName = "catalog/layer_filter_category";
412
+ break;
413
+ default:
414
+ $_filterModelName = "catalog/layer_filter_attribute";
415
+ break;
416
+ }
417
+
418
+ $filter = Mage::getModel($_filterModelName)
419
+ ->setLayer($query)
420
+ ->setAttributeModel($attribute);
421
+ $filter->apply($this->getRequest(), $this);
422
+ $items = $filter->getItems();
423
+
424
+ // En los filtros aplicados no nos viene el nombre, solo el id, lo obtenemos aqui
425
+ $optionId = $this->getRequest()->getParam($filter->getRequestVar());
426
+ $featurename = "";
427
+ if (!is_null($optionId)) {
428
+ switch ($code) {
429
+ case 'price':
430
+ $featurename = $this->getRequest()->get($code);
431
+ break;
432
+ case 'decimal':
433
+ $featurename = $this->getRequest()->get($code);
434
+ break;
435
+ case 'category':
436
+ $featurename = $filter->getCategory()->getName();
437
+ break;
438
+ default:
439
+ $featurename = $filter->getAttributeModel()->getFrontend()->getOption($optionId);
440
+ break;
441
  }
442
+ }
443
+
444
+ $options = array();
445
+ foreach ($items as $item) {
446
+ if ($item->getCount() > 0) {
447
+ $options[] = array(
448
+ "valueLabel" => $item->getLabel(),
449
+ "value" => $item->getValue(),
450
+ "count" => $item->getCount()
451
+ );
452
  }
 
 
 
 
 
 
 
453
  }
454
 
455
+ $attrs[] = array(
456
+ 'param' => $code,
457
+ 'paramLabel' => $name,
458
+ 'options' => $options,
459
+ 'valueLabel' => $featurename
460
+ );
461
  }
462
 
463
+ foreach ($attrs as $attr) {
464
+ if (!is_null($this->getRequest()->getParam($attr['param']))) {
465
+ $attr['value'] = $this->getRequest()->getParam($attr['param']);
466
+ $attrs_applied[] = $attr;
467
+ } else {
468
+ $attrs_available[] = $attr;
469
+ }
470
+ }
471
 
472
+ $result_collection = $query->getProductCollection();
473
+ return $result_collection;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
  }
475
+
476
+ }
app/code/community/LetsSyncroLLC/Oct8ne/controllers/letssyncro.phtml DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- Mage::log("Entra en Archivo letssyncro.phtml de controller! (Not Deprecated) ", null, 'Aramis-log.log');
4
- global $letssyncro;
5
- if (!isset($letssyncro)) {
6
- $letssyncro = Mage::getModel('oct8ne/letssyncro')->load(1);
7
- $letssyncrooptions = $letssyncro->_data;
8
- if ($letssyncrooptions["licenseid"] != '' && $letssyncrooptions["enabled"] == '1' && strlen($letssyncrooptions['licenseid']) == 32 )
9
- {
10
- /*
11
- echo "
12
- <!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
13
- <script type= 'text/javascript'>
14
- var syncro = document.createElement(\"script\");
15
- syncro.type = \"text/javascript\";
16
- syncro.async = true;
17
- syncro.license = ".$letssyncrooptions["licenseid"].";
18
- (function () {
19
- syncro.src = (document.location.protocol == \"https:\" ? \"https://\" : \"http://\") + 'backoffice.oct8ne.com/api/source/js/api/oct8ne-api.js';
20
- var s = document.getElementsByTagName(\"script\")[0];
21
- s.parentNode.insertBefore(syncro, s);
22
- })();
23
- </script>
24
- <!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
25
- ";
26
- */
27
- echo <<<EOT
28
- <script type= "text/javascript">
29
- var oct8ne = document.createElement("script");
30
- oct8ne.type = "text/javascript";
31
- oct8ne.async = true;
32
- oct8ne.license = "{$letssyncrooptions["licenseid"]}";
33
- oct8ne.apiUrl = "backoffice.oct8ne.com/";
34
- oct8ne.src = (document.location.protocol == "https:" ? "https://" : "http://") + oct8ne.apiUrl + 'api/source/js/api/oct8ne-api.js';
35
- var s = document.getElementsByTagName("script")[0];
36
- s.parentNode.insertBefore(oct8ne, s);
37
- </script>
38
- EOT;
39
- }
40
- }
41
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml CHANGED
@@ -2,15 +2,17 @@
2
  <config>
3
  <modules>
4
  <LetsSyncroLLC_Oct8ne>
5
- <version>1.2.0</version>
6
  </LetsSyncroLLC_Oct8ne>
7
  </modules>
 
8
  <global>
9
  <models>
10
  <oct8ne>
11
  <class>LetsSyncroLLC_Oct8ne_Model</class>
12
  <resourceModel>oct8ne_mysql4</resourceModel>
13
  </oct8ne>
 
14
  <oct8ne_mysql4>
15
  <class>LetsSyncroLLC_Oct8ne_Model_Mysql4</class>
16
  <entities>
@@ -29,23 +31,23 @@
29
  </oct8ne_mysql4>
30
 
31
 
32
- <core>
33
- <rewrite>
34
- <url>LetsSyncroLLC_Oct8ne_Model_Mage_Url</url>
35
- <url_rewrite>LetsSyncroLLC_Oct8ne_Model_Mage_Rewrite</url_rewrite>
36
- <url_rewrite_request>LetsSyncroLLC_Oct8ne_Model_Mage_Request</url_rewrite_request>
37
- <design_package>LetsSyncroLLC_Oct8ne_Model_Mage_Package</design_package>
38
- <!-- domainpolicy>LetsSyncroLLC_Oct8ne_Model_Mage_Domainpolicy</domainpolicy -->
39
- </rewrite>
40
- </core>
41
 
42
- <checkout>
43
- <rewrite>
44
- <type_onepage>LetsSyncroLLC_Oct8ne_Model_Mage_Onepage</type_onepage>
45
- </rewrite>
46
- </checkout>
47
 
48
  </models>
 
49
  <blocks>
50
  <oct8ne>
51
  <class>LetsSyncroLLC_Oct8ne_Block</class>
@@ -62,13 +64,14 @@
62
  <product_view>LetsSyncroLLC_Oct8ne_Block_Mage_Product_View</product_view>
63
  </rewrite>
64
  </catalog>
65
-
66
  </blocks>
67
- <helpers>
 
68
  <oct8ne>
69
  <class>LetsSyncroLLC_Oct8ne_Helper</class>
70
  </oct8ne>
71
  </helpers>
 
72
  <resources>
73
  <oct8ne_setup>
74
  <setup>
@@ -89,8 +92,7 @@
89
  </connection>
90
  </oct8ne_read>
91
  </resources>
92
-
93
-
94
  <events>
95
  <controller_front_init_routers>
96
  <observers>
@@ -102,16 +104,6 @@
102
  </observers>
103
  </controller_front_init_routers>
104
 
105
- <controller_action_layout_render_before>
106
- <observers>
107
- <LetsSyncroLLC_Oct8ne_Layout>
108
- <type>singleton</type>
109
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
110
- <method>layoutRenderBefore</method>
111
- </LetsSyncroLLC_Oct8ne_Layout>
112
- </observers>
113
- </controller_action_layout_render_before>
114
-
115
  <sales_order_place_after>
116
  <observers>
117
  <LetsSyncroLLC_Oct8ne_Order>
@@ -140,16 +132,6 @@
140
  </LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
141
  </observers>
142
  </controller_action_predispatch>
143
-
144
- <checkout_cart_add_product_complete>
145
- <observers>
146
- <LetsSyncroLLC_Oct8ne_Add_To_Cart>
147
- <type>singleton</type>
148
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
149
- <method>addToCartAjaxOct</method>
150
- </LetsSyncroLLC_Oct8ne_Add_To_Cart>
151
- </observers>
152
- </checkout_cart_add_product_complete>
153
 
154
  <checkout_cart_save_after>
155
  <observers>
@@ -161,19 +143,18 @@
161
  </observers>
162
  </checkout_cart_save_after>
163
  </events>
 
164
  </global>
 
165
  <frontend>
166
  <routers>
167
- <oct8ne>
168
- <!-- <LetsSyncroLLC_LetsSyncro> -->
169
- <use>standard</use>
170
- <args>
171
- <module>LetsSyncroLLC_Oct8ne</module>
172
- <frontName>oct8ne</frontName>
173
- </args>
174
- <!-- </LetsSyncroLLC_LetsSyncro> -->
175
- </oct8ne>
176
-
177
  <customer>
178
  <args>
179
  <modules>
@@ -189,20 +170,20 @@
189
  </LetsSyncroLLC_Oct8ne>
190
  </updates>
191
  </layout>
192
- </frontend>
 
193
  <admin>
194
- <routers>
195
- <!-- <LetsSyncroLLC_LetsSyncro> -->
196
- <oct8ne>
197
- <use>admin</use>
198
- <args>
199
- <module>LetsSyncroLLC_Oct8ne</module>
200
- <frontName>oct8ne</frontName>
201
- </args>
202
- </oct8ne>
203
- <!-- </LetsSyncroLLC_LetsSyncro> -->
204
- </routers>
205
  </admin>
 
206
  <adminhtml>
207
  <translate>
208
  <modules>
@@ -213,17 +194,18 @@
213
  </LetsSyncroLLC_Oct8ne>
214
  </modules>
215
  </translate>
216
- <menu>
217
- <oct8ne translate="title" module="oct8ne">
218
- <title>Oct8ne</title>
 
219
  <sort_order>1000</sort_order>
220
  <children>
221
- <accountconfig translate="title" module="oct8ne">
222
  <title>Account Setup</title>
223
  <action>oct8ne/admin/accountconfig</action>
224
  <sort_order>0</sort_order>
225
  </accountconfig>
226
- <!--<dashboard translate="title" module="oct8ne">
227
  <title>Dashboard</title>
228
  <action>oct8ne/admin/dashboard</action>
229
  <sort_order>20</sort_order>
@@ -234,40 +216,38 @@
234
  <sort_order>40</sort_order>
235
  </syncrodata>-->
236
  </children>
237
- </oct8ne>
238
- </menu>
239
- <acl>
240
- <resources>
241
- <admin>
242
- <children>
243
- <oct8ne translate="title" module="oct8ne">
244
- <title>Oct8ne</title>
245
- <sort_order>1000</sort_order>
246
- <children>
247
- <accountconfig translate="title" module="oct8ne">
248
- <title>Account Setup</title>
249
- <action>oct8ne/admin/accountconfig</action>
250
- <sort_order>0</sort_order>
251
- </accountconfig>
252
- <!--<dashboard translate="title" module="oct8ne">
253
- <title>Dashboard</title>
254
- <action>oct8ne/admin/dashboard</action>
255
- <sort_order>20</sort_order>
256
- </dashboard>
257
- <syncrodata translate="title" module="oct8ne">
258
- <title>Syncro Data</title>
259
- <action>oct8ne/admin/syncrodata</action>
260
- <sort_order>40</sort_order>
261
- </syncrodata>-->
262
- </children>
263
  </oct8ne>
264
- </children>
265
- </admin>
266
 
267
- </resources>
268
-
269
-
270
- </acl>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  </adminhtml>
272
 
273
  <default>
2
  <config>
3
  <modules>
4
  <LetsSyncroLLC_Oct8ne>
5
+ <version>2.0.0</version>
6
  </LetsSyncroLLC_Oct8ne>
7
  </modules>
8
+
9
  <global>
10
  <models>
11
  <oct8ne>
12
  <class>LetsSyncroLLC_Oct8ne_Model</class>
13
  <resourceModel>oct8ne_mysql4</resourceModel>
14
  </oct8ne>
15
+
16
  <oct8ne_mysql4>
17
  <class>LetsSyncroLLC_Oct8ne_Model_Mysql4</class>
18
  <entities>
31
  </oct8ne_mysql4>
32
 
33
 
34
+ <core>
35
+ <rewrite>
36
+ <url>LetsSyncroLLC_Oct8ne_Model_Mage_Url</url>
37
+ <url_rewrite>LetsSyncroLLC_Oct8ne_Model_Mage_Rewrite</url_rewrite>
38
+ <url_rewrite_request>LetsSyncroLLC_Oct8ne_Model_Mage_Request</url_rewrite_request>
39
+ <design_package>LetsSyncroLLC_Oct8ne_Model_Mage_Package</design_package>
40
+ </rewrite>
41
+ </core>
 
42
 
43
+ <checkout>
44
+ <rewrite>
45
+ <type_onepage>LetsSyncroLLC_Oct8ne_Model_Mage_Onepage</type_onepage>
46
+ </rewrite>
47
+ </checkout>
48
 
49
  </models>
50
+
51
  <blocks>
52
  <oct8ne>
53
  <class>LetsSyncroLLC_Oct8ne_Block</class>
64
  <product_view>LetsSyncroLLC_Oct8ne_Block_Mage_Product_View</product_view>
65
  </rewrite>
66
  </catalog>
 
67
  </blocks>
68
+
69
+ <helpers>
70
  <oct8ne>
71
  <class>LetsSyncroLLC_Oct8ne_Helper</class>
72
  </oct8ne>
73
  </helpers>
74
+
75
  <resources>
76
  <oct8ne_setup>
77
  <setup>
92
  </connection>
93
  </oct8ne_read>
94
  </resources>
95
+
 
96
  <events>
97
  <controller_front_init_routers>
98
  <observers>
104
  </observers>
105
  </controller_front_init_routers>
106
 
 
 
 
 
 
 
 
 
 
 
107
  <sales_order_place_after>
108
  <observers>
109
  <LetsSyncroLLC_Oct8ne_Order>
132
  </LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
133
  </observers>
134
  </controller_action_predispatch>
 
 
 
 
 
 
 
 
 
 
135
 
136
  <checkout_cart_save_after>
137
  <observers>
143
  </observers>
144
  </checkout_cart_save_after>
145
  </events>
146
+
147
  </global>
148
+
149
  <frontend>
150
  <routers>
151
+ <oct8ne>
152
+ <use>standard</use>
153
+ <args>
154
+ <module>LetsSyncroLLC_Oct8ne</module>
155
+ <frontName>oct8ne</frontName>
156
+ </args>
157
+ </oct8ne>
 
 
 
158
  <customer>
159
  <args>
160
  <modules>
170
  </LetsSyncroLLC_Oct8ne>
171
  </updates>
172
  </layout>
173
+ </frontend>
174
+
175
  <admin>
176
+ <routers>
177
+ <oct8ne>
178
+ <use>admin</use>
179
+ <args>
180
+ <module>LetsSyncroLLC_Oct8ne</module>
181
+ <frontName>oct8neAdm</frontName>
182
+ </args>
183
+ </oct8ne>
184
+ </routers>
 
 
185
  </admin>
186
+
187
  <adminhtml>
188
  <translate>
189
  <modules>
194
  </LetsSyncroLLC_Oct8ne>
195
  </modules>
196
  </translate>
197
+
198
+ <menu>
199
+ <oct8ne translate="title" module="oct8ne">
200
+ <title>Oct8ne</title>
201
  <sort_order>1000</sort_order>
202
  <children>
203
+ <accountconfig translate="title" module="oct8ne">
204
  <title>Account Setup</title>
205
  <action>oct8ne/admin/accountconfig</action>
206
  <sort_order>0</sort_order>
207
  </accountconfig>
208
+ <!--<dashboard translate="title" module="oct8ne">
209
  <title>Dashboard</title>
210
  <action>oct8ne/admin/dashboard</action>
211
  <sort_order>20</sort_order>
216
  <sort_order>40</sort_order>
217
  </syncrodata>-->
218
  </children>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  </oct8ne>
220
+ </menu>
 
221
 
222
+ <acl>
223
+ <resources>
224
+ <admin>
225
+ <children>
226
+ <oct8ne translate="title" module="oct8ne">
227
+ <title>Oct8ne</title>
228
+ <sort_order>1000</sort_order>
229
+ <children>
230
+ <accountconfig translate="title" module="oct8ne">
231
+ <title>Account Setup</title>
232
+ <action>oct8ne/admin/accountconfig</action>
233
+ <sort_order>0</sort_order>
234
+ </accountconfig>
235
+ <!--<dashboard translate="title" module="oct8ne">
236
+ <title>Dashboard</title>
237
+ <action>oct8ne/admin/dashboard</action>
238
+ <sort_order>20</sort_order>
239
+ </dashboard>
240
+ <syncrodata translate="title" module="oct8ne">
241
+ <title>Syncro Data</title>
242
+ <action>oct8ne/admin/syncrodata</action>
243
+ <sort_order>40</sort_order>
244
+ </syncrodata>-->
245
+ </children>
246
+ </oct8ne>
247
+ </children>
248
+ </admin>
249
+ </resources>
250
+ </acl>
251
  </adminhtml>
252
 
253
  <default>
app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml.bak DELETED
@@ -1,263 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <LetsSyncroLLC_Oct8ne>
5
- <version>1.2.0</version>
6
- </LetsSyncroLLC_Oct8ne>
7
- </modules>
8
- <global>
9
- <models>
10
- <oct8ne>
11
- <class>LetsSyncroLLC_Oct8ne_Model</class>
12
- <resourceModel>oct8ne_mysql4</resourceModel>
13
- </oct8ne>
14
- <oct8ne_mysql4>
15
- <class>LetsSyncroLLC_Oct8ne_Model_Mysql4</class>
16
- <entities>
17
- <letssyncro>
18
- <table>letssyncro</table>
19
- </letssyncro>
20
-
21
- <orderproducts>
22
- <table>orderproducts</table>
23
- </orderproducts>
24
-
25
- <quoteproducts>
26
- <table>quoteproducts</table>
27
- </quoteproducts>
28
- </entities>
29
- </oct8ne_mysql4>
30
-
31
-
32
- <core>
33
- <rewrite>
34
- <url>LetsSyncroLLC_Oct8ne_Model_Mage_Url</url>
35
- <url_rewrite>LetsSyncroLLC_Oct8ne_Model_Mage_Rewrite</url_rewrite>
36
- <url_rewrite_request>LetsSyncroLLC_Oct8ne_Model_Mage_Request</url_rewrite_request>
37
- <design_package>LetsSyncroLLC_Oct8ne_Model_Mage_Package</design_package>
38
- <!-- domainpolicy>LetsSyncroLLC_Oct8ne_Model_Mage_Domainpolicy</domainpolicy -->
39
- </rewrite>
40
- </core>
41
-
42
- <checkout>
43
- <rewrite>
44
- <type_onepage>LetsSyncroLLC_Oct8ne_Model_Mage_Onepage</type_onepage>
45
- </rewrite>
46
- </checkout>
47
-
48
- </models>
49
- <blocks>
50
- <oct8ne>
51
- <class>LetsSyncroLLC_Oct8ne_Block</class>
52
- </oct8ne>
53
-
54
- <page>
55
- <rewrite>
56
- <html_head>LetsSyncroLLC_Oct8ne_Block_Html_Head</html_head>
57
- </rewrite>
58
- </page>
59
-
60
- <catalog>
61
- <rewrite>
62
- <product_view>LetsSyncroLLC_Oct8ne_Block_Mage_Product_View</product_view>
63
- </rewrite>
64
- </catalog>
65
-
66
- </blocks>
67
- <helpers>
68
- <oct8ne>
69
- <class>LetsSyncroLLC_Oct8ne_Helper</class>
70
- </oct8ne>
71
- </helpers>
72
- <resources>
73
- <oct8ne_setup>
74
- <setup>
75
- <module>LetsSyncroLLC_Oct8ne</module>
76
- </setup>
77
- <connection>
78
- <use>core_setup</use>
79
- </connection>
80
- </oct8ne_setup>
81
- <oct8ne_write>
82
- <connection>
83
- <use>core_write</use>
84
- </connection>
85
- </oct8ne_write>
86
- <oct8ne_read>
87
- <connection>
88
- <use>core_read</use>
89
- </connection>
90
- </oct8ne_read>
91
- </resources>
92
-
93
-
94
- <events>
95
- <controller_front_init_routers>
96
- <observers>
97
- <LetsSyncroLLC_Oct8ne_Intercept>
98
- <type>singleton</type>
99
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
100
- <method>interceptMethod</method>
101
- </LetsSyncroLLC_Oct8ne_Intercept>
102
- </observers>
103
- </controller_front_init_routers>
104
-
105
- <controller_action_layout_render_before>
106
- <observers>
107
- <LetsSyncroLLC_Oct8ne_Layout>
108
- <type>singleton</type>
109
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
110
- <method>layoutRenderBefore</method>
111
- </LetsSyncroLLC_Oct8ne_Layout>
112
- </observers>
113
- </controller_action_layout_render_before>
114
-
115
- <sales_order_place_after>
116
- <observers>
117
- <LetsSyncroLLC_Oct8ne_Order>
118
- <type>singleton</type>
119
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
120
- <method>placeOrderBefore</method>
121
- </LetsSyncroLLC_Oct8ne_Order>
122
- </observers>
123
- </sales_order_place_after>
124
-
125
- <sales_quote_save_after>
126
- <observers>
127
- <LetsSyncroLLC_Oct8ne_Quote>
128
- <type>singleton</type>
129
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
130
- <method>saveQuoteAfter</method>
131
- </LetsSyncroLLC_Oct8ne_Quote>
132
- </observers>
133
- </sales_quote_save_after>
134
-
135
- <controller_action_predispatch>
136
- <observers>
137
- <LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
138
- <class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
139
- <method>checkDomainPolicyHeader</method>
140
- </LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
141
- </observers>
142
- </controller_action_predispatch>
143
-
144
- </events>
145
- </global>
146
- <frontend>
147
- <routers>
148
- <oct8ne>
149
- <!-- <LetsSyncroLLC_LetsSyncro> -->
150
- <use>standard</use>
151
- <args>
152
- <module>LetsSyncroLLC_Oct8ne</module>
153
- <frontName>oct8ne</frontName>
154
- </args>
155
- <!-- </LetsSyncroLLC_LetsSyncro> -->
156
- </oct8ne>
157
-
158
- <customer>
159
- <args>
160
- <modules>
161
- <oct8ne before="Mage_Customer">LetsSyncroLLC_Oct8ne</oct8ne>
162
- </modules>
163
- </args>
164
- </customer>
165
- </routers>
166
- <layout>
167
- <updates>
168
- <LetsSyncroLLC_Oct8ne>
169
- <file>oct8ne.xml</file>
170
- </LetsSyncroLLC_Oct8ne>
171
- </updates>
172
- </layout>
173
- </frontend>
174
- <admin>
175
- <routers>
176
- <!-- <LetsSyncroLLC_LetsSyncro> -->
177
- <oct8ne>
178
- <use>admin</use>
179
- <args>
180
- <module>LetsSyncroLLC_Oct8ne</module>
181
- <frontName>oct8ne</frontName>
182
- </args>
183
- </oct8ne>
184
- <!-- </LetsSyncroLLC_LetsSyncro> -->
185
- </routers>
186
- </admin>
187
- <adminhtml>
188
- <translate>
189
- <modules>
190
- <LetsSyncroLLC_Oct8ne>
191
- <files>
192
- <default>LetsSyncroLLC_Oct8ne.csv</default>
193
- </files>
194
- </LetsSyncroLLC_Oct8ne>
195
- </modules>
196
- </translate>
197
- <menu>
198
- <oct8ne translate="title" module="oct8ne">
199
- <title>Oct8ne</title>
200
- <sort_order>1000</sort_order>
201
- <children>
202
- <accountconfig translate="title" module="oct8ne">
203
- <title>Account Setup</title>
204
- <action>oct8ne/admin/accountconfig</action>
205
- <sort_order>0</sort_order>
206
- </accountconfig>
207
- <!--<dashboard translate="title" module="oct8ne">
208
- <title>Dashboard</title>
209
- <action>oct8ne/admin/dashboard</action>
210
- <sort_order>20</sort_order>
211
- </dashboard>
212
- <syncrodata translate="title" module="oct8ne">
213
- <title>Syncro Data</title>
214
- <action>oct8ne/admin/syncrodata</action>
215
- <sort_order>40</sort_order>
216
- </syncrodata>-->
217
- </children>
218
- </oct8ne>
219
- </menu>
220
- <acl>
221
- <resources>
222
- <admin>
223
- <children>
224
- <oct8ne translate="title" module="oct8ne">
225
- <title>Oct8ne</title>
226
- <sort_order>1000</sort_order>
227
- <children>
228
- <accountconfig translate="title" module="oct8ne">
229
- <title>Account Setup</title>
230
- <action>oct8ne/admin/accountconfig</action>
231
- <sort_order>0</sort_order>
232
- </accountconfig>
233
- <!--<dashboard translate="title" module="oct8ne">
234
- <title>Dashboard</title>
235
- <action>oct8ne/admin/dashboard</action>
236
- <sort_order>20</sort_order>
237
- </dashboard>
238
- <syncrodata translate="title" module="oct8ne">
239
- <title>Syncro Data</title>
240
- <action>oct8ne/admin/syncrodata</action>
241
- <sort_order>40</sort_order>
242
- </syncrodata>-->
243
- </children>
244
- </oct8ne>
245
- </children>
246
- </admin>
247
-
248
- </resources>
249
-
250
-
251
- </acl>
252
- </adminhtml>
253
-
254
- <default>
255
- <design>
256
- <oct8nedesign>
257
- <package>default</package>
258
- <theme>oct8ne</theme>
259
- </oct8nedesign>
260
- </design>
261
- </default>
262
- </config>
263
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/LetsSyncroLLC/Oct8ne/etc/system.xml CHANGED
@@ -10,30 +10,19 @@
10
  <show_in_default>1</show_in_default>
11
  <show_in_website>1</show_in_website>
12
  <show_in_store>1</show_in_store>
13
- <fields>
14
- <package translate="label">
15
- <label>Package Name</label>
 
16
  <frontend_type>text</frontend_type>
17
- <backend_model>adminhtml/system_config_backend_design_package</backend_model>
18
- <sort_order>1</sort_order>
19
  <show_in_default>1</show_in_default>
20
  <show_in_website>1</show_in_website>
21
  <show_in_store>1</show_in_store>
22
- </package>
23
-
24
- <theme translate="label">
25
- <label>Theme</label>
26
- <frontend_type>text</frontend_type>
27
- <sort_order>10</sort_order>
28
- <show_in_default>1</show_in_default>
29
- <show_in_website>1</show_in_website>
30
- <show_in_store>1</show_in_store>
31
- </theme>
32
  </fields>
33
-
34
-
35
  </oct8nedesign>
36
- </groups>
37
  </design>
38
  </sections>
39
  </config>
10
  <show_in_default>1</show_in_default>
11
  <show_in_website>1</show_in_website>
12
  <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <elementselector translate="label">
15
+ <label>Search Element Selector</label>
16
+ <comment>CSS selector matching your site's main search text box. Example: #main-body .search</comment>
17
  <frontend_type>text</frontend_type>
18
+ <sort_order>20</sort_order>
 
19
  <show_in_default>1</show_in_default>
20
  <show_in_website>1</show_in_website>
21
  <show_in_store>1</show_in_store>
22
+ </elementselector>
 
 
 
 
 
 
 
 
 
23
  </fields>
 
 
24
  </oct8nedesign>
25
+ </groups>
26
  </design>
27
  </sections>
28
  </config>
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-0.5.0.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $installer->run("
6
- CREATE TABLE IF NOT EXISTS {$this->getTable('letssyncro')} (
7
- `letssyncro_id` int(5) NOT NULL auto_increment,
8
- `email` varchar(100) NULL,
9
- `password` varchar(100) NULL,
10
- `urlapi` varchar(100) NOT NULL,
11
- `licenseid` varchar(32) NULL,
12
- `apitoken` varchar(32) NULL,
13
- `enabled` varchar(1) NULL,
14
- PRIMARY KEY (`letssyncro_id`)
15
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
- ");
17
-
18
- try
19
- {
20
- $installer->run("
21
- INSERT INTO {$this->getTable('letssyncro')}
22
- (`letssyncro_id`, `email`, `password`, `urlapi`, `licenseid`, `apitoken`, `enabled`) VALUES
23
- (1, '', '', 'https://webservice.oct8ne.com/SyncroService', '', '', '0');
24
- ");
25
- }
26
- catch(\Exception $e)
27
- {
28
- // the insert may fail if we run it more than once (duplicate key)
29
- // we need this check to prevent errors during the rename of the module
30
- }
31
-
32
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-1.0.0.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $installer->run("
6
- CREATE TABLE IF NOT EXISTS {$this->getTable('letssyncro')} (
7
- `letssyncro_id` int(5) NOT NULL auto_increment,
8
- `email` varchar(100) NULL,
9
- `password` varchar(100) NULL,
10
- `urlapi` varchar(100) NOT NULL,
11
- `licenseid` varchar(32) NULL,
12
- `apitoken` varchar(32) NULL,
13
- `enabled` varchar(1) NULL,
14
- PRIMARY KEY (`letssyncro_id`)
15
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
- ");
17
-
18
- try
19
- {
20
- $installer->run("
21
- INSERT INTO {$this->getTable('letssyncro')}
22
- (`letssyncro_id`, `email`, `password`, `urlapi`, `licenseid`, `apitoken`, `enabled`) VALUES
23
- (1, '', '', 'https://webservice.oct8ne.com/SyncroService', '', '', '0');
24
- ");
25
- }
26
- catch(\Exception $e)
27
- {
28
- // the insert may fail if we run it more than once (duplicate key)
29
- // we need this check to prevent errors during the rename of the module
30
- }
31
-
32
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-install-2.0.0.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ // *******************************************
8
+ // Create and populate table letssyncro
9
+ // *******************************************
10
+
11
+ $installer->run("
12
+ DROP TABLE IF EXISTS {$this->getTable('letssyncro')};
13
+ CREATE TABLE {$this->getTable('letssyncro')} (
14
+ `letssyncro_id` int(5) NOT NULL auto_increment,
15
+ `email` varchar(100) NULL,
16
+ `password` varchar(100) NULL,
17
+ `urlapi` varchar(100) NOT NULL,
18
+ `licenseid` varchar(32) NULL,
19
+ `apitoken` varchar(32) NULL,
20
+ `enabled` varchar(1) NULL,
21
+ PRIMARY KEY (`letssyncro_id`)
22
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23
+ ");
24
+
25
+ try {
26
+
27
+ $linkupUrl = Mage::helper('oct8ne/url')->getOct8neLinkupServiceUrl();
28
+ $installer->run("
29
+ INSERT INTO {$this->getTable('letssyncro')}
30
+ (`letssyncro_id`, `email`, `password`, `urlapi`, `licenseid`, `apitoken`, `enabled`) VALUES
31
+ (1, '', '', '{$linkupUrl}', '', '', '0');
32
+ ");
33
+ } catch (\Exception $e) {
34
+ // the insert may fail if we run it more than once (duplicate key)
35
+ // we need this check to prevent errors during the rename of the module
36
+ }
37
+
38
+
39
+ // *******************************************
40
+ // Create table orderproducts
41
+ // *******************************************
42
+
43
+ $installer->run("
44
+ -- DROP TABLE IF EXISTS {$this->getTable('orderproducts')};
45
+ CREATE TABLE IF NOT EXISTS {$this->getTable('orderproducts')} (
46
+ `orderproducts_id` int(11) unsigned NOT NULL auto_increment,
47
+ `order_id` int(11) unsigned NOT NULL,
48
+ `product_id` int(11) unsigned NOT NULL,
49
+ `oct8ne` varchar(128) NOT NULL default 'N',
50
+ `currency` varchar(3) NOT NULL default 'EUR',
51
+ `qty` int(11) unsigned NOT NULL,
52
+ `customer_id` int(11) unsigned NOT NULL,
53
+ `product_price` decimal(12,4) NOT NULL default '0.0000',
54
+ `order_price` decimal(12,4) NOT NULL default '0.0000',
55
+ `created_at` datetime NOT NULL default '0000-00-00 00:00:00'
56
+
57
+ PRIMARY KEY (`orderproducts_id`)
58
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
+ ");
60
+
61
+ // *******************************************
62
+ // Create table quoteproducts
63
+ // *******************************************
64
+
65
+ $installer->run("
66
+ -- DROP TABLE IF EXISTS {$this->getTable('quoteproducts')};
67
+ CREATE TABLE IF NOT EXISTS {$this->getTable('quoteproducts')} (
68
+ `quoteproducts_id` int(11) unsigned NOT NULL auto_increment,
69
+ `quote_id` int(11) unsigned NOT NULL,
70
+ `product_id` int(11) unsigned NOT NULL,
71
+ `product_price` decimal(12,4) NOT NULL default '0.0000',
72
+ `quote_price` decimal(12,4) NOT NULL default '0.0000',
73
+ `oct8ne` varchar(128),
74
+ `qty` int(11) unsigned NOT NULL,
75
+ `customer_id` int(11) unsigned NOT NULL,
76
+ `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
77
+ `currency` varchar(3) NOT NULL default 'EUR',
78
+ PRIMARY KEY (`quoteproducts_id`)
79
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80
+ ");
81
+
82
+
83
+ $installer->endSetup();
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.0.0-1.1.0.php CHANGED
@@ -7,7 +7,7 @@ $installer->startSetup();
7
  $installer->run("
8
 
9
  -- DROP TABLE IF EXISTS {$this->getTable('orderproducts')};
10
- CREATE TABLE {$this->getTable('orderproducts')} (
11
  `orderproducts_id` int(11) unsigned NOT NULL auto_increment,
12
  `order_id` int(11) unsigned NOT NULL,
13
  `product_id` int(11) unsigned NOT NULL,
7
  $installer->run("
8
 
9
  -- DROP TABLE IF EXISTS {$this->getTable('orderproducts')};
10
+ CREATE TABLE IF NOT EXISTS {$this->getTable('orderproducts')} (
11
  `orderproducts_id` int(11) unsigned NOT NULL auto_increment,
12
  `order_id` int(11) unsigned NOT NULL,
13
  `product_id` int(11) unsigned NOT NULL,
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.1.6-1.1.7.php CHANGED
@@ -18,7 +18,7 @@ ALTER TABLE {$this->getTable('orderproducts')}
18
  $installer->run("
19
 
20
  -- DROP TABLE IF EXISTS {$this->getTable('quoteproducts')};
21
- CREATE TABLE {$this->getTable('quoteproducts')} (
22
  `quoteproducts_id` int(11) unsigned NOT NULL auto_increment,
23
  `quote_id` int(11) unsigned NOT NULL,
24
  `product_id` int(11) unsigned NOT NULL,
18
  $installer->run("
19
 
20
  -- DROP TABLE IF EXISTS {$this->getTable('quoteproducts')};
21
+ CREATE TABLE IF NOT EXISTS {$this->getTable('quoteproducts')} (
22
  `quoteproducts_id` int(11) unsigned NOT NULL auto_increment,
23
  `quote_id` int(11) unsigned NOT NULL,
24
  `product_id` int(11) unsigned NOT NULL,
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-2.0.0.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ // Nothing to do: v2.0 doesn't need to change the database
app/design/frontend/base/default/layout/oct8ne.xml CHANGED
@@ -1,67 +1,54 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
 
4
- <default>
5
- <!-- fem que la crida es faci al final de la pàgina per tal que no afecti a elements pendents de càrrega-->
6
- <reference name="before_body_end">
7
- <block type="core/template" name="oct8ne_script" template="oct8ne/letssyncro.phtml">
8
- </block>
9
- </reference>
10
- </default>
11
-
12
-
13
- <oct8ne_frame_customerdata>
14
- <reference name="root">
15
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
16
- <block type="core/template" template="oct8ne/frame/customer/data.phtml" name="jsoncontent" />
17
- </reference>
18
- </oct8ne_frame_customerdata>
19
-
20
-
21
-
22
- <oct8ne_frame_add2cart>
23
- <reference name="root">
24
- <action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
25
- </reference>
26
-
27
- <reference name="content">
28
- <block type="core/template" template="oct8ne/frame/add2cart.phtml" />
29
- </reference>
30
- </oct8ne_frame_add2cart>
31
-
32
-
33
- <oct8ne_frame_search>
34
- <reference name="root">
35
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
36
- <block type="core/template" template="oct8ne/frame/search.phtml" name="jsoncontent" />
37
- </reference>
38
- </oct8ne_frame_search>
39
-
40
 
41
- <oct8ne_frame_productview>
42
 
43
- <reference name="head">
44
- <action method="addJs"><script>varien/product.js</script></action>
45
- </reference>
 
 
46
 
47
- <!-- <block type="core/template_facade" name="root" template="oct8ne/frame/productview.phtml"/> -->
48
 
49
  <label>Catalog Product View (Any)</label>
50
  <!-- Mage_Catalog -->
51
- <reference name="head">
52
- <remove name="oct8ne_script" />
53
- </reference>
54
  <reference name="root">
55
- <!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> -->
56
- <action method="setTemplate"><template>oct8ne/frame/clean-page.phtml</template></action>
 
57
  </reference>
58
  <reference name="head">
59
- <action method="addJs"><script>varien/product.js</script></action>
60
- <action method="addJs"><script>varien/configurable.js</script></action>
61
-
62
- <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
63
- <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
64
- <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </reference>
66
  <reference name="content">
67
  <block type="catalog/product_view" name="product.info" template="oct8ne/frame/productview.phtml">
@@ -71,19 +58,30 @@
71
  <label>Alert Urls</label>
72
  </block>
73
 
74
- <action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
 
 
75
 
76
  <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="oct8ne/frame/productview/list/upsell.phtml">
77
- <action method="setColumnCount"><columns>4</columns></action>
78
- <action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
 
 
 
 
 
79
  </block>
80
 
81
  <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
82
  <block type="catalog/product_view_description" name="product.description" as="description" template="oct8ne/frame/productview/description.phtml">
83
- <action method="addToParentGroup"><group>detailed_info</group></action>
 
 
84
  </block>
85
  <block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="oct8ne/frame/productview/attributes.phtml">
86
- <action method="addToParentGroup"><group>detailed_info</group></action>
 
 
87
  </block>
88
  <block type="catalog/product_view" name="product.info.addto" as="addto" template="oct8ne/frame/productview/addto.phtml"/>
89
  <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="oct8ne/frame/productview/addtocart.phtml"/>
@@ -96,135 +94,96 @@
96
  <label>Info Column Options Wrapper</label>
97
  <block type="core/template" name="options_js" template="oct8ne/frame/productview/options/js.phtml"/>
98
  <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="oct8ne/frame/productview/options.phtml">
99
- <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
100
- <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
101
- <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
102
- <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
103
- </block>
104
- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  </block>
 
 
106
  <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="oct8ne/frame/productview/options/wrapper/bottom.phtml" translate="label">
107
  <label>Bottom Block Options Wrapper</label>
108
- <action method="insert"><block>product.tierprices</block></action>
 
 
109
  <block type="catalog/product_view" name="product.clone_prices" as="prices" template="oct8ne/frame/productview/price_clone.phtml"/>
110
- <action method="append"><block>product.info.addtocart</block></action>
111
- <action method="append"><block>product.info.addto</block></action>
 
 
 
 
112
  </block>
113
 
114
  <block type="core/template_facade" name="product.info.container1" as="container1">
115
- <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
116
- <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
117
- <action method="append"><block>product.info.options.wrapper</block></action>
118
- <action method="append"><block>product.info.options.wrapper.bottom</block></action>
 
 
 
 
 
 
 
 
 
 
119
  </block>
120
  <block type="core/template_facade" name="product.info.container2" as="container2">
121
- <action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
122
- <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
123
- <action method="append"><block>product.info.options.wrapper</block></action>
124
- <action method="append"><block>product.info.options.wrapper.bottom</block></action>
 
 
 
 
 
 
 
 
 
 
125
  </block>
126
- <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
127
- <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
 
 
 
 
 
 
 
 
 
 
 
 
128
  </block>
129
  </reference>
130
  <reference name="right">
131
  <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="oct8ne/frame/productview/list/related.phtml"/>
132
  </reference>
133
 
134
- </oct8ne_frame_productview>
135
-
136
-
137
- <oct8ne_frame_search2 translate="label">
138
- <label>Oct8ne Search</label>
139
- <reference name="root">
140
- <action method="setTemplate"><template>page/3columns.phtml</template></action>
141
- </reference>
142
- <reference name="left">
143
- <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
144
- </reference>
145
- <reference name="content">
146
- <block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
147
- <block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
148
- <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
149
- <block type="page/html_pager" name="product_list_toolbar_pager"/>
150
- </block>
151
- <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
152
- <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
153
- <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
154
- <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
155
- <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
156
- <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
157
- </block>
158
- <action method="setListOrders"/>
159
- <action method="setListModes"/>
160
- <action method="setListCollection"/>
161
- </block>
162
- </reference>
163
- </oct8ne_frame_search2>
164
 
165
- <customer_account_loginpost>
166
- <reference name="root">
167
- <action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
168
- </reference>
169
-
170
- <reference name="content">
171
- <block type="core/template" template="oct8ne/frame/loginpost.phtml" />
172
- </reference>
173
- </customer_account_loginpost>
174
 
175
- <oct8ne_frame_getcart>
176
- <reference name="root">
177
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
178
- <block type="core/template" template="oct8ne/frame/getcart.phtml" name="jsoncontent" />
179
- </reference>
180
- </oct8ne_frame_getcart>
181
-
182
- <oct8ne_frame_getwishlist>
183
- <reference name="root">
184
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
185
- <block type="core/template" template="oct8ne/frame/getwishlist.phtml" name="jsoncontent" />
186
- </reference>
187
- </oct8ne_frame_getwishlist>
188
-
189
- <oct8ne_frame_addtowishlist>
190
- <reference name="root">
191
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
192
- <block type="core/template" template="oct8ne/frame/addtowishlist.phtml" name="jsoncontent" />
193
- </reference>
194
- </oct8ne_frame_addtowishlist>
195
-
196
- <oct8ne_frame_removefromwishlist>
197
- <reference name="root">
198
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
199
- <block type="core/template" template="oct8ne/frame/removefromwishlist.phtml" name="jsoncontent" />
200
- </reference>
201
- </oct8ne_frame_removefromwishlist>
202
-
203
- <oct8ne_frame_productinfo>
204
- <reference name="root">
205
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
206
- <block type="core/template" template="oct8ne/frame/productinfo.phtml" name="jsoncontent" />
207
- </reference>
208
- </oct8ne_frame_productinfo>
209
-
210
- <oct8ne_frame_getversion>
211
- <reference name="root">
212
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
213
- <block type="core/template" template="oct8ne/frame/getversion.phtml" name="jsoncontent" />
214
- </reference>
215
- </oct8ne_frame_getversion>
216
-
217
- <oct8ne_frame_productrelated>
218
- <reference name="root">
219
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
220
- <block type="core/template" template="oct8ne/frame/productrelated.phtml" name="jsoncontent"/>
221
- </reference>
222
- </oct8ne_frame_productrelated>
223
-
224
- <oct8ne_frame_getreportdata>
225
- <reference name="root">
226
- <action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
227
- <block type="core/template" template="oct8ne/frame/getreportdata.phtml" name="jsoncontent"/>
228
- </reference>
229
- </oct8ne_frame_getreportdata>
230
  </layout>
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
 
4
+ <default>
5
+ <!-- fem que la crida es faci al final de la pàgina per tal que no afecti a elements pendents de càrrega-->
6
+ <reference name="before_body_end">
7
+ <block type="core/template" name="oct8ne_script" template="oct8ne/letssyncro.phtml">
8
+ </block>
9
+ </reference>
10
+ </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ <oct8ne_frame_productview>
13
 
14
+ <reference name="head">
15
+ <action method="addJs">
16
+ <script>varien/product.js</script>
17
+ </action>
18
+ </reference>
19
 
 
20
 
21
  <label>Catalog Product View (Any)</label>
22
  <!-- Mage_Catalog -->
23
+ <reference name="head">
24
+ <remove name="oct8ne_script" />
25
+ </reference>
26
  <reference name="root">
27
+ <action method="setTemplate">
28
+ <template>oct8ne/frame/clean-page.phtml</template>
29
+ </action>
30
  </reference>
31
  <reference name="head">
32
+ <action method="addJs">
33
+ <script>varien/product.js</script>
34
+ </action>
35
+ <action method="addJs">
36
+ <script>varien/configurable.js</script>
37
+ </action>
38
+
39
+ <action method="addItem">
40
+ <type>js_css</type>
41
+ <name>calendar/calendar-win2k-1.css</name>
42
+ <params/><!--<if/><condition>can_load_calendar_js</condition>-->
43
+ </action>
44
+ <action method="addItem">
45
+ <type>js</type>
46
+ <name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>-->
47
+ </action>
48
+ <action method="addItem">
49
+ <type>js</type>
50
+ <name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>-->
51
+ </action>
52
  </reference>
53
  <reference name="content">
54
  <block type="catalog/product_view" name="product.info" template="oct8ne/frame/productview.phtml">
58
  <label>Alert Urls</label>
59
  </block>
60
 
61
+ <action method="setTierPriceTemplate">
62
+ <template>catalog/product/view/tierprices.phtml</template>
63
+ </action>
64
 
65
  <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="oct8ne/frame/productview/list/upsell.phtml">
66
+ <action method="setColumnCount">
67
+ <columns>4</columns>
68
+ </action>
69
+ <action method="setItemLimit">
70
+ <type>upsell</type>
71
+ <limit>4</limit>
72
+ </action>
73
  </block>
74
 
75
  <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
76
  <block type="catalog/product_view_description" name="product.description" as="description" template="oct8ne/frame/productview/description.phtml">
77
+ <action method="addToParentGroup">
78
+ <group>detailed_info</group>
79
+ </action>
80
  </block>
81
  <block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="oct8ne/frame/productview/attributes.phtml">
82
+ <action method="addToParentGroup">
83
+ <group>detailed_info</group>
84
+ </action>
85
  </block>
86
  <block type="catalog/product_view" name="product.info.addto" as="addto" template="oct8ne/frame/productview/addto.phtml"/>
87
  <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="oct8ne/frame/productview/addtocart.phtml"/>
94
  <label>Info Column Options Wrapper</label>
95
  <block type="core/template" name="options_js" template="oct8ne/frame/productview/options/js.phtml"/>
96
  <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="oct8ne/frame/productview/options.phtml">
97
+ <action method="addOptionRenderer">
98
+ <type>text</type>
99
+ <block>catalog/product_view_options_type_text</block>
100
+ <template>catalog/product/view/options/type/text.phtml</template>
101
+ </action>
102
+ <action method="addOptionRenderer">
103
+ <type>file</type>
104
+ <block>catalog/product_view_options_type_file</block>
105
+ <template>catalog/product/view/options/type/file.phtml</template>
106
+ </action>
107
+ <action method="addOptionRenderer">
108
+ <type>select</type>
109
+ <block>catalog/product_view_options_type_select</block>
110
+ <template>catalog/product/view/options/type/select.phtml</template>
111
+ </action>
112
+ <action method="addOptionRenderer">
113
+ <type>date</type>
114
+ <block>catalog/product_view_options_type_date</block>
115
+ <template>catalog/product/view/options/type/date.phtml</template>
116
+ </action>
117
  </block>
118
+ <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
119
+ </block>
120
  <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="oct8ne/frame/productview/options/wrapper/bottom.phtml" translate="label">
121
  <label>Bottom Block Options Wrapper</label>
122
+ <action method="insert">
123
+ <block>product.tierprices</block>
124
+ </action>
125
  <block type="catalog/product_view" name="product.clone_prices" as="prices" template="oct8ne/frame/productview/price_clone.phtml"/>
126
+ <action method="append">
127
+ <block>product.info.addtocart</block>
128
+ </action>
129
+ <action method="append">
130
+ <block>product.info.addto</block>
131
+ </action>
132
  </block>
133
 
134
  <block type="core/template_facade" name="product.info.container1" as="container1">
135
+ <action method="setDataByKey">
136
+ <key>alias_in_layout</key>
137
+ <value>container1</value>
138
+ </action>
139
+ <action method="setDataByKeyFromRegistry">
140
+ <key>options_container</key>
141
+ <key_in_registry>product</key_in_registry>
142
+ </action>
143
+ <action method="append">
144
+ <block>product.info.options.wrapper</block>
145
+ </action>
146
+ <action method="append">
147
+ <block>product.info.options.wrapper.bottom</block>
148
+ </action>
149
  </block>
150
  <block type="core/template_facade" name="product.info.container2" as="container2">
151
+ <action method="setDataByKey">
152
+ <key>alias_in_layout</key>
153
+ <value>container2</value>
154
+ </action>
155
+ <action method="setDataByKeyFromRegistry">
156
+ <key>options_container</key>
157
+ <key_in_registry>product</key_in_registry>
158
+ </action>
159
+ <action method="append">
160
+ <block>product.info.options.wrapper</block>
161
+ </action>
162
+ <action method="append">
163
+ <block>product.info.options.wrapper.bottom</block>
164
+ </action>
165
  </block>
166
+ <action method="unsetCallChild">
167
+ <child>container1</child>
168
+ <call>ifEquals</call>
169
+ <if>0</if>
170
+ <key>alias_in_layout</key>
171
+ <key>options_container</key>
172
+ </action>
173
+ <action method="unsetCallChild">
174
+ <child>container2</child>
175
+ <call>ifEquals</call>
176
+ <if>0</if>
177
+ <key>alias_in_layout</key>
178
+ <key>options_container</key>
179
+ </action>
180
  </block>
181
  </reference>
182
  <reference name="right">
183
  <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="oct8ne/frame/productview/list/related.phtml"/>
184
  </reference>
185
 
186
+ </oct8ne_frame_productview>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
 
 
 
 
 
 
 
 
 
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  </layout>
app/design/frontend/base/default/template/oct8ne/frame/add2cart.phtml DELETED
@@ -1,16 +0,0 @@
1
- <h2 class="add2cart-msg">Product added to cart</h2>
2
-
3
- <?php
4
- $collection = Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection();
5
- $collection->getSelect()->order('created_at DESC');
6
- $latestItem = $collection->getFirstItem();
7
-
8
- $product = $latestItem->getProduct();
9
- $qty = $product->getCartQty();
10
- ?>
11
-
12
-
13
- <script type="text/javascript">
14
- parent.postMessage("qty:<?php echo $qty ?>", "*");
15
- parent.postMessage("closeIframe", "*");
16
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/addtowishlist.phtml DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $callback = Mage::registry( 'callback' );
3
- $result = Mage::registry( 'oct8ne_result' );
4
-
5
- echo $callback;
6
- ?>({
7
- <?php
8
- if ( !Mage::registry( 'partial_search' ) )
9
- echo " result: \"".($result?"true":"false")."\"\n";
10
- ?>});
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/customer/data.phtml DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- $login_data = Mage::helper('oct8ne/customer_data')->gatherLoginData();
4
- $quote_data = Mage::helper('oct8ne/customer_data')->gatherCartData();
5
- $wishlist_data = Mage::helper('oct8ne/customer_data')->gatherWishlistData();
6
-
7
- $callback = Mage::registry( 'callback' );
8
-
9
- echo $callback;
10
- ?>({
11
- user: {
12
- <?php if ( $login_data ): ?>
13
- id: "<?php echo $login_data['id']; ?>",
14
- firstName: "<?php echo $login_data['first_name']; ?>",
15
- lastName: "<?php echo $login_data['last_name']; ?>",
16
- email: "<?php echo $login_data['email']; ?>"<?php if ( count($wishlist_data) || count($quote_data) ) echo ","; ?>
17
- <?php endif; ?>
18
- <?php if ( count($wishlist_data) ): ?>
19
- whislist: [
20
- <?php foreach( $wishlist_data as $i => $item ): ?>
21
- {
22
- InternalId: "<?php echo $item['id']; ?>",
23
- Title: "<?php echo $item['title']; ?>",
24
- Price: "<?php echo $item['price']; ?>",
25
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
26
- Rating: "<?php echo $item['rating']; ?>",
27
- RouteTo: "<?php echo $item['url']; ?>",
28
- BuyURL: "<?php echo $item['buy_url']; ?>",
29
- Medias: [
30
- <?php foreach( $item['imgs'] as $j => $image ): ?>
31
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
32
- <?php endforeach; ?>
33
- ],
34
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
35
- HasOptions: "<?php echo $item['has_options']; ?>"
36
- <?php
37
- if ( $i < count( $wishlist_data )-1 )
38
- echo "},\n";
39
- else
40
- echo "}\n";
41
- ?>
42
- <?php endforeach; ?>
43
- ]<?php if ( count($quote_data) ) echo ","; ?>
44
- <?php endif; ?>
45
-
46
- <?php if ( count($quote_data) ): ?>
47
- cart: [
48
- <?php foreach( $quote_data as $i => $item ): ?>
49
- {
50
- InternalId: "<?php echo $item['id']; ?>",
51
- Title: "<?php echo $item['title']; ?>",
52
- Price: "<?php echo $item['price']; ?>",
53
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
54
- Rating: "<?php echo $item['rating']; ?>",
55
- Qty: "<?php echo $item['qty']; ?>",
56
- RouteTo: "<?php echo $item['url']; ?>",
57
- BuyURL: "<?php echo $item['buy_url']; ?>",
58
- Medias: [
59
- <?php foreach( $item['imgs'] as $j => $image ): ?>
60
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
61
- <?php endforeach; ?>
62
- ],
63
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
64
- HasOptions: "<?php echo $item['has_options']; ?>"
65
- <?php
66
- if ( $i < count( $quote_data )-1 )
67
- echo "},\n";
68
- else
69
- echo "}\n";
70
- ?>
71
- <?php endforeach; ?>
72
- ]
73
- <?php endif; ?>
74
- }
75
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/customer/getversion.phtml DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- $pluginVersion = Mage::helper('oct8ne')->getExtensionVersion();
4
- echo $pluginVersion;
5
-
6
- $config = Mage::getModel(‘catalog/product’ , "111");
7
- echo $config;
8
- ?>
9
- <div>YHEAAA</div>
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/customer/notifier.phtml DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- echo "AAA";
3
- ?>
4
- <script>
5
- alert("hola!");
6
- </script>
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/getcart.phtml DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- $result_collection = Mage::registry( 'cart' );
4
-
5
- $callback = Mage::registry( 'callback' );
6
-
7
- echo $callback;
8
- ?>({
9
- <?php
10
- if ( !Mage::registry( 'partial_search' ) )
11
- echo " total: \"".count( $result_collection )."\",\n";
12
- ?>
13
- results: [
14
- <?php foreach( $result_collection as $item): ?>
15
- {
16
- InternalId: "<?php echo $item['id']; ?>",
17
- Title: "<?php echo $item['title']; ?>",
18
- PrevPrice: "<?php echo $item['original_price']; ?>",
19
- Price: "<?php echo $item['price']; ?>",
20
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
21
- Rating: "<?php echo $item['rating']; ?>",
22
- Qty: "<?php echo $item['qty']; ?>",
23
- RouteTo: "<?php echo $item['url']; ?>",
24
- BuyURL: "<?php echo $item['buy_url']; ?>",
25
- Medias: [
26
- <?php foreach( $item['imgs'] as $j => $image ): ?>
27
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
28
- <?php endforeach; ?>
29
- ],
30
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
31
- HasOptions: "<?php echo $item['has_options']; ?>"
32
- <?php
33
- if ( $i < count( $result_collection )-1 )
34
- echo "},\n";
35
- else
36
- echo "}\n";
37
- ?>
38
- <?php endforeach; ?>
39
- ]
40
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/getreportdata.phtml DELETED
@@ -1 +0,0 @@
1
- <?php
2
  // $result_collection = Mage::registry( 'search_result_collection' );
3
  $report = Mage::registry('oct8ne_report');
4
  switch($report)
5
  {
6
  case 'order':
7
  $result_collection = Mage::getModel('oct8ne/orderproducts')->getCollection();
8
  break;
9
  case 'quote':
10
  $result_collection = Mage::getModel('oct8ne/quoteproducts')->getCollection();
11
  break;
12
  }
13
  $from = Mage::registry('oct8ne_from');
14
  $to = Mage::registry('oct8ne_to');
15
 
16
  if(!empty($from)) {
17
  $result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
18
  }
19
  if(!empty($to)) {
20
  $result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
21
  }
22
 
23
  //if ( !Mage::registry( 'partial_search' ) )
24
  echo " \"total\": \"".$result_collection->getSize()."\",\n";
25
  "results": [
26
  $values = array(
27
  'ProductId' => $item['product_id'],
28
  'Qty' => $item['qty'],
29
  'UserId' => $item['customer_id'],
30
  'Oct8neSession' => $item['oct8ne'],
31
  'Date' => $item['created_at'],
32
  'ProductPrice' => $item['product_price'],
33
  'Currency' => $item['currency'],
34
  );
35
 
36
  if($report == 'order')
37
  {
38
  $order = Mage::getModel('sales/order')->load($item['order_id']);
39
  if($order != null)
40
  {
41
  $orderValid = 1;
42
  $incrementId = $order->getIncrementId();
43
  $status = $order->getStatus();
44
  }
45
  else
46
  {
47
  $orderValid = 0;
48
  }
49
 
50
  $values += array(
51
  'InternalId' => $item['orderproducts_id'],
52
  'OrderId' => $item['order_id'],
53
  'OrderValid' => $orderValid,
54
  'IncrementId' => $incrementId,
55
  'OrderPrice' => $item[$report . '_price'],
56
  'Status' => $status
57
  );
58
  }
59
  else if($report == 'quote')
60
  {
61
  $quote = Mage::getModel('sales/order')->load($item['quoteproducts_id']);
62
  if($quote != null)
63
  {
64
  $quoteValid = 1;
65
  }
66
  else
67
  {
68
  $quoteValid = 0;
69
  }
70
 
71
  $values += array(
72
  'InternalId' => $item['quoteproducts_id'],
73
  'QuoteId' => $item['quote_id'],
74
  'QuoteValid' => $quoteValid,
75
  'QuotePrice' => $item[$report . '_price'],
76
  );
77
  }
78
  // $d = $order->getCreatedAtStoreDate();
79
  {
80
  <?php $n = 0; foreach($values as $key=>$val) { ?>
81
  "<?php $n++; echo $key ?>": "<?php echo $val ?>"<?php if ( $n < count( $values ) ) echo ",\n"; else echo "\n"; ?>
82
  <?php } ?>
83
 
84
  <?php $k++; if ( $k < count( $result_collection ) ) echo "},\n"; else echo "}\n"; ?>
85
  ]
 
0
  // $result_collection = Mage::registry( 'search_result_collection' );
1
  $report = Mage::registry('oct8ne_report');
2
  switch($report)
3
  {
4
  case 'order':
5
  $result_collection = Mage::getModel('oct8ne/orderproducts')->getCollection();
6
  break;
7
  case 'quote':
8
  $result_collection = Mage::getModel('oct8ne/quoteproducts')->getCollection();
9
  break;
10
  }
11
  $from = Mage::registry('oct8ne_from');
12
  $to = Mage::registry('oct8ne_to');
13
 
14
  if(!empty($from)) {
15
  $result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
16
  }
17
  if(!empty($to)) {
18
  $result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
19
  }
20
 
21
  //if ( !Mage::registry( 'partial_search' ) )
22
  echo " \"total\": \"".$result_collection->getSize()."\",\n";
23
  "results": [
24
  $values = array(
25
  'ProductId' => $item['product_id'],
26
  'Qty' => $item['qty'],
27
  'UserId' => $item['customer_id'],
28
  'Oct8neSession' => $item['oct8ne'],
29
  'Date' => $item['created_at'],
30
  'ProductPrice' => $item['product_price'],
31
  'Currency' => $item['currency'],
32
  );
33
 
34
  if($report == 'order')
35
  {
36
  $order = Mage::getModel('sales/order')->load($item['order_id']);
37
  if($order != null)
38
  {
39
  $orderValid = 1;
40
  $incrementId = $order->getIncrementId();
41
  $status = $order->getStatus();
42
  }
43
  else
44
  {
45
  $orderValid = 0;
46
  }
47
 
48
  $values += array(
49
  'InternalId' => $item['orderproducts_id'],
50
  'OrderId' => $item['order_id'],
51
  'OrderValid' => $orderValid,
52
  'IncrementId' => $incrementId,
53
  'OrderPrice' => $item[$report . '_price'],
54
  'Status' => $status
55
  );
56
  }
57
  else if($report == 'quote')
58
  {
59
  $quote = Mage::getModel('sales/order')->load($item['quoteproducts_id']);
60
  if($quote != null)
61
  {
62
  $quoteValid = 1;
63
  }
64
  else
65
  {
66
  $quoteValid = 0;
67
  }
68
 
69
  $values += array(
70
  'InternalId' => $item['quoteproducts_id'],
71
  'QuoteId' => $item['quote_id'],
72
  'QuoteValid' => $quoteValid,
73
  'QuotePrice' => $item[$report . '_price'],
74
  );
75
  }
76
  // $d = $order->getCreatedAtStoreDate();
77
  {
78
  <?php $n = 0; foreach($values as $key=>$val) { ?>
79
  "<?php $n++; echo $key ?>": "<?php echo $val ?>"<?php if ( $n < count( $values ) ) echo ",\n"; else echo "\n"; ?>
80
  <?php } ?>
81
 
82
  <?php $k++; if ( $k < count( $result_collection ) ) echo "},\n"; else echo "}\n"; ?>
83
  ]
app/design/frontend/base/default/template/oct8ne/frame/getversion.phtml DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- $callback = Mage::registry( 'callback' );
3
- $pluginVersion = Mage::registry( 'oct8ne_plugin_version' );
4
- ?>
5
- <?php echo $pluginVersion; ?>
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/getwishlist.phtml DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- $callback = Mage::registry( 'callback' );
3
- $customer = Mage::registry( 'oct8ne_customer_id' );
4
-
5
- $api = Mage::helper( 'oct8ne/wishlist' );
6
- $result_collection = $api->getWishlist($customer);
7
-
8
-
9
-
10
- echo $callback;
11
- ?>({
12
- <?php
13
- if ( !Mage::registry( 'partial_search' ) )
14
- echo " total: \"".count($result_collection)."\",\n";
15
- ?>
16
- results: [
17
- <?php foreach( $result_collection as $i => $item): ?>
18
- {
19
- InternalId: "<?php echo $item['id']; ?>",
20
- Title: "<?php echo $item['title']; ?>",
21
- PrevPrice: "<?php echo $item['original_price']; ?>",
22
- Price: "<?php echo $item['price']; ?>",
23
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
24
- RouteTo: "<?php echo $item['url']; ?>",
25
- BuyURL: "<?php echo $item['buy_url']; ?>",
26
- Medias: [
27
- <?php foreach( $item['imgs'] as $j => $image ): ?>
28
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
29
- <?php endforeach; ?>
30
- ],
31
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
32
- HasOptions: "<?php echo $item['has_options']; ?>"
33
- <?php
34
- if ( $i < count( $result_collection )-1 )
35
- echo "},\n";
36
- else
37
- echo "}\n";
38
- ?>
39
- <?php endforeach; ?>
40
- ]
41
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/json-page.phtml DELETED
@@ -1 +0,0 @@
1
- <?php echo $this->getChildHtml('jsoncontent') ?>
 
app/design/frontend/base/default/template/oct8ne/frame/loginpost.phtml DELETED
@@ -1,8 +0,0 @@
1
- <h2 class="add2cart-msg">Logged In!</h2>
2
-
3
- <script type="text/javascript">
4
- if(isOct8neActive())
5
- {
6
- parent.postMessage("closeIframe", "*");
7
- }
8
- </script>
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/naked-page.phtml DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Template for Mage_Page_Block_Html
4
- */
5
- ?>
6
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
7
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
8
- <head>
9
- </head>
10
- <body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
11
- <?php echo $this->getChildHtml('after_body_start') ?>
12
- <div class="frame-wrapper">
13
- <?php echo $this->getChildHtml('content') ?>
14
- </div>
15
- <?php echo $this->getChildHtml('before_body_end') ?>
16
- </div>
17
- </body>
18
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/productinfo.phtml DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- $callback = Mage::registry( 'callback' );
3
- $productId = Mage::registry( 'oct8ne_product_id' );
4
- $result_collection = array();
5
- foreach(explode(',', $productId) as $id)
6
- $result_collection[] = Mage::helper('oct8ne')->getProductInfo($id);
7
- echo $callback;
8
- ?>
9
- ({
10
- results: [
11
- <?php foreach( $result_collection as $i => $item): ?>
12
- {
13
- InternalId: "<?php echo $item['id']; ?>",
14
- Title: "<?php echo $item['title']; ?>",
15
- PrevPrice: "<?php echo $item['original_price']; ?>",
16
- Price: "<?php echo $item['price']; ?>",
17
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
18
- Rating: "<?php echo $item['rating']; ?>",
19
- RouteTo: "<?php echo $item['url']; ?>",
20
- BuyURL: "<?php echo $item['buy_url']; ?>",
21
- Medias: [
22
- <?php foreach( $item['imgs'] as $j => $image ): ?>
23
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
24
- <?php endforeach; ?>
25
- ],
26
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
27
- HasOptions: "<?php echo $item['has_options']; ?>"
28
- <?php
29
- if ( $i < count( $result_collection )-1 )
30
- echo "},\n";
31
- else
32
- echo "}\n";
33
- ?>
34
- <?php endforeach; ?>
35
- ]
36
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/productrelated.phtml DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- $productId = Mage::registry( 'oct8ne_product_id' );
3
- $numItems = Mage::registry( 'oct8ne_product_related_num_items');
4
- $start = Mage::registry('oct8ne_product_related_start');
5
-
6
- //if($start < 0) $start = 0;
7
- //if($numItems < 1) $numItems = 1;
8
- //if($page < 1) $page = 1;
9
-
10
- $result_collection = Mage::helper('oct8ne')->getRelatedProducts($productId);
11
-
12
- //$total = 10;
13
- //$start = $total * ($page -1);
14
-
15
- $callback = Mage::registry( 'callback' );
16
-
17
- echo $callback;
18
- ?>({
19
- <?php
20
- if ( !Mage::registry( 'partial_search' ) )
21
- echo " total: \"".count( $result_collection )."\",\n";
22
- ?>
23
- results: [
24
- <?php $i=0;?>
25
- <?php foreach( $result_collection as $item): ?>
26
- {
27
- InternalId: "<?php echo $item['id']; ?>",
28
- Title: "<?php echo $item['title']; ?>",
29
- PrevPrice: "<?php echo $item['original_price']; ?>",
30
- Price: "<?php echo $item['price']; ?>",
31
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
32
- Rating: "<?php echo $item['rating']; ?>",
33
- Qty: "<?php echo $item['qty']; ?>",
34
- RouteTo: "<?php echo $item['url']; ?>",
35
- BuyURL: "<?php echo $item['buy_url']; ?>",
36
- Medias: [
37
- <?php foreach( $item['imgs'] as $j => $image ): ?>
38
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
39
- <?php endforeach; ?>
40
- ],
41
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
42
- HasOptions: "<?php echo $item['has_options']; ?>"
43
- <?php
44
- if ( $i < count( $result_collection )-1 )
45
- echo "},\n";
46
- else
47
- echo "}\n";
48
- ?>
49
- <?php $i++;?>
50
- <?php endforeach; ?>
51
- ]
52
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/productview-FROM-SCRATCH.phtml DELETED
@@ -1,121 +0,0 @@
1
- <?php $_helper = Mage::registry( 'frame_product_helper' ); ?>
2
- <?php $_product = Mage::registry( 'frame_product' ); ?>
3
-
4
- <div class="frame-product-view">
5
- <!-- Product name -->
6
- <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
7
-
8
- <!-- Product image -->
9
- <?php
10
- if ( $_product->getThumbnail() != 'no_selection' )
11
- echo '<h2><img src="'.Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_MEDIA ).'catalog/product'.$_product->getThumbnail().'" /></h2>';
12
- ?>
13
-
14
- <!-- Product description -->
15
- <?php
16
- if ( $_product->getShortDescription() )
17
- echo '<h2>'
18
- .$_helper->productAttribute(
19
- $_product,
20
- nl2br(
21
- $_product->getShortDescription()
22
- ),
23
- 'short_description'
24
- )
25
- .'</h2>';
26
- ?>
27
-
28
- <!-- Product options -->
29
- <?php echo "hasOptions: ".$_product->getTypeInstance(true)->hasOptions($_product); ?>
30
- <?php
31
- if ( $_product->isSaleable()
32
- &&
33
- $_product->getTypeInstance(true)->hasOptions($_product) ): ?>
34
- <div class="product-options" id="product-options-wrapper">
35
- <?php echo $this->getChildHtml('', true, true);?>
36
- <?php if ($_product->getTypeInstance(true)->hasRequiredOptions($_product)):?>
37
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
38
- <?php endif;?>
39
- </div>
40
- <script type="text/javascript">decorateGeneric($$('#product-options-wrapper dl'), ['last']);</script>
41
- <?php endif; ?>
42
-
43
-
44
-
45
- <?php if ( $_product->isSaleable() ) :?>
46
- <div class="frame-product-stock">
47
- <?php
48
- $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
49
- if ( $stock->getIsQtyDecimal() )
50
- $qty = sprintf( "%.02f", $stock->getQty() );
51
- else
52
- $qty = floor( $stock->getQty() );
53
-
54
- echo "$qty items left";
55
- ?>
56
- </div>
57
- <?php if ( !$_product->isGrouped() ): ?>
58
- <form action="<?php echo Mage::getUrl('checkout/cart/add', array( 'product' => $_product->getId() ) ); ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
59
-
60
- <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
61
- <input type="hidden" name="related_product" id="related-products-field" value="" />
62
-
63
- <div class="frame-product-addtocart">
64
- <label for="qty"><?php echo $this->__('Qty:') ?></label>
65
- <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getMinimalQty($_product)*1; ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
66
- <button type="submit" title="<?php echo $buttonTitle ?>" class="button btn-cart" >
67
- <span>
68
- <span><?php echo $this->__('Add to Cart'); ?></span>
69
- </span>
70
- </button>
71
- </div>
72
- </form>
73
- <?php endif; ?>
74
-
75
- <?php else: ?>
76
- <div class="frame-product-not-saleable">Not saleable</div>
77
- <?php endif; ?>
78
-
79
- <div class="frame-product-price">
80
- <?php echo sprintf( "%.02f \$", $_product->getPrice() ); ?>
81
- </div>
82
-
83
- <?php if ( is_numeric( $_product->getSpecialPrice() ) ) :?>
84
- <div class="frame-product-specialprice">
85
- <?php echo sprintf( "%.02f \$", $_product->getSpecialPrice() ); ?>
86
- </div>
87
- <?php endif; ?>
88
-
89
- <?php
90
- $_attributes = array();
91
- foreach( $_product->getAttributes() as $attribute )
92
- if ( $attribute->getIsVisibleOnFront() )
93
- $_attributes[] = $attribute;
94
-
95
- if ( count($_attributes) ) {
96
- echo '<div class="frame-product-attributes">'
97
- .'<h3>'.$this->__('Additional data').'</h3>'
98
- .'<ul>';
99
- foreach( $_attributes as $attribute ) {
100
- $value = $attribute->getFrontend()->getValue($_product);
101
-
102
- if (!$_product->hasData($attribute->getAttributeCode()))
103
- $value = Mage::helper('catalog')->__('N/A');
104
- elseif ((string)$value == '')
105
- $value = Mage::helper('catalog')->__('No');
106
- elseif ($attribute->getFrontendInput() == 'price' && is_string($value))
107
- $value = Mage::app()->getStore()->convertPrice($value, true);
108
-
109
- echo '<li>'
110
- .'<span class="attribute">'
111
- .$this->htmlEscape( $this->__( $attribute->getStoreLabel() ) )
112
- .'</span>'
113
- .'<span class="value">'
114
- .$this->htmlEscape( $this->__( $value ) )
115
- .'</span>'
116
- .'</li>';
117
- }
118
- }
119
- ?>
120
-
121
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/removefromwishlist.phtml DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $callback = Mage::registry( 'callback' );
3
- $result = Mage::registry( 'oct8ne_result' );
4
-
5
- echo $callback;
6
- ?>({
7
- <?php
8
- if ( !Mage::registry( 'partial_search' ) )
9
- echo " result: \"".($result?"true":"false")."\"\n";
10
- ?>});
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/frame/search.phtml DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- $result_collection = Mage::registry( 'search_result_collection' );
4
- $attrs = Mage::registry( 'search_result_attrs' );
5
- $attrs_available = Mage::registry( 'search_result_attrs_available' );
6
- $attrs_applied = Mage::registry( 'search_result_attrs_applied' );
7
-
8
- $callback = Mage::registry( 'callback' );
9
-
10
- echo $callback;
11
- ?>({
12
- <?php
13
- if ( !Mage::registry( 'partial_search' ) )
14
- echo " total: \"".Mage::registry( 'total_search_results' )."\",\n";
15
- ?>
16
- results: [
17
- <?php foreach( $result_collection as $i => $item): ?>
18
- {
19
- InternalId: "<?php echo $item['id']; ?>",
20
- Title: "<?php echo $item['title']; ?>",
21
- PrevPrice: "<?php echo $item['original_price']; ?>",
22
- Price: "<?php echo $item['price']; ?>",
23
- Description: "<?php echo trim($item['description'], "\r\n\t "); ?>",
24
- Rating: "<?php echo $item['rating']; ?>",
25
- RouteTo: "<?php echo $item['url']; ?>",
26
- BuyURL: "<?php echo $item['buy_url']; ?>",
27
- Medias: [
28
- <?php foreach( $item['imgs'] as $j => $image ): ?>
29
- {Id: "<?php echo $j; ?>", FileName: <?php echo '"'.$image['url'].'"'; ?>}<?php if ( $j == count($item['imgs'])-1 ) echo "\n"; else echo ",\n"; ?>
30
- <?php endforeach; ?>
31
- ],
32
- Thumbnail: "<?php echo $item['thumbnail']; ?>",
33
- HasOptions: "<?php echo $item['has_options']; ?>"
34
- <?php
35
- if ( $i < count( $result_collection )-1 )
36
- echo "},\n";
37
- else
38
- echo "}\n";
39
- ?>
40
- <?php endforeach; ?>
41
- ],
42
- filters: [{
43
-
44
- Applied: [
45
- <?php foreach( $attrs_applied as $k => $attr): ?>
46
- {
47
- Param: "<?php echo $attr['code']; ?>",
48
- Name: "<?php echo $attr['name']; ?>",
49
- Value: "<?php echo $attr['value']; ?>",
50
- FeatureName: "<?php echo $attr['featurename']; ?>",
51
-
52
- }<?php if ( $k == count($attrs)-1 ) echo "\n"; else echo ",\n"; ?>
53
- <?php endforeach; ?>
54
- ],
55
-
56
- Available: [
57
- <?php foreach( $attrs_available as $k => $attr): ?>
58
- {
59
- Param: "<?php echo $attr['code']; ?>",
60
- Name: "<?php echo $attr['name']; ?>",
61
- Features: [
62
- <?php foreach( $attr['options'] as $p => $option): ?>
63
- { Param: "<?php echo $option['value']; ?>", Qty: "<?php echo $option['qty']; ?>", Name: "<?php echo htmlspecialchars($option['label']); ?>" }<?php if ( $p == count($attr['options'])-1 ) echo "\n"; else echo ",\n"; ?>
64
- <?php endforeach; ?>
65
- ]
66
- }<?php if ( $k == count($attrs)-1 ) echo "\n"; else echo ",\n"; ?>
67
- <?php endforeach; ?>
68
- ]
69
- }]
70
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/oct8ne/letssyncro.phtml CHANGED
@@ -1,98 +1,83 @@
1
  <?php
 
2
  global $letssyncro;
3
 
4
- function _letsyncro_remove_http($str) { return preg_replace('#^https?:#', '', $str); }
 
 
5
 
6
  $req = Mage::app()->getRequest();
 
7
  // Deshabilitar iframe al ver imágenes de productos
8
  $disable = ($req->getModuleName() == 'catalog' && $req->getActionName() == 'gallery');
9
 
10
- if(is_null(Mage::registry('oct8ne')) && !$disable)
11
- {
12
- if (!isset($letssyncro)) {
13
- $letssyncro = Mage::getModel('oct8ne/letssyncro')->load(1);
14
- $letssyncrooptions = $letssyncro->_data;
15
- if ($letssyncrooptions["licenseid"] != '' && $letssyncrooptions["enabled"] == '1' && strlen($letssyncrooptions['licenseid']) == 32 )
16
- {
17
- /*
18
- echo "
19
- <!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
20
- <script type= 'text/javascript'>
21
- var syncro = document.createElement(\"script\");
22
- syncro.type = \"text/javascript\";
23
- syncro.async = true;
24
- syncro.license = \"".$letssyncrooptions["licenseid"]."\";
25
- (function () {
26
- syncro.src = (document.location.protocol == \"https:\" ? \"https://\" : \"http://\") + 'backoffice.oct8ne.com/api/source/js/api/oct8ne-api.js';
27
- var s = document.getElementsByTagName(\"script\")[0];
28
- s.parentNode.insertBefore(syncro, s);
29
- })();
30
- </script>
31
- <!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
32
- ";
33
- */
34
- $baseurl = _letsyncro_remove_http(Mage::getBaseUrl());
35
- $checkouturl = _letsyncro_remove_http(Mage::helper('checkout/url')->getCheckoutUrl());
36
- $loginurl = Mage::helper('customer')->getLoginUrl();
37
- $currency = Mage::app()->getStore()->getCurrentCurrencyCode();
38
- $store = Mage::app()->getStore()->getId();
39
-
40
- //en el cas de la cerca
41
- $searchterm = "";
42
- $productlist = "";
43
- $request = Mage::app()->getRequest();
44
- if($request->getModuleName() =="catalogsearch" && ($request->getActionName()=="index" && $request->getControllerName() =="result")){
45
- //|| ($request->getActionName()=="result" && $request->getControllerName() =="advanced")){
46
- $searchterm = Mage::helper('catalogsearch')->getEscapedQueryText();
47
- $_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
48
- $total = count($_productCollection);
49
- $i = 0;
50
- $productlist = "[";
51
- foreach($_productCollection as $product){
52
- $p=Mage::getModel('catalog/product')->load($product->getId());
53
- //$productlist .= '{Id:"'.$product->getId().'", Thumb: "'.$p->getImageUrl().'"}';
54
- $productlist .= '{Id:"'.$product->getId().'", Thumbnail: "'.Mage::helper('oct8ne')->getProductThumbnail($p, 120).'"}';
55
- $i++;
56
- if($i<$total) $productlist .=',';
57
- }
58
- $productlist .= "]";
59
- }elseif($request->getModuleName() =="catalog" && ($request->getActionName()=="view" && $request->getControllerName() =="product")){
60
- //recuperem el id del producte actual i carreguem les dades del producte al detall d'aquest
61
- $product = Mage::registry('product');
62
- $productlist .= '[{Id:"'.$product->getId().'", Thumbnail: "'.Mage::helper('oct8ne')->getProductThumbnail($product, 120).'"}]';
63
-
64
- }else{
65
- $productlist = '[]';
66
- }
67
 
68
-
69
- $plugin = Mage::helper('oct8ne')->getExtensionVersion();
70
-
71
- $locale = str_replace('_', '-', Mage::app()->getLocale()->getLocaleCode());
72
-
73
- echo <<<EOT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  <script type= "text/javascript">
75
  var oct8ne = document.createElement("script");
76
  oct8ne.type = "text/javascript";
77
  oct8ne.async = true;
78
- oct8ne.plugin = "$plugin";
79
  oct8ne.license = "{$letssyncrooptions["licenseid"]}";
80
- oct8ne.apiUrl = "backoffice.oct8ne.com/";
81
- oct8ne.src = (document.location.protocol == "https:" ? "https://" : "http://") + oct8ne.apiUrl + 'api/source/js/api/oct8ne-api.js';
 
 
82
  oct8ne.baseUrl = "$baseurl";
83
  oct8ne.checkoutUrl = "$checkouturl";
84
- oct8ne.loginUrl = "$loginurl";
85
- oct8ne.currency = "$currency";
86
- oct8ne.store = "$store";
87
- oct8ne.searchTerm = "$searchterm";
88
- oct8ne.productList = $productlist;
89
- oct8ne.locale = "$locale";
 
 
 
 
 
 
 
 
 
 
90
  var s = document.getElementsByTagName("script")[0];
91
  s.parentNode.insertBefore(oct8ne, s);
92
  </script>
 
93
  EOT;
94
- }
95
- }
96
  }
97
  ?>
98
 
1
  <?php
2
+
3
  global $letssyncro;
4
 
5
+ function _letsyncro_remove_http($str) {
6
+ return preg_replace('#^https?:#', '', $str);
7
+ }
8
 
9
  $req = Mage::app()->getRequest();
10
+
11
  // Deshabilitar iframe al ver imágenes de productos
12
  $disable = ($req->getModuleName() == 'catalog' && $req->getActionName() == 'gallery');
13
 
14
+ if (is_null(Mage::registry('oct8ne')) && !$disable) {
15
+ if (!isset($letssyncro)) {
16
+ $letssyncro = Mage::getModel('oct8ne/letssyncro')->load(1);
17
+ $letssyncrooptions = $letssyncro->_data;
18
+ if ($letssyncrooptions["licenseid"] != '' && $letssyncrooptions["enabled"] == '1' && strlen($letssyncrooptions['licenseid']) == 32) {
19
+ $baseurl = _letsyncro_remove_http(Mage::getBaseUrl());
20
+ $checkouturl = _letsyncro_remove_http(Mage::helper('checkout/url')->getCheckoutUrl());
21
+ $loginurl = Mage::helper('customer')->getLoginUrl();
22
+ $currency = Mage::app()->getStore()->getCurrentCurrencyCode();
23
+ $store = Mage::app()->getStore()->getId();
24
+ $elementselector = Mage::getStoreConfig('design/oct8nedesign/elementselector') ? Mage::getStoreConfig('design/oct8nedesign/elementselector') : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ //en el cas de la cerca
27
+ $currentProduct = "";
28
+ $request = Mage::app()->getRequest();
29
+ if (($request->getModuleName() == "catalog" && ($request->getActionName() == "view" && $request->getControllerName() == "product")) || ($request->getModuleName() == "catalogsearch" && ($request->getActionName() == "index" && $request->getControllerName() == "result"))) {
30
+ $product = Mage::registry('product');
31
+ $currentProduct = '{id:"' . $product->getId() . '", thumbnail: "' . Mage::helper('oct8ne')->getProductThumbnail($product, 120) . '"}';
32
+ } else {
33
+ $currentProduct = "false";
34
+ }
35
+
36
+ $locale = str_replace('_', '-', Mage::app()->getLocale()->getLocaleCode());
37
+
38
+ $helper = Mage::helper('oct8ne/version');
39
+ $apiVersion = $helper->getApiVersion();
40
+ $apiMajorVersion = substr($apiVersion, 0, 1);
41
+ $adapterVersion = $helper->getAdapterVersion();
42
+ $oct8neHostName = Mage::helper('oct8ne/url')->getOct8neHostName();
43
+
44
+
45
+ echo <<<EOT
46
+
47
  <script type= "text/javascript">
48
  var oct8ne = document.createElement("script");
49
  oct8ne.type = "text/javascript";
50
  oct8ne.async = true;
 
51
  oct8ne.license = "{$letssyncrooptions["licenseid"]}";
52
+ oct8ne.server = "{$oct8neHostName}/";
53
+ oct8ne.src = (document.location.protocol == "https:" ? "https://" : "http://")
54
+ + '{$oct8neHostName}/api/v{$apiMajorVersion}/oct8ne-api-{$apiVersion}.js?'
55
+ + (Math.round(new Date().getTime() / 86400000));
56
  oct8ne.baseUrl = "$baseurl";
57
  oct8ne.checkoutUrl = "$checkouturl";
58
+ oct8ne.loginUrl = "$loginurl";
59
+ oct8ne.currentProduct = $currentProduct;
60
+ oct8ne.addToCartHttpVerb = "post";
61
+ oct8ne.locale = "$locale";
62
+ oct8ne.currency = "$";
63
+ EOT;
64
+
65
+ if ($elementselector) {
66
+ echo <<<EOT
67
+
68
+ oct8ne.searchElementSelector = "$elementselector";
69
+ EOT;
70
+
71
+ }
72
+ echo <<<EOT
73
+
74
  var s = document.getElementsByTagName("script")[0];
75
  s.parentNode.insertBefore(oct8ne, s);
76
  </script>
77
+
78
  EOT;
79
+ }
80
+ }
81
  }
82
  ?>
83
 
app/etc/modules/LetsSyncroLLC_Oct8ne.xml CHANGED
@@ -4,7 +4,7 @@
4
  <LetsSyncroLLC_Oct8ne>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.2.0</version>
8
  <depends>
9
  <Mage_Eav/>
10
  <Mage_Dataflow/>
4
  <LetsSyncroLLC_Oct8ne>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>2.0.0</version>
8
  <depends>
9
  <Mage_Eav/>
10
  <Mage_Dataflow/>
app/locale/es_ES/LetsSyncroLLC_Oct8ne.csv CHANGED
@@ -1,39 +1,39 @@
1
- "1 - Manual execution clicking the next button:","1 - Ejecución manual haciendo click en el siguiente botón:"
2
- "There are 2 ways to execute the synchronization:","Existen 2 maneras para ejecutar la sincronización:"
3
- "2 - Automatic execution scheduled and unattended. Two different ways for doing that:","2 - Ejecución automática planificada y desatendida. 2 formas diferentes para hacer esto:"
4
- "a - Call the PHP script via Web externally. Directly calling","a - Llamar al script PHP vía Web externamente. Directamente llamando"
5
- "b - Call the PHP script via Web internally. For example:","b - Llamar al script PHP vía Web internamente. Por ejemplo:"
6
- "Syncro Data","Sincronización de datos"
7
- "Dashboard","Panel de control"
8
- "Account Setup","Configuración de la cuenta"
9
- "Execute synchronization","Ejecutar sincronización"
10
- "OCT8NE Dashboard","Panel de control OCT8NE"
11
- "Status:","Estado:"
12
- "Linked account:","Cuenta enlazada:"
13
- "Email:","Email:"
14
- "Password:","Password:"
15
- "OCT8NE email","Email OCT8NE"
16
- "OCT8NE password","Password OCT8NE"
17
- "Don't have a OCT8NE account?","¿No tienes una cuenta OCT8NE?"
18
- "Sign up now","Regístrate ahora"
19
- "Link Up","Enlazar"
20
- "Synchronization finished successfully.","Sincronización finalizada correctamente."
21
- "Products added:","Productos añadidos:"
22
- "Products updated:","Productos actualizados:"
23
- "There was an error synchronizing with OCT8NE.","Ha ocurrido un error sincronizando con OCT8NE."
24
- "Does the account is properly linked up in Account Setup?","¿Está la cuenta correctamente enlazada en la configuración?"
25
- "The field (Email) cannot be empty.","El campo (Email) no puede estar vacío."
26
- "The field (Password) cannot be empty.","El campo (Password) no puede estar vacío."
27
- "The field (URL API) cannot be empty.","El campo (URL API) no puede estar vacío."
28
- "Account not linked. Please, link up your account before at OCT8NE/Account Setup.","Cuenta no enlazada. Por favor, enlace antes su cuenta en OCT8NE/Configuración de la cuenta."
29
- "There was an error on your credentials and cannot obtain OCT8NE integration data.","Hay un error en sus credenciales y no se han podido obtener los datos de integración con OCT8NE."
30
- "There was an error activating OCT8NE integration.","Ha ocurrido un error activando la integración con OCT8NE."
31
- "OCT8NE integration data obtained successfully!","¡Datos de integración con OCT8NE obtenidos correctamente!"
32
- "There was an error deactivating OCT8NE integration.","Ha ocurrido un error desactivando la integración con OCT8NE."
33
- "OCT8NE integration deactivated successfully!","¡Integración con OCT8NE desactivada correctamente!"
34
- "OCT8NE integration activated successfully!","¡Integración con OCT8NE activada correctamente!"
35
- "There was an error saving your settings.","Ha ocurrido un error grabando los ajustes."
36
- "The fields (License ID and API token) are invalid.","Los campos (License ID and API token) son inválidos."
37
- "Settings updated successfully.","Ajustes actualizados correctamente."
38
- "(Deactivate)","(Desactivar)"
39
  "(Activate)","(Activar)"
1
+ "1 - Manual execution clicking the next button:","1 - Ejecución manual haciendo click en el siguiente botón:"
2
+ "There are 2 ways to execute the synchronization:","Existen 2 maneras para ejecutar la sincronización:"
3
+ "2 - Automatic execution scheduled and unattended. Two different ways for doing that:","2 - Ejecución automática planificada y desatendida. 2 formas diferentes para hacer esto:"
4
+ "a - Call the PHP script via Web externally. Directly calling","a - Llamar al script PHP vía Web externamente. Directamente llamando"
5
+ "b - Call the PHP script via Web internally. For example:","b - Llamar al script PHP vía Web internamente. Por ejemplo:"
6
+ "Syncro Data","Sincronización de datos"
7
+ "Dashboard","Panel de control"
8
+ "Account Setup","Configuración de la cuenta"
9
+ "Execute synchronization","Ejecutar sincronización"
10
+ "OCT8NE Dashboard","Panel de control OCT8NE"
11
+ "Status:","Estado:"
12
+ "Linked account:","Cuenta enlazada:"
13
+ "Email:","Email:"
14
+ "Password:","Password:"
15
+ "OCT8NE email","Email OCT8NE"
16
+ "OCT8NE password","Password OCT8NE"
17
+ "Don't have a OCT8NE account?","¿No tienes una cuenta OCT8NE?"
18
+ "Sign up now","Regístrate ahora"
19
+ "Link Up","Enlazar"
20
+ "Synchronization finished successfully.","Sincronización finalizada correctamente."
21
+ "Products added:","Productos añadidos:"
22
+ "Products updated:","Productos actualizados:"
23
+ "There was an error synchronizing with OCT8NE.","Ha ocurrido un error sincronizando con OCT8NE."
24
+ "Does the account is properly linked up in Account Setup?","¿Está la cuenta correctamente enlazada en la configuración?"
25
+ "The field (Email) cannot be empty.","El campo (Email) no puede estar vacío."
26
+ "The field (Password) cannot be empty.","El campo (Password) no puede estar vacío."
27
+ "The field (URL API) cannot be empty.","El campo (URL API) no puede estar vacío."
28
+ "Account not linked. Please, link up your account before at OCT8NE/Account Setup.","Cuenta no enlazada. Por favor, enlace antes su cuenta en OCT8NE/Configuración de la cuenta."
29
+ "There was an error on your credentials and cannot obtain OCT8NE integration data.","Hay un error en sus credenciales y no se han podido obtener los datos de integración con OCT8NE."
30
+ "There was an error activating OCT8NE integration.","Ha ocurrido un error activando la integración con OCT8NE."
31
+ "OCT8NE integration data obtained successfully!","¡Datos de integración con OCT8NE obtenidos correctamente!"
32
+ "There was an error deactivating OCT8NE integration.","Ha ocurrido un error desactivando la integración con OCT8NE."
33
+ "OCT8NE integration deactivated successfully!","¡Integración con OCT8NE desactivada correctamente!"
34
+ "OCT8NE integration activated successfully!","¡Integración con OCT8NE activada correctamente!"
35
+ "There was an error saving your settings.","Ha ocurrido un error grabando los ajustes."
36
+ "The fields (License ID and API token) are invalid.","Los campos (License ID and API token) son inválidos."
37
+ "Settings updated successfully.","Ajustes actualizados correctamente."
38
+ "(Deactivate)","(Desactivar)"
39
  "(Activate)","(Activar)"
package.xml CHANGED
@@ -1,232 +1,18 @@
1
- <?xml version="1.0"?>
2
- <package>
3
- <name>LetsSyncroLLC_Oct8ne</name>
4
- <version>1.2.0</version>
5
- <stability>stable</stability>
6
- <license>license</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>Oct8ne extension</summary>
10
- <description>Oct8ne extension description</description>
11
- <notes>Notes</notes>
12
- <authors>
13
- <author>
14
- <name>Oct8ne</name>
15
- <user>Oct8ne</user>
16
- <email>xavier.gonzalez@oct8ne.com</email>
17
- </author>
18
- </authors>
19
- <date>2014-05-15</date>
20
- <time>16:34:43</time>
21
- <contents>
22
- <target name="magecommunity">
23
- <dir name="LetsSyncroLLC">
24
- <dir name="Oct8ne">
25
- <dir name="Block">
26
- <file name="Accountconfig.php" hash="b9493cd1f56a490bc8fc31f9315ff871"/>
27
- <dir name="Customer">
28
- <file name="Notifier.php" hash="4e5c509e127119a8b402832c6f2f2b23"/>
29
- </dir>
30
- <dir name="Html">
31
- <file name="Head.php" hash="3052f7a7e9d8adfe0eb0f4484f789b36"/>
32
- </dir>
33
- <dir name="Mage">
34
- <dir name="Product">
35
- <file name="View.php" hash="3052f7a7e9d8adfe0eb0f4484f789b36"/>
36
- </dir>
37
- </dir>
38
- <file name="Index.php" hash="d4cc07e7e6412cb9f3cedf2508f56461"/>
39
- </dir>
40
- <dir name="Helper">
41
- <dir name="Customer">
42
- <file name="Data.php" hash="4ad2ac2fc06fd5a491a48308ee92c9b7"/>
43
- </dir>
44
- <file name="Data.php" hash="ed5fb834be3848ad452f98fabd954147"/>
45
- <file name="Search.php" hash="b340e551645723143fb98bd1cb558a41"/>
46
- <file name="Url.php" hash="8b305c993f1a026d3fd67d1bfe88d3e9"/>
47
- <file name="Wishlist.php" hash="29c9447eb52548708918f07aaec9f7ef"/>
48
- </dir>
49
- <dir name="Model">
50
- <file name="Cron.php" hash="b2c54b02b18a4a4b8386278aa1b4b438"/>
51
- <file name="Letssyncro.php" hash="a7755ee759fa31f004207823314a907d"/>
52
- <dir name="Mage">
53
- <file name="Onepage.php" hash="09bdc97f5328062520758798a2b5545c"/>
54
- <file name="Url.php" hash="9811f73a73b5f1bd216442150f854a70"/>
55
- <file name="Package.php" hash="9811f73a73b5f1bd216442150f854a70"/>
56
- <file name="Rewrite.php" hash="9811f73a73b5f1bd216442150f854a70"/>
57
- <file name="Request.php" hash="9811f73a73b5f1bd216442150f854a70"/>
58
- </dir>
59
- <dir name="Mysql4">
60
- <dir name="LetsSyncro">
61
- <file name="Collection.php" hash="1820b31106065627aa81007f966de6b7"/>
62
- </dir>
63
- <file name="Letssyncro.php" hash="81b49a4f7770d408eacd230a41434cbf"/>
64
- <dir name="Orderproducts">
65
- <file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
66
- </dir>
67
- <dir name="Quoteproducts">
68
- <file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
69
- </dir>
70
- <file name="Orderproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
71
- <file name="Quoteproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
72
- </dir>
73
- <file name="Observer.php" hash="35c7a2608b071457d02ef3d0bc31f542"/>
74
- <file name="Orderproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
75
- <file name="Quoteproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
76
- </dir>
77
- <dir name="controllers">
78
- <file name="AccountController.php" hash="492f053985eca9a14bc1abf698966d77"/>
79
- <file name="AdminController.php" hash="c5206f6bbbdc7d98d93e99d948aa241d"/>
80
- <file name="FrameController.php" hash="579c3a25d80cf4f4276661b99896f397"/>
81
- <file name="IndexController.php" hash="5a63469c2dead9b78a262fd580a3e43b"/>
82
- <file name="letssyncro.phtml" hash="3e6771c4f2010f678d19c3363f0c8c85"/>
83
- </dir>
84
- <dir name="etc">
85
- <file name="config.xml" hash="5522d65fca36340aec368c46cad348ce"/>
86
- <file name="system.xml" hash="69b466103caeefe73a618b350872d90d"/>
87
- </dir>
88
- <dir name="sql">
89
- <dir name="oct8ne_setup">
90
- <file name="mysql4-install-0.5.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
91
- <file name="mysql4-install-1.0.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
92
- <file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="0de801ad4896defa9491391754ee7229"/>
93
- <file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="0de801ad4896defa9491391754ee7229"/>
94
- </dir>
95
- </dir>
96
- </dir>
97
- </dir>
98
- </target>
99
- <target name="mageetc">
100
- <dir name="modules">
101
- <file name="LetsSyncroLLC_Oct8ne.xml" hash="c964f1f25c986f91785da5189565d4a1"/>
102
- </dir>
103
- </target>
104
- <target name="magedesign">
105
- <dir name="frontend">
106
- <dir name="default">
107
- <dir name="oct8ne">
108
- <dir name="layout">
109
- <file name="oct8ne.xml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
110
- </dir>
111
- <dir name="template">
112
- <dir name="page">
113
- <file name="1column.phtml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
114
- <file name="2columns-left.phtml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
115
- <file name="2columns-right.phtml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
116
- <file name="3columns.phtml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
117
- </dir>
118
- </dir>
119
- </dir>
120
- </dir>
121
- <dir name="base">
122
- <dir name="default">
123
- <dir name="layout">
124
- <file name="oct8ne.xml" hash="852d97d55ef98d7c7157b54eed0b9459"/>
125
- </dir>
126
- <dir name="template">
127
- <dir name="oct8ne">
128
- <dir name="frame">
129
- <file name="add2cart.phtml" hash="c5e128243cfdf8b6b4abe2f297ec8335"/>
130
- <file name="addtowishlist.phtml" hash="00d4f2f3b3ef337de28e5cca3bc8df6a"/>
131
- <file name="clean-page.phtml" hash="edc071b2173758821d2a27fbce26ef2b"/>
132
- <file name="getversion.phtml" hash="72ec76ebc77c89b5d3b59fe436a937b1"/>
133
- <dir name="customer">
134
- <file name="data.phtml" hash="44133496fb036a5c9989d52c5f85b19b"/>
135
- <file name="notifier.phtml" hash="c97f29ac7ae1754284721bdffe06250b"/>
136
- </dir>
137
- <file name="getcart.phtml" hash="f67bacfaf225c8972a52de542cac1d69"/>
138
- <file name="getwishlist.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
139
- <file name="getreportdata.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
140
- <file name="json-page.phtml" hash="509893c584213ad7d78e17a1a53249d1"/>
141
- <file name="loginpost.phtml" hash="ea57cb60b282d1fc60186503f6909176"/>
142
- <file name="naked-page.phtml" hash="6b9275b9ba11e9c79610b52e423e5dda"/>
143
- <file name="productinfo.phtml" hash="4ed7ed6dab345d43d3095b95daf98114"/>
144
- <file name="productrelated.phtml" hash="72e36adb79a36c00f8153ae777710402"/>
145
- <dir name="productview">
146
- <file name="additional.phtml" hash="7bab9dbcc43d46b0aa057dd92547e49e"/>
147
- <file name="addto.phtml" hash="4aadc1acfec31347887991ef0c192e01"/>
148
- <file name="addtocart.phtml" hash="d6b9ff292fb9e482184e909200c8138d"/>
149
- <file name="attributes.phtml" hash="a234143e664549fbca1d49c1e950efc5"/>
150
- <file name="description.phtml" hash="a9ee13db96558372435034562dbdaa7a"/>
151
- <file name="media.phtml" hash="d50c7b227b03a647ea0ec2172182a232"/>
152
- <file name="media.phtml.ORIGINAL" hash="385cb80abc228301060ffafa147c9783"/>
153
- <dir name="options">
154
- <file name="js.phtml" hash="9d5c5c4786c5b9fb7125f6f3cc8c7309"/>
155
- <dir name="type">
156
- <file name="date.phtml" hash="5bdfd7dc4817a500095e076a21a2c467"/>
157
- <file name="default.phtml" hash="f1acbd98563c6640c4a0b6cf5abc994f"/>
158
- <file name="file.phtml" hash="b72f9363f049dd486ff0a3c8b667cbc9"/>
159
- <file name="select.phtml" hash="5dbbe91d0581ccb291737992c5188121"/>
160
- <file name="text.phtml" hash="1aaef71a9e81521aab601aa281fa0b8e"/>
161
- </dir>
162
- <dir name="wrapper">
163
- <file name="bottom.phtml" hash="6a612992021e3e65ca7b5f6e897821d5"/>
164
- </dir>
165
- <file name="wrapper.phtml" hash="472e04ad6c1a35dfeaa54b3012884ed6"/>
166
- </dir>
167
- <file name="options.phtml" hash="c1227dcadb83af6708d78a032ffd8d6c"/>
168
- <file name="price.phtml" hash="f2ae6daff42b8ee7074d27c8bf5f1e6c"/>
169
- <file name="price_clone.phtml" hash="732daf46245f4ee7068d5ae26defc750"/>
170
- <file name="tierprices.phtml" hash="0b7f122253b505c45772eff069203a5d"/>
171
- <dir name="type">
172
- <file name="configurable.phtml" hash="1a0a77285960b4227f000855e8194ed7"/>
173
- <file name="default.phtml" hash="dd5d4b8859956d79ec7d42522b4f42a8"/>
174
- <file name="grouped.phtml" hash="f5d7db323383b19a80ab3c55a1736dd5"/>
175
- <dir name="options">
176
- <file name="configurable.phtml" hash="c37919561a3cde0d9b92fd34d44c69c1"/>
177
- </dir>
178
- <file name="simple.phtml" hash="1a0a77285960b4227f000855e8194ed7"/>
179
- <file name="virtual.phtml" hash="1a0a77285960b4227f000855e8194ed7"/>
180
- </dir>
181
- </dir>
182
- <file name="productview-FROM-SCRATCH.phtml" hash="5dfc5225e6e0986b3fa9d2d091dd759e"/>
183
- <file name="productview.phtml" hash="5425b92fb7fbc5fe426ed07174c7a9a2"/>
184
- <file name="removefromwishlist.phtml" hash="00d4f2f3b3ef337de28e5cca3bc8df6a"/>
185
- <file name="search.phtml" hash="0834fe5ae26493351fbee92c2b996cdc"/>
186
- </dir>
187
- <file name="letssyncro.phtml" hash="8394bc898da079723a621bb586a3438c"/>
188
- </dir>
189
- </dir>
190
- </dir>
191
- </dir>
192
- </dir>
193
- </target>
194
- <target name="magelocale">
195
- <dir>
196
- <dir name="en_US">
197
- <file name="LetsSyncroLLC_Oct8ne.csv" hash="686df4107da7e35e243b629c5ee57963"/>
198
- </dir>
199
- <dir name="es_ES">
200
- <file name="LetsSyncroLLC_Oct8ne.csv" hash="eb0b3ddaae1e2e52005e9ab23cb37163"/>
201
- </dir>
202
- </dir>
203
- </target>
204
- <target name="mageskin">
205
- <dir name="frontend">
206
- <dir name="base">
207
- <dir name="default">
208
- <file name="oct8ne.css" hash="2104af20cc380d0c745531e1dca2f97c"/>
209
- </dir>
210
- </dir>
211
- </dir>
212
- <dir name="adminhtml">
213
- <dir name="default">
214
- <dir name="default">
215
- <dir name="images">
216
- <file name="LetsSyncro_Logo.png" hash="2104af20cc380d0c745531e1dca2f97c"/>
217
- </dir>
218
- </dir>
219
- </dir>
220
- </dir>
221
- </target>
222
- </contents>
223
- <compatible/>
224
- <dependencies>
225
- <required>
226
- <php>
227
- <min>5.3.0</min>
228
- <max>5.5.99</max>
229
- </php>
230
- </required>
231
- </dependencies>
232
- </package>
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>LetsSyncroLLC_Oct8ne</name>
4
+ <version>2.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Oct8ne extension</summary>
10
+ <description>Agent-assisted search, proprietary co-viewing technology, &amp; live chat to engage in personal selling &amp; service.</description>
11
+ <notes>Minor bugs fixed</notes>
12
+ <authors><author><name>Oct8ne</name><user>Oct8ne</user><email>xavier.gonzalez@oct8ne.com</email></author></authors>
13
+ <date>2015-04-30</date>
14
+ <time>08:04:25</time>
15
+ <contents><target name="magecommunity"><dir name="LetsSyncroLLC"><dir name="Oct8ne"><dir name="Block"><file name="Accountconfig.php" hash="436dc6ed540632eb4b0f6917bbd62cbe"/><dir name="Customer"><file name="Notifier.php" hash="58785a446c6c6a69db0348b81852028b"/></dir><dir name="Html"><file name="Head.php" hash="7fec049acbd3391ce0176982eede105b"/></dir><file name="Index.php" hash="d4cc07e7e6412cb9f3cedf2508f56461"/><dir name="Mage"><dir name="Product"><file name="View.php" hash="ca15ba7c5cc756cc18af5c9c48fbe492"/></dir></dir></dir><dir name="Helper"><file name="CustomerData.php" hash="8a34a58756c97f3dd043abc8e8bc6a2c"/><file name="Data.php" hash="8b8af1c6dd6517ad32c5b10f7a6a88b4"/><file name="Image.php" hash="a03be23a4397774c69557f2bcc44e863"/><file name="Search.php" hash="4a7207bbff2db493d3a6c0526fb53eb7"/><file name="Url.php" hash="c1ea68e020ccf7c3622028a3ca6fb4c7"/><file name="Version.php" hash="aa3bf164dd162351e058e8b5f43b3754"/><file name="Wishlist.php" hash="527bb806bf2c6ecea035a1bcdbe78270"/></dir><dir name="Model"><file name="Cron.php" hash="11fbdce80ef509a89cbc055960c627dd"/><file name="Letssyncro.php" hash="a7755ee759fa31f004207823314a907d"/><dir name="Mage"><file name="Onepage.php" hash="400ea1de621a7d2e6b0e04db55b60027"/><file name="Package.php" hash="2877ece9775c269ca9b45cc6f81f673f"/><file name="Request.php" hash="feee181c817bc4a1ed8d662104ddb1af"/><file name="Rewrite.php" hash="5699a8b1707724c4ad01fd6998cf12d6"/><file name="Url.php" hash="82a05832eaea74fedfd2c5b081dc5cc6"/></dir><dir name="Mysql4"><dir name="LetsSyncro"><file name="Collection.php" hash="1820b31106065627aa81007f966de6b7"/></dir><file name="Letssyncro.php" hash="81b49a4f7770d408eacd230a41434cbf"/><dir name="Orderproducts"><file name="Collection.php" hash="06e0828b6dbb87a110fcda58ce04e90c"/></dir><file name="Orderproducts.php" hash="96bf9e4f859a44d7ecb44e6319a16e62"/><dir name="Quoteproducts"><file name="Collection.php" hash="1b3154c09f9b8b3f525937e18d63c5b5"/></dir><file name="Quoteproducts.php" hash="32e565482455445dbc9d0e5f9a4dfdad"/></dir><file name="Observer.php" hash="73e57c0803d3d05d89e5ed646569d68b"/><file name="Orderproducts.php" hash="9edf0ab5159b046d0d33c2766087183f"/><file name="Quoteproducts.php" hash="3b6baf23d5ab4136c52fe24d470a3fd0"/></dir><dir name="controllers"><file name="AccountController.php" hash="c900a756947b61498e5edd2e39b1d0bf"/><file name="AdminController.php" hash="c5206f6bbbdc7d98d93e99d948aa241d"/><file name="FrameController.php" hash="4c25f8481feff0b5e67147d6a4bcb79b"/><file name="IndexController.php" hash="5a63469c2dead9b78a262fd580a3e43b"/></dir><dir name="etc"><file name="config.xml" hash="bf6b5d6773e312023364f9e20a738a93"/><file name="system.xml" hash="8421c301f81fe34f9abea301dce209fb"/></dir><dir name="sql"><dir name="oct8ne_setup"><file name="mysql4-install-2.0.0.php" hash="3e0f70fc772825cddf29b5cf9152a196"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="0944f9c420562fa8071b04eff2abdb15"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="bfdad124cbf44578af8b3aff95bb78bf"/><file name="mysql4-upgrade-2.0.0.php" hash="c54894921ab155a55058b4f94070e051"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="oct8ne"><dir name="layout"><file name="oct8ne.xml" hash="664f6b6c51799aba0fa905cbc80eb703"/></dir><dir name="template"><dir name="page"><file name="1column.phtml" hash="3fbf17f71254a75cbf3261eab5a727ab"/><file name="2columns-left.phtml" hash="3fbf17f71254a75cbf3261eab5a727ab"/><file name="2columns-right.phtml" hash="3fbf17f71254a75cbf3261eab5a727ab"/><file name="3columns.phtml" hash="3fbf17f71254a75cbf3261eab5a727ab"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="oct8ne.xml" hash="4b6f167fdbaf25f864934c0e8ecdda51"/></dir><dir name="template"><dir name="oct8ne"><dir name="frame"><file name="clean-page.phtml" hash="86c6580270709b8adb8a624130704cb5"/><dir name="productview"><file name="additional.phtml" hash="d0f80a4f31b31154af12197301cbc524"/><file name="addto.phtml" hash="358f19e35ff76f853cfad50ad35329fc"/><file name="addtocart.phtml" hash="06ac8be9a7197e87e8c5972c27804cc9"/><file name="attributes.phtml" hash="def5531385ad60aac88274bd91f76f52"/><file name="description.phtml" hash="09674e0a56d36f27c93d3a52c3a880c4"/><file name="media.phtml" hash="b23c4e9ef29e00d2f592d822fec8e52c"/><file name="media.phtml.ORIGINAL" hash="071f4d92269b2cbfa1a14271afbf0dbe"/><dir name="options"><file name="js.phtml" hash="7d9917d908ca99033c3473ecc10d895d"/><dir name="type"><file name="date.phtml" hash="41a612891cda695e3023d15a460c4325"/><file name="default.phtml" hash="b6f6d8e715f2a1d59913f313654fc38a"/><file name="file.phtml" hash="5e336ccdfa66b78264e5a0e859600d74"/><file name="select.phtml" hash="162f029fc825b78676cce70633805e62"/><file name="text.phtml" hash="c2c2940fb278d952e0e0d5d232ba5ed9"/></dir><dir name="wrapper"><file name="bottom.phtml" hash="182b49972e67cc834b8e1094a3984f5b"/></dir><file name="wrapper.phtml" hash="b635f6abf10b920afb6000b462134db6"/></dir><file name="options.phtml" hash="60d92d70da66f28300788027aa6f3056"/><file name="price.phtml" hash="06e90ec3368d07d62c3895f706069f96"/><file name="price_clone.phtml" hash="fb1ca9b19f97b0498f529b96c5c0e372"/><file name="tierprices.phtml" hash="4ac50d3c9f54d11fa5041a361485da74"/><dir name="type"><file name="configurable.phtml" hash="b9a427816f9c8a3d0d7179e8d5382683"/><file name="default.phtml" hash="e7f000d4b7fbc62f4e155e429f976126"/><file name="grouped.phtml" hash="9ce42ac44794853963bf68e9f2e911b0"/><dir name="options"><file name="configurable.phtml" hash="2636b369c1ceacd1b131f77ade2c996f"/></dir><file name="simple.phtml" hash="b9a427816f9c8a3d0d7179e8d5382683"/><file name="virtual.phtml" hash="b9a427816f9c8a3d0d7179e8d5382683"/></dir></dir><file name="productview.phtml" hash="da287c78285ecb003bbee37491d3a2f2"/></dir><file name="letssyncro.phtml" hash="409c17be662cbe4196cd7dedbc3b51f1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LetsSyncroLLC_Oct8ne.xml" hash="65ce2cb1601b7ed46aec5cc85c17618d"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="LetsSyncroLLC_Oct8ne.csv" hash="686df4107da7e35e243b629c5ee57963"/></dir><dir name="es_ES"><file name="LetsSyncroLLC_Oct8ne.csv" hash="eb0b3ddaae1e2e52005e9ab23cb37163"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><file name="oct8ne.css" hash="4255fddac8c054bbe32621cdccf844b8"/></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="LetsSyncro_Logo.png" hash="2104af20cc380d0c745531e1dca2f97c"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>