Version Notes
Expertrec Recommendation plugin for magento sites.
Download this release
Release Info
Developer | melchi |
Extension | Expertrec_Recommendation |
Version | 1.2.12 |
Comparing to | |
See all releases |
Code changes from version 1.2.11 to 1.2.12
- app/code/community/Expertrec/Recommendation/Block/Api.php +299 -367
- app/code/community/Expertrec/Recommendation/Helper/Autocompletehelper.php +60 -80
- app/code/community/Expertrec/Recommendation/Helper/Data.php +190 -215
- app/code/community/Expertrec/Recommendation/Helper/Filehelper.php +64 -75
- app/code/community/Expertrec/Recommendation/Helper/Search/Layout.php +392 -459
- app/code/community/Expertrec/Recommendation/Helper/Suggestionhelper.php +86 -108
- app/code/community/Expertrec/Recommendation/Model/Api/Request.php +95 -126
- app/code/community/Expertrec/Recommendation/Model/Feed.php +30 -37
- app/code/community/Expertrec/Recommendation/Model/Feed/Feedconfig.php +63 -63
- app/code/community/Expertrec/Recommendation/Model/Feed/Feedcreator.php +107 -143
- app/code/community/Expertrec/Recommendation/Model/Feed/Feedfilter.php +4 -17
- app/code/community/Expertrec/Recommendation/Model/Feed/Formatter.php +105 -115
- app/code/community/Expertrec/Recommendation/Model/Log.php +17 -24
- app/code/community/Expertrec/Recommendation/Model/Observer.php +1 -1
- app/code/community/Expertrec/Recommendation/Model/Translator/Category.php +26 -38
- app/code/community/Expertrec/Recommendation/Model/Validate.php +31 -40
- app/code/community/Expertrec/Recommendation/Model/Writer/Abstract.php +13 -23
- app/code/community/Expertrec/Recommendation/Model/Writer/Csv.php +25 -37
- app/code/community/Expertrec/Recommendation/controllers/Adminhtml/IndexController.php +15 -11
- app/code/community/Expertrec/Recommendation/controllers/ApiController.php +3 -4
- app/code/community/Expertrec/Recommendation/controllers/ConfigController.php +199 -241
- app/code/community/Expertrec/Recommendation/controllers/IndexController.php +170 -201
- app/code/community/Expertrec/Recommendation/etc/adminhtml.xml +6 -4
- app/code/community/Expertrec/Recommendation/etc/config.xml +41 -44
- app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.2.11.php +0 -89
- app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.2.12.php +75 -0
- app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.2.10-1.2.11.php +0 -78
- app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.2.11-1.2.12.php +64 -0
- app/design/adminhtml/default/default/layout/expertrec/recommendation.xml +3 -2
- app/design/adminhtml/default/default/template/expertrec/recommendation/notifications.phtml +10 -11
- app/design/frontend/base/default/layout/expertrec/recommendation.xml +10 -9
- app/design/frontend/base/default/template/expertrec/feed/info.phtml +508 -642
- app/design/frontend/base/default/template/expertrec/recommendation/tracker.phtml +28 -38
- app/design/frontend/base/default/template/expertrec/recommendation/tracking/product.phtml +10 -13
- app/design/frontend/base/default/template/expertrec/search/custom.phtml +3 -0
- app/design/frontend/base/default/template/expertrec/search/list.phtml +13 -16
- app/design/frontend/base/default/template/expertrec/search/view.phtml +6 -8
- package.xml +4 -4
app/code/community/Expertrec/Recommendation/Block/Api.php
CHANGED
@@ -1,268 +1,231 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
return "I am inside `" . $version. "` block and it is my first custom block ever !";
|
36 |
-
}
|
37 |
-
|
38 |
-
//Fetching website domain URL
|
39 |
-
public function getBaseUrl()
|
40 |
-
{
|
41 |
-
$baseUrl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
42 |
-
return $baseUrl;
|
43 |
-
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
return $mid;
|
51 |
-
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
public function getLogUrl()
|
60 |
-
{
|
61 |
-
$logUrl['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/index/getlog';
|
62 |
-
$logUrl['link'] = $this->getBaseUrl().'index.php/expertrec-feed/index/getlog?secret='.$this->getSecret();
|
63 |
-
$logUrl['secret'] = $this->getSecret();
|
64 |
-
return $logUrl;
|
65 |
-
}
|
66 |
-
public function getCleanDirUrl()
|
67 |
-
{
|
68 |
-
$cleanDirUrl['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/index/clean';
|
69 |
-
$cleanDirUrl['link'] = $this->getBaseUrl().'index.php/expertrec-feed/index/clean?secret='.$this->getSecret();
|
70 |
-
$cleanDirUrl['secret'] = $this->getSecret();
|
71 |
-
return $cleanDirUrl;
|
72 |
-
}
|
73 |
-
// pull feed from info page
|
74 |
-
public function pullFeed(){
|
75 |
-
$pullFeed['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/api/pullFeed';
|
76 |
-
$pullFeed['secret'] = $this->getSecret();
|
77 |
-
$pullFeed['link'] = $this->getBaseUrl().'index.php/expertrec-feed/api/pullFeed?secret='.$this->getSecret();
|
78 |
-
return $pullFeed;
|
79 |
-
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
$apiUrlWithCustomConf['cmd']="export";
|
87 |
-
$apiUrlWithCustomConf['wid']=1;
|
88 |
-
$apiUrlWithCustomConf['sid']=1;
|
89 |
-
return $apiUrlWithCustomConf;
|
90 |
-
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$apiUrlWithCustomConf['wid']=1;
|
99 |
-
$apiUrlWithCustomConf['sid']=1;
|
100 |
-
return $apiUrlWithCustomConf;
|
101 |
-
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$imageHeight = Mage::getStoreConfig(self::IMAGE_HEIGHT);
|
110 |
-
$thumbWidth = Mage::getStoreConfig(self::THUMBNAIL_WIDTH);
|
111 |
-
$thumbHeight = Mage::getStoreConfig(self::THUMBNAIL_HEIGHT);
|
112 |
-
|
113 |
|
114 |
-
//
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
118 |
}
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
$imageParamsArray["thumbheight"] = $thumbHeight;
|
|
|
|
|
133 |
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
$websiteStoreRow["cmd"] = "export";
|
165 |
-
$websiteStoreRow['link'] = $url;
|
166 |
-
|
167 |
-
try{
|
168 |
-
$websiteStoreRow["pcount"] = Mage::helper('expertrec_recommendation')->getProductCount($wid,$sid);
|
169 |
-
|
170 |
-
}catch(Exception $e){
|
171 |
-
$websiteStoreRow["pcounterr"] = $e.getMessage();
|
172 |
-
}
|
173 |
-
try{
|
174 |
-
$filteredCollection = $feedFilter->addBasicFilter($website,$oStore);
|
175 |
-
$websiteStoreRow["fcount"] = $filteredCollection->getSize();
|
176 |
-
|
177 |
-
}catch(Exception $e){
|
178 |
-
$websiteStoreRow["fcounterr"] = $e.getMessage();
|
179 |
-
}
|
180 |
-
|
181 |
-
array_push($websiteStoreData,$websiteStoreRow);
|
182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
/*
|
189 |
-
Feed config functions
|
190 |
-
*/
|
191 |
-
public function isFeedUpload()
|
192 |
-
{
|
193 |
-
$isUpload = Mage::helper('expertrec_recommendation')->getConfig(self::IS_UPLOAD_FEED);
|
194 |
-
return $isUpload;
|
195 |
-
}
|
196 |
-
|
197 |
-
public function getFeedConfUrl()
|
198 |
-
{
|
199 |
-
$urlArray = array();
|
200 |
-
|
201 |
-
$textArray = array("log_api"=>"Feed log endpoint", "upload_api"=>"Feed upload endpoint");
|
202 |
-
$textToStoreKeyMapArray = array("log_api"=>self::FEED_LOG_ENDPOINT,"upload_api"=>self::FEED_UPLOAD_ENDPOINT);
|
203 |
-
|
204 |
-
foreach ($textArray as $tKey => $tValue) {
|
205 |
-
$storeValue = Mage::helper('expertrec_recommendation')->getConfig($textToStoreKeyMapArray[$tKey]);
|
206 |
-
$label = ucwords(str_replace("_", " ", $tKey));
|
207 |
-
|
208 |
-
$urlRow = array();
|
209 |
-
$urlRow["label"] = $label;
|
210 |
-
$urlRow["tkey"] = $tKey;
|
211 |
-
$urlRow["storevalue"] = $storeValue;
|
212 |
-
$urlRow["placeholder"] = $tValue;
|
213 |
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
$chekboxArray = array(
|
227 |
"search_enable"=>self::SEARCH_LIST_ENABLE,
|
228 |
"fetch_price"=>self::SEARCH_FETCH_PRICE,
|
229 |
"convert_price"=>self::SEARCH_CONVERT_PRICE,
|
230 |
-
"is_ajax"=>self::SEARCH_IS_AJAX
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
array_push($searchCheckArray,$checkRow);
|
243 |
}
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
}
|
248 |
-
|
249 |
-
public function getSearchFields()
|
250 |
-
{
|
251 |
$searchFieldArray = array();
|
252 |
$textArray = array(
|
253 |
"api"=>"Search endpoint",
|
254 |
"facet_list"=>"Facet list comma separated",
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
$textToStoreKeyMapArray = array(
|
260 |
"api"=>self::SEARCH_LIST_API,
|
261 |
"facet_list"=>self::SEARCH_FACET_LIST,
|
262 |
"single_select_filter"=>self::SEARCH_SINGLE_SELECT_FILTERS,
|
263 |
"items_per_page"=>self::SEARCH_ITEMS_PER_PAGE,
|
264 |
-
"display_pages"=>self::SEARCH_DISPLAY_PAGES
|
265 |
-
|
|
|
266 |
foreach ($textArray as $tKey => $tValue) {
|
267 |
$searchFieldRow = array();
|
268 |
$label = ucwords(str_replace("_", " ", $tKey));
|
@@ -272,163 +235,132 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
|
|
272 |
$searchFieldRow["storevalue"] = $storeValue;
|
273 |
$searchFieldRow["placeholder"] = $tValue;
|
274 |
array_push($searchFieldArray,$searchFieldRow);
|
275 |
-
|
276 |
}
|
277 |
-
|
278 |
return $searchFieldArray;
|
279 |
-
}
|
280 |
-
|
281 |
-
/*
|
282 |
-
Site Details section
|
283 |
-
*/
|
284 |
-
public function getSiteDetails()
|
285 |
-
{
|
286 |
-
$siteDetails = array();
|
287 |
-
|
288 |
-
try
|
289 |
-
{
|
290 |
-
$siteDetails["adminEmail"] = Mage::getStoreConfig('trans_email/ident_general/email');
|
291 |
-
$siteDetails["adminName"] = Mage::getStoreConfig('trans_email/ident_general/name');
|
292 |
-
$siteDetails["salesEmail"] = Mage::getStoreConfig('trans_email/ident_sales/email');
|
293 |
-
$siteDetails["salesName"] = Mage::getStoreConfig('trans_email/ident_sales/name');
|
294 |
-
$siteDetails["secureUrl"] = Mage::getStoreConfig('web/secure/base_url');
|
295 |
-
$siteDetails["unsecureUrl"] = Mage::getStoreConfig('web/unsecure/base_url');
|
296 |
-
$siteDetails["baseCurrency"] = Mage::getStoreConfig('currency/options/base');
|
297 |
-
$siteDetails["defaultCurrency"] = Mage::getStoreConfig('currency/options/default');
|
298 |
-
$siteDetails["allowCurrency"] = Mage::getStoreConfig('currency/options/allow');
|
299 |
-
$siteDetails["timezone"] = Mage::getStoreConfig('general/locale/timezone');
|
300 |
-
$siteDetails["defaultCountry"] = Mage::getStoreConfig('general/country/default');
|
301 |
-
$siteDetails["installedCurrency"] = Mage::getStoreConfig('system/currency/installed');
|
302 |
-
|
303 |
}
|
304 |
-
catch(Exception $e)
|
305 |
-
{}
|
306 |
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
$installedModules['errorstr'] = $e.getMessage();
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
}
|
328 |
-
|
329 |
-
public function getActiveExtensions($installedModules)
|
330 |
-
{
|
331 |
-
$activeModules = array();
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
$coreHelper = Mage::helper('core');
|
339 |
$activeModulesArr = array();
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
$activeModules['modulestr'] = implode(', ',$activeModulesArr);
|
350 |
-
}
|
351 |
-
catch(Exception $e)
|
352 |
-
{
|
353 |
$activeModules['errorstr'] = $e.getMessage();
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
}
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
}
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
if (isset($storedHeaders))
|
397 |
-
{
|
398 |
$storedHeadersArray = explode(',', $storedHeaders);
|
|
|
|
|
399 |
}
|
400 |
-
return $storedHeadersArray;
|
401 |
-
}
|
402 |
-
|
403 |
-
/*
|
404 |
-
Get all filters function
|
405 |
-
*/
|
406 |
-
public function getAllFilters()
|
407 |
-
{
|
408 |
-
$filterArray = array(
|
409 |
-
'filter_by_stock',
|
410 |
-
'filter_by_status',
|
411 |
-
// 'filter_by_visiblity'
|
412 |
-
'not_visible_individually',
|
413 |
-
'visible_catalog',
|
414 |
-
'visible_search',
|
415 |
-
'visible_catalog_search'
|
416 |
-
);
|
417 |
-
|
418 |
-
return $filterArray;
|
419 |
-
}
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
-
|
427 |
-
|
|
|
|
|
428 |
$storedFiltersArray = explode(',', $storedFilters);
|
|
|
|
|
429 |
}
|
430 |
-
|
431 |
-
return $storedFiltersArray;
|
432 |
}
|
433 |
-
}
|
434 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
|
4 |
+
|
5 |
+
const CONFIG_HEADERS = 'expertrec/general/headers';
|
6 |
+
const CONFIG_FILTERS = 'expertrec/general/filters';
|
7 |
+
const MERCHANT_ID = 'expertrec/general/mid';
|
8 |
+
const SEARCH_LIST_ENABLE = 'search/enable';
|
9 |
+
const SEARCH_LIST_API = 'search/api';
|
10 |
+
const SEARCH_FACET_LIST = 'search/facets_list';
|
11 |
+
const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
|
12 |
+
const SEARCH_IS_AJAX = 'search/is_ajax';
|
13 |
+
const SEARCH_ITEMS_PER_PAGE = 'search/items_per_page';
|
14 |
+
const SEARCH_DISPLAY_PAGES = 'search/display_pages';
|
15 |
+
const SEARCH_FETCH_PRICE = 'search/fetch_price';
|
16 |
+
const SEARCH_CONVERT_PRICE = 'search/convert_price';
|
17 |
+
const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
|
18 |
+
const FEED_LOG_ENDPOINT = 'expertrec/general/log_endpoint';
|
19 |
+
const FEED_UPLOAD_ENDPOINT = 'expertrec/general/upload_endpoint';
|
20 |
+
const IS_UPLOAD_FEED = 'expertrec/general/is_upload';
|
21 |
+
const IMAGE_WIDTH = 'expertrec/general/expertrec_image_width';
|
22 |
+
const IMAGE_HEIGHT = 'expertrec/general/expertrec_image_height';
|
23 |
+
const THUMBNAIL_WIDTH = 'expertrec/general/expertrec_thumbnail_width';
|
24 |
+
const THUMBNAIL_HEIGHT = 'expertrec/general/expertrec_thumbnail_height';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* A custom method use to return a simple string.
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getText(){
|
31 |
+
$version = (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version');
|
32 |
+
return "I am inside `" . $version. "` block and it is my first custom block ever !";
|
33 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
// Fetching website domain URL
|
36 |
+
public function getBaseUrl(){
|
37 |
+
$baseUrl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
38 |
+
return $baseUrl;
|
39 |
+
}
|
|
|
|
|
40 |
|
41 |
+
// Fetching merchant ID
|
42 |
+
public function getMerchantID(){
|
43 |
+
$mid = "";
|
44 |
+
$mid=Mage::getStoreConfig(self::MERCHANT_ID);
|
45 |
+
return $mid;
|
46 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
// Fetching secret passed in url request parameters
|
49 |
+
public function getSecret(){
|
50 |
+
$customerSecret = Mage::registry('secret');
|
51 |
+
return $customerSecret;
|
52 |
+
}
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
public function getLogUrl(){
|
55 |
+
$logUrl['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/index/getlog';
|
56 |
+
$logUrl['link'] = $this->getBaseUrl().'index.php/expertrec-feed/index/getlog?secret='.$this->getSecret();
|
57 |
+
$logUrl['secret'] = $this->getSecret();
|
58 |
+
return $logUrl;
|
59 |
+
}
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
public function getCleanDirUrl(){
|
62 |
+
$cleanDirUrl['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/index/clean';
|
63 |
+
$cleanDirUrl['link'] = $this->getBaseUrl().'index.php/expertrec-feed/index/clean?secret='.$this->getSecret();
|
64 |
+
$cleanDirUrl['secret'] = $this->getSecret();
|
65 |
+
return $cleanDirUrl;
|
66 |
+
}
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
// PullFeed
|
69 |
+
public function pullFeed(){
|
70 |
+
$pullFeed['surl'] = $this->getBaseUrl().'index.php/expertrec-feed/api/pullFeed';
|
71 |
+
$pullFeed['secret'] = $this->getSecret();
|
72 |
+
$pullFeed['link'] = $this->getBaseUrl().'index.php/expertrec-feed/api/pullFeed?secret='.$this->getSecret();
|
73 |
+
return $pullFeed;
|
74 |
}
|
75 |
|
76 |
+
public function getCustomApiUrl(){
|
77 |
+
$apiUrlWithCustomConf['surl']=$this->getBaseUrl().'index.php/expertrec-feed';
|
78 |
+
$apiUrlWithCustomConf['link']=$this->getBaseUrl().'index.php/expertrec-feed?secret='.$this->getSecret().'&cmd=export&wid=1&sid=1';
|
79 |
+
$apiUrlWithCustomConf['secret']=$this->getSecret();
|
80 |
+
$apiUrlWithCustomConf['cmd']="export";
|
81 |
+
$apiUrlWithCustomConf['wid']=1;
|
82 |
+
$apiUrlWithCustomConf['sid']=1;
|
83 |
+
return $apiUrlWithCustomConf;
|
84 |
}
|
85 |
|
86 |
+
public function getSuggestionApiUrl(){
|
87 |
+
$apiUrlWithCustomConf['surl']=$this->getBaseUrl().'index.php/expertrec-feed';
|
88 |
+
$apiUrlWithCustomConf['link']=$this->getBaseUrl().'index.php/expertrec-feed?secret='.$this->getSecret().'&cmd=getpp&wid=1&sid=1';
|
89 |
+
$apiUrlWithCustomConf['secret']=$this->getSecret();
|
90 |
+
$apiUrlWithCustomConf['cmd']="getpp";
|
91 |
+
$apiUrlWithCustomConf['wid']=1;
|
92 |
+
$apiUrlWithCustomConf['sid']=1;
|
93 |
+
return $apiUrlWithCustomConf;
|
94 |
}
|
95 |
|
96 |
+
// Fetching image width and height
|
97 |
+
public function getImageParams(){
|
98 |
+
$keys = array('imgwidth', 'imgheight','thumbwidth', 'thumbwidth');
|
99 |
+
$imageParamsArray = array_fill_keys($keys, "");
|
100 |
+
$imageWidth = Mage::getStoreConfig(self::IMAGE_WIDTH);
|
101 |
+
$imageHeight = Mage::getStoreConfig(self::IMAGE_HEIGHT);
|
102 |
+
$thumbWidth = Mage::getStoreConfig(self::THUMBNAIL_WIDTH);
|
103 |
+
$thumbHeight = Mage::getStoreConfig(self::THUMBNAIL_HEIGHT);
|
104 |
+
|
105 |
+
// Checking for non-empty and non-null image width and height
|
106 |
+
if (isset($imageWidth) && $imageWidth != ""){
|
107 |
+
$imageParamsArray["imgwidth"] = $imageWidth;
|
108 |
+
}
|
109 |
+
if (isset($imageHeight) && $imageHeight != ""){
|
110 |
+
$imageParamsArray["imgheight"] = $imageHeight;
|
111 |
+
}
|
112 |
+
if (isset($thumbWidth) && $thumbWidth != ""){
|
113 |
+
$imageParamsArray["thumbwidth"] = $thumbWidth;
|
114 |
+
}
|
115 |
+
if (isset($thumbHeight) && $thumbHeight != ""){
|
116 |
$imageParamsArray["thumbheight"] = $thumbHeight;
|
117 |
+
}
|
118 |
+
return $imageParamsArray;
|
119 |
}
|
120 |
|
121 |
+
// Fetching website store info
|
122 |
+
public function getWebsiteStoreInfo(){
|
123 |
+
$feedFilter = Mage::getSingleton('expertrec_recommendation/feed_feedfilter');
|
124 |
+
$baseUrl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
125 |
+
$websiteStoreData = array();
|
126 |
+
// List all website-stores
|
127 |
+
$websiteCollection = Mage::getModel('core/website')->getCollection()->load();
|
128 |
+
foreach ($websiteCollection as $website){
|
129 |
+
$wid=$website->getWebsiteId();
|
130 |
+
foreach ($website->getGroups() as $group) {
|
131 |
+
$stores = $group->getStores();
|
132 |
+
foreach ($stores as $oStore) {
|
133 |
+
$sid=$oStore->getId();
|
134 |
+
$websiteStoreRow = array();
|
135 |
+
$apiUrl=Mage::app()->getStore($sid)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'index.php/expertrec-feed';
|
136 |
+
$url = Mage::app()->getStore($sid)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'index.php/expertrec-feed?secret='.$this->getSecret().'&cmd=export&wid='.$wid.'&sid='.$sid;
|
137 |
+
// Display the store-website details with feed api
|
138 |
+
$websiteStoreRow["wid"] = $wid;
|
139 |
+
$websiteStoreRow["wname"] = $website->getName();
|
140 |
+
$websiteStoreRow["sid"] = $sid;
|
141 |
+
$websiteStoreRow["sname"] = $oStore->getName();
|
142 |
+
$websiteStoreRow["surl"] = $apiUrl;
|
143 |
+
$websiteStoreRow["secret"] = $this->getSecret();
|
144 |
+
$websiteStoreRow["cmd"] = "export";
|
145 |
+
$websiteStoreRow['link'] = $url;
|
146 |
+
try{
|
147 |
+
$websiteStoreRow["pcount"] = Mage::helper('expertrec_recommendation')->getProductCount($wid,$sid);
|
148 |
+
}catch(Exception $e){
|
149 |
+
$websiteStoreRow["pcounterr"] = $e.getMessage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
+
try{
|
152 |
+
$filteredCollection = $feedFilter->addBasicFilter($website,$oStore);
|
153 |
+
$websiteStoreRow["fcount"] = $filteredCollection->getSize();
|
154 |
+
}catch(Exception $e){
|
155 |
+
$websiteStoreRow["fcounterr"] = $e.getMessage();
|
156 |
+
}
|
157 |
+
array_push($websiteStoreData,$websiteStoreRow);
|
158 |
+
}
|
159 |
}
|
160 |
+
}
|
161 |
+
return $websiteStoreData;
|
162 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
+
/*
|
165 |
+
* Feed config functions
|
166 |
+
*/
|
167 |
+
public function isFeedUpload(){
|
168 |
+
$isUpload = Mage::helper('expertrec_recommendation')->getConfig(self::IS_UPLOAD_FEED);
|
169 |
+
return $isUpload;
|
170 |
}
|
171 |
|
172 |
+
public function getFeedConfUrl(){
|
173 |
+
$urlArray = array();
|
174 |
+
$textArray = array("log_api"=>"Feed log endpoint", "upload_api"=>"Feed upload endpoint");
|
175 |
+
$textToStoreKeyMapArray = array("log_api"=>self::FEED_LOG_ENDPOINT,"upload_api"=>self::FEED_UPLOAD_ENDPOINT);
|
176 |
+
foreach ($textArray as $tKey => $tValue) {
|
177 |
+
$storeValue = Mage::helper('expertrec_recommendation')->getConfig($textToStoreKeyMapArray[$tKey]);
|
178 |
+
$label = ucwords(str_replace("_", " ", $tKey));
|
179 |
+
$urlRow = array();
|
180 |
+
$urlRow["label"] = $label;
|
181 |
+
$urlRow["tkey"] = $tKey;
|
182 |
+
$urlRow["storevalue"] = $storeValue;
|
183 |
+
$urlRow["placeholder"] = $tValue;
|
184 |
+
array_push($urlArray,$urlRow);
|
185 |
+
}
|
186 |
+
return $urlArray;
|
187 |
+
}
|
188 |
|
189 |
+
/*
|
190 |
+
* Search config functions
|
191 |
+
*/
|
192 |
+
public function getSearchCheckedValues(){
|
193 |
+
$searchCheckArray = array();
|
194 |
+
$chekboxArray = array(
|
|
|
195 |
"search_enable"=>self::SEARCH_LIST_ENABLE,
|
196 |
"fetch_price"=>self::SEARCH_FETCH_PRICE,
|
197 |
"convert_price"=>self::SEARCH_CONVERT_PRICE,
|
198 |
+
"is_ajax"=>self::SEARCH_IS_AJAX,
|
199 |
+
"custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
|
200 |
+
foreach ($chekboxArray as $cKey => $cValue)
|
201 |
+
{
|
202 |
+
$checkRow = array();
|
203 |
+
$storeValue = Mage::helper('expertrec_recommendation')->getConfig($cValue);
|
204 |
+
$checkRow['label'] = ucwords(str_replace("_", " ", $cKey));
|
205 |
+
$checkRow['val'] = $cKey;
|
206 |
+
$checkRow['checked'] = isset($storeValue) && $storeValue == "true" ? "checked" :'';
|
207 |
+
array_push($searchCheckArray,$checkRow);
|
208 |
+
}
|
209 |
+
return $searchCheckArray;
|
|
|
210 |
}
|
211 |
|
212 |
+
public function getSearchFields(){
|
|
|
|
|
|
|
|
|
|
|
213 |
$searchFieldArray = array();
|
214 |
$textArray = array(
|
215 |
"api"=>"Search endpoint",
|
216 |
"facet_list"=>"Facet list comma separated",
|
217 |
+
"single_select_filter"=>"Single select filters comma separated",
|
218 |
+
"items_per_page"=>"No of items per page",
|
219 |
+
"display_pages"=>"No. of pages to display"
|
220 |
+
);
|
221 |
$textToStoreKeyMapArray = array(
|
222 |
"api"=>self::SEARCH_LIST_API,
|
223 |
"facet_list"=>self::SEARCH_FACET_LIST,
|
224 |
"single_select_filter"=>self::SEARCH_SINGLE_SELECT_FILTERS,
|
225 |
"items_per_page"=>self::SEARCH_ITEMS_PER_PAGE,
|
226 |
+
"display_pages"=>self::SEARCH_DISPLAY_PAGES
|
227 |
+
);
|
228 |
+
// Input
|
229 |
foreach ($textArray as $tKey => $tValue) {
|
230 |
$searchFieldRow = array();
|
231 |
$label = ucwords(str_replace("_", " ", $tKey));
|
235 |
$searchFieldRow["storevalue"] = $storeValue;
|
236 |
$searchFieldRow["placeholder"] = $tValue;
|
237 |
array_push($searchFieldArray,$searchFieldRow);
|
|
|
238 |
}
|
|
|
239 |
return $searchFieldArray;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
|
|
|
|
241 |
|
242 |
+
/*
|
243 |
+
* Site Details section
|
244 |
+
*/
|
245 |
+
public function getSiteDetails(){
|
246 |
+
$siteDetails = array();
|
247 |
+
try{
|
248 |
+
$siteDetails["adminEmail"] = Mage::getStoreConfig('trans_email/ident_general/email');
|
249 |
+
$siteDetails["adminName"] = Mage::getStoreConfig('trans_email/ident_general/name');
|
250 |
+
$siteDetails["salesEmail"] = Mage::getStoreConfig('trans_email/ident_sales/email');
|
251 |
+
$siteDetails["salesName"] = Mage::getStoreConfig('trans_email/ident_sales/name');
|
252 |
+
$siteDetails["secureUrl"] = Mage::getStoreConfig('web/secure/base_url');
|
253 |
+
$siteDetails["unsecureUrl"] = Mage::getStoreConfig('web/unsecure/base_url');
|
254 |
+
$siteDetails["baseCurrency"] = Mage::getStoreConfig('currency/options/base');
|
255 |
+
$siteDetails["defaultCurrency"] = Mage::getStoreConfig('currency/options/default');
|
256 |
+
$siteDetails["allowCurrency"] = Mage::getStoreConfig('currency/options/allow');
|
257 |
+
$siteDetails["timezone"] = Mage::getStoreConfig('general/locale/timezone');
|
258 |
+
$siteDetails["defaultCountry"] = Mage::getStoreConfig('general/country/default');
|
259 |
+
$siteDetails["installedCurrency"] = Mage::getStoreConfig('system/currency/installed');
|
260 |
|
261 |
+
}
|
262 |
+
catch(Exception $e){}
|
263 |
+
return $siteDetails;
|
264 |
+
}
|
265 |
|
266 |
+
public function getInstalledExtensions(){
|
267 |
+
$installedModules = array();
|
268 |
+
try{
|
269 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
270 |
+
$modulesNameArray = array_keys($modulesArray);
|
271 |
+
$installedModules['modulearr'] = $modulesNameArray;
|
272 |
+
$installedModules['modulestr'] = implode(', ',$modulesNameArray);
|
273 |
+
}
|
274 |
+
catch(Exception $e){
|
275 |
$installedModules['errorstr'] = $e.getMessage();
|
276 |
+
}
|
277 |
+
return $installedModules;
|
278 |
+
}
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
public function getActiveExtensions($installedModules){
|
281 |
+
$activeModules = array();
|
282 |
+
// Pass only if the installed modules are retrieved successful, an array of modules is needed
|
283 |
+
if(isset($installedModules)){
|
284 |
+
try{
|
285 |
$coreHelper = Mage::helper('core');
|
286 |
$activeModulesArr = array();
|
287 |
+
foreach ($installedModules as $module){
|
288 |
+
if($coreHelper->isModuleEnabled($module)){
|
289 |
+
$activeModulesArr[] = $module;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
$activeModules['modulestr'] = implode(', ',$activeModulesArr);
|
293 |
+
}
|
294 |
+
catch(Exception $e){
|
|
|
|
|
|
|
|
|
|
|
295 |
$activeModules['errorstr'] = $e.getMessage();
|
296 |
+
}
|
297 |
+
}
|
298 |
+
return $activeModules;
|
299 |
+
}
|
|
|
300 |
|
301 |
+
/*
|
302 |
+
* Feed Headers function
|
303 |
+
*/
|
304 |
+
public function getAllAttributes(){
|
305 |
+
$attrArray = array(
|
306 |
+
'qty',
|
307 |
+
'is_in_stock',
|
308 |
+
'expert_image',
|
309 |
+
'expert_smallImage',
|
310 |
+
'expert_thumbnail',
|
311 |
+
'expert_category',
|
312 |
+
'expert_category_ids',
|
313 |
+
'expert_url',
|
314 |
+
'final_price',
|
315 |
+
'entity_id',
|
316 |
+
'attribute_set_id',
|
317 |
+
'type_id',
|
318 |
+
'entity_type_id',
|
319 |
+
'rating_summary'
|
320 |
+
);
|
321 |
+
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
|
322 |
+
|
323 |
+
foreach ($attributes as $attribute) {
|
324 |
+
$attrCode = $attribute->getAttributeCode();
|
325 |
+
if (!in_array($attrCode, $attrArray)) {
|
326 |
+
$attrArray[] = $attrCode;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
return $attrArray;
|
330 |
+
}
|
|
|
331 |
|
332 |
+
public function getStoredHeaders(){
|
333 |
+
$storedHeadersArray = array();
|
334 |
+
$storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
|
335 |
+
if (isset($storedHeaders)) {
|
|
|
|
|
336 |
$storedHeadersArray = explode(',', $storedHeaders);
|
337 |
+
}
|
338 |
+
return $storedHeadersArray;
|
339 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
+
/*
|
342 |
+
* Get all filters function
|
343 |
+
*/
|
344 |
+
public function getAllFilters(){
|
345 |
+
$filterArray = array(
|
346 |
+
'filter_by_stock',
|
347 |
+
'filter_by_status',
|
348 |
+
// 'filter_by_visiblity'
|
349 |
+
'not_visible_individually',
|
350 |
+
'visible_catalog',
|
351 |
+
'visible_search',
|
352 |
+
'visible_catalog_search'
|
353 |
+
);
|
354 |
+
return $filterArray;
|
355 |
+
}
|
356 |
|
357 |
+
public function getStoredFilters(){
|
358 |
+
$storedFiltersArray = array();
|
359 |
+
$storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
|
360 |
+
if(isset($storedFilters)){
|
361 |
$storedFiltersArray = explode(',', $storedFilters);
|
362 |
+
}
|
363 |
+
return $storedFiltersArray;
|
364 |
}
|
|
|
|
|
365 |
}
|
|
|
366 |
?>
|
app/code/community/Expertrec/Recommendation/Helper/Autocompletehelper.php
CHANGED
@@ -1,128 +1,108 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Helper_Autocompletehelper extends Mage_Core_Helper_Abstract{
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
}
|
18 |
-
return $newUrl;
|
19 |
-
}
|
20 |
|
21 |
-
|
22 |
$searchApi = "";
|
23 |
try{
|
24 |
$itemsPerPage = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_ITEMS_PER_PAGE);
|
25 |
$storeSearchApi = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_API);
|
26 |
}catch(Exception $e){
|
27 |
-
|
28 |
}
|
29 |
if(!empty($itemsPerPage)){
|
30 |
$this->_itemsPerPage = $itemsPerPage;
|
31 |
}
|
32 |
-
|
33 |
if(!empty($storeSearchApi)){
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
}
|
43 |
}
|
|
|
44 |
}
|
45 |
-
|
46 |
return $searchApi;
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
$filters = array();
|
56 |
$resultData = array();
|
57 |
try{
|
58 |
$confArray["url"] = $this->getFormatUrl(Mage::helper('core/url')->getCurrentUrl());
|
59 |
$confArray["query"] = htmlentities($requestParams['q'], ENT_QUOTES);
|
60 |
-
|
61 |
$confArray["curPage"] = isset($requestParams['p']) ? (int)$requestParams['p'] : 1;
|
62 |
-
|
63 |
$mode = isset($requestParams['mode']) ? $requestParams['mode'] : 'grid';
|
64 |
$confArray["mode"] = $mode == 'list' ? $mode : 'grid';
|
65 |
$confArray["order"] = isset($requestParams["order"]) ? $requestParams["order"] : 'relevance';
|
66 |
-
|
67 |
try{
|
68 |
$facetList = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_FACET_LIST);
|
69 |
$this->_facetList = !empty($facetList) ? explode(",", $facetList) : $this->_facetList;
|
70 |
}catch(Exception $ex){
|
71 |
-
|
72 |
}
|
73 |
-
|
74 |
if(count($this->_facetList) > 0){
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
}
|
81 |
-
|
|
|
82 |
}
|
83 |
-
|
84 |
//setup search url
|
85 |
$searchApi = $this->getSearchApi($confArray);
|
86 |
//Mage::getSingleton('expertrec_recommendation/log')->log('search url: '.$searchApi);
|
87 |
-
|
88 |
if(!empty($searchApi)){
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
}else{
|
108 |
-
$facetNavHtml = '';
|
109 |
-
}
|
110 |
-
|
111 |
-
$resultData["listHtml"] = $searchListHtml;
|
112 |
-
$resultData["facetHtml"] = $facetNavHtml;
|
113 |
-
|
114 |
-
|
115 |
}
|
116 |
-
|
117 |
}catch (Exception $e) {
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
}
|
122 |
-
|
123 |
return $resultData;
|
124 |
-
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Helper_Autocompletehelper extends Mage_Core_Helper_Abstract{
|
4 |
|
5 |
+
const SEARCH_LIST_API = 'search/api';
|
6 |
+
const SEARCH_FACET_LIST = 'search/facets_list';
|
7 |
+
const SEARCH_ITEMS_PER_PAGE = 'search/items_per_page';
|
8 |
|
9 |
+
protected $_facetList = array();
|
10 |
+
protected $_itemsPerPage = 20;
|
11 |
|
12 |
+
protected function getFormatUrl($url){
|
13 |
+
$splitedUrl = explode("?", $url);
|
14 |
+
$newUrl = preg_replace('/\/ajax/',"",$splitedUrl[0]);
|
15 |
+
if(count($splitedUrl) == 2){
|
16 |
+
$newUrl .= '?'.$splitedUrl[1];
|
17 |
+
}
|
18 |
+
return $newUrl;
|
19 |
}
|
|
|
|
|
20 |
|
21 |
+
protected function getSearchApi($confArray){
|
22 |
$searchApi = "";
|
23 |
try{
|
24 |
$itemsPerPage = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_ITEMS_PER_PAGE);
|
25 |
$storeSearchApi = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_API);
|
26 |
}catch(Exception $e){
|
27 |
+
Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::getting searchApi exception: '.$e->getMessage());
|
28 |
}
|
29 |
if(!empty($itemsPerPage)){
|
30 |
$this->_itemsPerPage = $itemsPerPage;
|
31 |
}
|
|
|
32 |
if(!empty($storeSearchApi)){
|
33 |
+
$searchApi = $storeSearchApi;
|
34 |
+
$previous = $confArray["curPage"]-1;
|
35 |
+
$searchApi .= "?q=".urlencode($confArray["query"])."&page=".$previous."&size=".$this->_itemsPerPage;
|
36 |
+
$searchApi .= "&fq=order:".urlencode($confArray["order"]);
|
37 |
+
if(isset($confArray['filters'])){
|
38 |
+
$filters = $confArray['filters'];
|
39 |
+
foreach ($filters as $fkey => $fvalue) {
|
40 |
+
$searchApi .= "&fq=".$fkey.":".urlencode($fvalue);
|
|
|
41 |
}
|
42 |
+
}
|
43 |
}
|
|
|
44 |
return $searchApi;
|
45 |
+
}
|
46 |
|
47 |
+
public function getItemsPerPage(){
|
48 |
+
return (int)$this->_itemsPerPage;
|
49 |
+
}
|
50 |
|
51 |
+
public function prepareLayer($requestParams){
|
52 |
+
$confArray = array();
|
53 |
$filters = array();
|
54 |
$resultData = array();
|
55 |
try{
|
56 |
$confArray["url"] = $this->getFormatUrl(Mage::helper('core/url')->getCurrentUrl());
|
57 |
$confArray["query"] = htmlentities($requestParams['q'], ENT_QUOTES);
|
|
|
58 |
$confArray["curPage"] = isset($requestParams['p']) ? (int)$requestParams['p'] : 1;
|
|
|
59 |
$mode = isset($requestParams['mode']) ? $requestParams['mode'] : 'grid';
|
60 |
$confArray["mode"] = $mode == 'list' ? $mode : 'grid';
|
61 |
$confArray["order"] = isset($requestParams["order"]) ? $requestParams["order"] : 'relevance';
|
|
|
62 |
try{
|
63 |
$facetList = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_FACET_LIST);
|
64 |
$this->_facetList = !empty($facetList) ? explode(",", $facetList) : $this->_facetList;
|
65 |
}catch(Exception $ex){
|
66 |
+
Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::getting facetlist from db exception: '.$ex->getMessage());
|
67 |
}
|
|
|
68 |
if(count($this->_facetList) > 0){
|
69 |
+
foreach($this->_facetList as $facet){
|
70 |
+
$filter = isset($requestParams[$facet]) ? $requestParams[$facet] : '';
|
71 |
+
if(!empty($filter)){
|
72 |
+
$filters[$facet] = str_replace(" ","+",$filter);
|
|
|
73 |
}
|
74 |
+
}
|
75 |
+
$confArray['filters'] = $filters;
|
76 |
}
|
|
|
77 |
//setup search url
|
78 |
$searchApi = $this->getSearchApi($confArray);
|
79 |
//Mage::getSingleton('expertrec_recommendation/log')->log('search url: '.$searchApi);
|
|
|
80 |
if(!empty($searchApi)){
|
81 |
+
//sending request
|
82 |
+
$resp = Mage::helper('expertrec_recommendation')->sendCurl($searchApi);
|
83 |
+
$response_json = json_decode($resp,true);
|
84 |
+
if(isset($response_json["res"]) && isset($response_json["res"]["count"])){
|
85 |
+
$confArray["count"] = (int)$response_json["res"]["count"];
|
86 |
+
}
|
87 |
+
//Initiate search layout
|
88 |
+
$layoutHelper = Mage::helper('expertrec_recommendation/search_layout')->init($confArray);
|
89 |
+
$searchListData = $response_json["results"];
|
90 |
+
$searchListHtml = $layoutHelper->prepareLayout($searchListData);
|
91 |
+
if(isset($confArray['filters'])){
|
92 |
+
$facetData = $response_json["facets"];
|
93 |
+
$facetNavHtml = $layoutHelper->prepareFilterLayout($facetData);
|
94 |
+
}else{
|
95 |
+
$facetNavHtml = '';
|
96 |
+
}
|
97 |
+
$resultData["listHtml"] = $searchListHtml;
|
98 |
+
$resultData["facetHtml"] = $facetNavHtml;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
|
|
100 |
}catch (Exception $e) {
|
101 |
+
Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::prepareLayer exception: '.$e->getMessage());
|
102 |
+
$resultData["listHtml"] = '<div style="color:red;><span style="font-weight:bold;">Error: </span>Oops. Something went wrong. Please try again later.</div>';
|
103 |
+
$resultData["facetHtml"] = '';
|
104 |
}
|
|
|
105 |
return $resultData;
|
106 |
+
}
|
107 |
+
}
|
|
|
|
|
108 |
?>
|
app/code/community/Expertrec/Recommendation/Helper/Data.php
CHANGED
@@ -1,256 +1,231 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
|
10 |
-
|
11 |
-
const CONFIG_PREFIX = 'expertrec/general';
|
12 |
-
const FEED_UPLOAD_ENDPOINT = 'expertrec/general/upload_endpoint';
|
13 |
-
|
14 |
-
public function getUniqueId($product, $item=null) {
|
15 |
-
$type= null;
|
16 |
-
if($product->hasData('type_id')) {
|
17 |
-
$type = $product->getData('type_id');
|
18 |
-
}
|
19 |
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
}
|
27 |
}
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
return $parentIds[0];
|
35 |
}
|
36 |
-
}else {
|
37 |
-
return $parentIds[0];
|
38 |
}
|
|
|
|
|
39 |
}
|
40 |
|
41 |
-
$
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
47 |
return $this;
|
48 |
}
|
49 |
-
|
50 |
-
$path = self::CONFIG_PREFIX . '/' . $key;
|
51 |
-
Mage::getConfig()->saveConfig(rtrim($path, '/'), (string)$value, $scope, $scopeId);
|
52 |
-
|
53 |
-
// Mage::getSingleton('expertrec_recommendation/log')->log( "Successfully updated : <".$key."> in core_config_data table.");
|
54 |
-
return $this;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function getConfig($key){
|
58 |
-
$path = self::CONFIG_PREFIX . '/' . $key;
|
59 |
-
|
60 |
-
return Mage::getStoreConfig($path);
|
61 |
-
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
public function sendCurl($command){
|
68 |
-
|
69 |
-
if (isset($ch))
|
70 |
-
{
|
71 |
-
unset($ch);
|
72 |
}
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
78 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
79 |
-
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
|
80 |
-
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
|
81 |
-
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 65000);
|
82 |
-
$str = curl_exec($ch);
|
83 |
-
$curl_errno = curl_errno($ch);
|
84 |
-
$curl_error = curl_error($ch);
|
85 |
-
curl_close($ch);
|
86 |
|
87 |
-
|
88 |
-
{
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
-
else
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
$str = 'failed';
|
99 |
}
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
$pages = array();
|
107 |
-
if ($totalPages <= $displayPages) {
|
108 |
-
$pages = range(1, $totalPages);
|
109 |
-
}
|
110 |
-
else{
|
111 |
-
$half = ceil($displayPages / 2);
|
112 |
-
if ($curPage >= $half && $curPage <= $totalPages - $half){
|
113 |
-
$start = ($curPage - $half) + 1;
|
114 |
-
$finish = ($start + $displayPages) - 1;
|
115 |
-
}elseif ($curPage < $half) {
|
116 |
-
$start = 1;
|
117 |
-
$finish = $displayPages;
|
118 |
-
}elseif ($curPage > ($totalPages - $half)) {
|
119 |
-
$finish = $totalPages;
|
120 |
-
$start = $finish - $displayPages + 1;
|
121 |
}
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
-
return $pages;
|
125 |
-
}
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
}
|
134 |
-
return '';
|
135 |
-
}
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
143 |
}
|
144 |
-
return '';
|
145 |
-
}
|
146 |
-
|
147 |
|
148 |
-
public function getProductCompareUrl($productId){
|
149 |
-
try{
|
150 |
-
$product=Mage::getModel('catalog/product')->load($productId);
|
151 |
-
return Mage::helper('catalog/product_compare')->getAddUrl($product);
|
152 |
-
}catch(Exception $e){
|
153 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Product-Compare Url: ".$e->getMessage());
|
154 |
-
}
|
155 |
-
return '';
|
156 |
-
|
157 |
-
}
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
if($fetchPrice){
|
162 |
$product=Mage::getModel('catalog/product')->load($productId);
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
}
|
167 |
-
|
168 |
-
|
169 |
-
}
|
170 |
-
$formattedPrice = Mage::helper('core')->currency((int)$price, true, true);
|
171 |
-
return $formattedPrice;
|
172 |
-
}catch(Exception $e){
|
173 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting FormattedPrice: ".$e->getMessage());
|
174 |
}
|
175 |
-
return '';
|
176 |
-
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
-
return
|
184 |
-
}catch(Exception $e){
|
185 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Format Price: ".$e->getMessage());
|
186 |
}
|
187 |
-
return '';
|
188 |
-
}
|
189 |
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
-
return '';
|
198 |
-
}
|
199 |
-
|
200 |
-
/*
|
201 |
-
Fetching number of products per store, per website
|
202 |
-
*/
|
203 |
-
public function getProductCount($wid,$sid)
|
204 |
-
{
|
205 |
-
$productcount = 0;
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
return false;
|
223 |
}
|
224 |
-
|
225 |
-
|
226 |
-
$file = new CurlFile($filepath,'',$filename);
|
227 |
-
$fields = array('file'=>$file);
|
228 |
-
|
229 |
-
$ch = curl_init();
|
230 |
-
curl_setopt($ch, CURLOPT_URL,$url);
|
231 |
-
curl_setopt($ch, CURLOPT_POST,true);
|
232 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
|
233 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
234 |
-
|
235 |
-
$logger->log('Pushing the feed to '.$url);
|
236 |
-
// push the feed to the server
|
237 |
-
$response = curl_exec($ch);
|
238 |
-
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
239 |
-
$logger->log("Response from the server: ".json_encode($response));
|
240 |
-
|
241 |
-
if($status != 200) {
|
242 |
-
throw new Exception('Unexpected response from server');
|
243 |
-
}
|
244 |
-
$logger->log("File Successfully uploaded to the server.");
|
245 |
-
Mage::helper('expertrec_recommendation/filehelper')->deleteFile($filepath);
|
246 |
-
}catch(Exception $ex){
|
247 |
-
$logger->log("Error while uploading the feed because of " . $ex->getMessage());
|
248 |
-
return false;
|
249 |
}
|
250 |
-
|
251 |
-
|
252 |
-
}
|
253 |
-
|
254 |
-
|
255 |
-
}
|
256 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* @category Expertrec
|
6 |
+
* @package Expertrec_Recommendation
|
7 |
+
* @copyright Copyright (c) 2016 CloudInfra LLC.
|
8 |
+
*/
|
9 |
+
class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
const CONFIG_PREFIX = 'expertrec/general';
|
12 |
+
const FEED_UPLOAD_ENDPOINT = 'expertrec/general/upload_endpoint';
|
13 |
|
14 |
+
public function getUniqueId($product, $item=null) {
|
15 |
+
$type= null;
|
16 |
+
if($product->hasData('type_id')) {
|
17 |
+
$type = $product->getData('type_id');
|
|
|
18 |
}
|
19 |
+
if($type =='simple'){
|
20 |
+
if ($item != null && $item instanceof Mage_Sales_Model_Order) {
|
21 |
+
if($item->getParentItem() != null) {
|
22 |
+
$productId = $item->getParentItem()->getProductId();
|
23 |
+
return $productId;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
27 |
+
if(!isset($parentIds) || sizeof($parentIds) == 0) {
|
28 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
|
29 |
+
if(isset($parentIds) && sizeof($parentIds) > 0) {
|
30 |
+
return $parentIds[0];
|
31 |
+
}
|
32 |
+
}else {
|
33 |
return $parentIds[0];
|
34 |
}
|
|
|
|
|
35 |
}
|
36 |
+
$productId = $product->getData('entity_id');
|
37 |
+
return $productId;
|
38 |
}
|
39 |
|
40 |
+
public function saveConfig($key, $value, $scope = 'default', $scopeId = 0){
|
41 |
+
if(is_null($value) || is_array($value) || is_object($value)){
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
$path = self::CONFIG_PREFIX . '/' . $key;
|
45 |
+
Mage::getConfig()->saveConfig(rtrim($path, '/'), (string)$value, $scope, $scopeId);
|
46 |
+
// Mage::getSingleton('expertrec_recommendation/log')->log( "Successfully updated : <".$key."> in core_config_data table.");
|
47 |
return $this;
|
48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
public function getConfig($key){
|
51 |
+
$path = self::CONFIG_PREFIX . '/' . $key;
|
52 |
+
return Mage::getStoreConfig($path);
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
+
public function clearCache($type='config'){
|
56 |
+
Mage::app()->getCacheInstance()->cleanType($type);
|
57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
public function sendCurl($command){
|
60 |
+
if (isset($ch)) {
|
61 |
+
unset($ch);
|
62 |
+
}
|
63 |
+
if (function_exists('curl_setopt')) {
|
64 |
+
$ch = curl_init();
|
65 |
+
curl_setopt($ch, CURLOPT_URL, $command);
|
66 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
67 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
68 |
+
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
|
69 |
+
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
|
70 |
+
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 65000);
|
71 |
+
$str = curl_exec($ch);
|
72 |
+
$curl_errno = curl_errno($ch);
|
73 |
+
$curl_error = curl_error($ch);
|
74 |
+
curl_close($ch);
|
75 |
+
if ($curl_errno > 0){
|
76 |
+
Mage::getSingleton("expertrec_recommendation/log")->log("cURL Error ($curl_errno): ".$curl_error);
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
// Mage::getSingleton("expertrec_recommendation/log")->log("Data received:");
|
80 |
+
}
|
81 |
}
|
82 |
+
else {
|
83 |
+
$str = 'failed';
|
84 |
+
}
|
85 |
+
return $str;
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
+
public function getPages($curPage,$count,$displayPages=5,$itemPerPage=20){
|
89 |
+
$totalPages = ceil($count / $itemPerPage);
|
90 |
+
$pages = array();
|
91 |
+
if ($totalPages <= $displayPages) {
|
92 |
+
$pages = range(1, $totalPages);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
+
else{
|
95 |
+
$half = ceil($displayPages / 2);
|
96 |
+
if($curPage >= $half && $curPage <= $totalPages - $half){
|
97 |
+
$start = ($curPage - $half) + 1;
|
98 |
+
$finish = ($start + $displayPages) - 1;
|
99 |
+
}elseif ($curPage < $half) {
|
100 |
+
$start = 1;
|
101 |
+
$finish = $displayPages;
|
102 |
+
}elseif ($curPage > ($totalPages - $half)) {
|
103 |
+
$finish = $totalPages;
|
104 |
+
$start = $finish - $displayPages + 1;
|
105 |
+
}
|
106 |
+
$pages = range($start, $finish);
|
107 |
+
}
|
108 |
+
return $pages;
|
109 |
}
|
|
|
|
|
110 |
|
111 |
+
public function getAddToCartUrl($productId){
|
112 |
+
try{
|
113 |
+
$product=Mage::getModel('catalog/product')->load($productId);
|
114 |
+
return Mage::helper('checkout/cart')->getAddUrl($product);
|
115 |
+
}catch(Exception $e){
|
116 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting AddToCart Url: ".$e->getMessage());
|
117 |
+
}
|
118 |
+
return '';
|
119 |
}
|
|
|
|
|
120 |
|
121 |
+
public function getWishlistUrl($productId){
|
122 |
+
try{
|
123 |
+
$product=Mage::getModel('catalog/product')->load($productId);
|
124 |
+
return Mage::helper('wishlist')->getAddUrl($product);
|
125 |
+
}catch(Exception $e){
|
126 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Wishlist Url: ".$e->getMessage());
|
127 |
+
}
|
128 |
+
return '';
|
129 |
}
|
|
|
|
|
|
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
+
public function getProductCompareUrl($productId){
|
133 |
+
try{
|
|
|
134 |
$product=Mage::getModel('catalog/product')->load($productId);
|
135 |
+
return Mage::helper('catalog/product_compare')->getAddUrl($product);
|
136 |
+
}catch(Exception $e){
|
137 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Product-Compare Url: ".$e->getMessage());
|
138 |
}
|
139 |
+
return '';
|
140 |
+
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
|
|
|
|
142 |
|
143 |
+
public function getFormatCurrency($price=0,$productId=0,$fetchPrice=false){
|
144 |
+
try{
|
145 |
+
if($fetchPrice){
|
146 |
+
$product=Mage::getModel('catalog/product')->load($productId);
|
147 |
+
if($product){
|
148 |
+
$price = $product->fetchPrice();
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if(empty($price)){
|
152 |
+
return $price;
|
153 |
+
}
|
154 |
+
$formattedPrice = Mage::helper('core')->currency((int)$price, true, true);
|
155 |
+
return $formattedPrice;
|
156 |
+
}catch(Exception $e){
|
157 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting FormattedPrice: ".$e->getMessage());
|
158 |
}
|
159 |
+
return '';
|
|
|
|
|
160 |
}
|
|
|
|
|
161 |
|
162 |
+
public function getFormatPrice($price){
|
163 |
+
try{
|
164 |
+
if(empty($price)){
|
165 |
+
return $price;
|
166 |
+
}
|
167 |
+
return Mage::helper('core')->formatPrice($price,false);
|
168 |
+
}catch(Exception $e){
|
169 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Format Price: ".$e->getMessage());
|
170 |
+
}
|
171 |
+
return '';
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
public function getProductDescription($productId){
|
175 |
+
try{
|
176 |
+
$product=Mage::getModel('catalog/product')->load($productId);
|
177 |
+
return $product->getDescription();
|
178 |
+
}catch(Exception $e){
|
179 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting Product Description: ".$e->getMessage());
|
180 |
+
}
|
181 |
+
return '';
|
182 |
+
}
|
183 |
|
184 |
+
/*
|
185 |
+
* Fetching number of products per store, per website
|
186 |
+
*/
|
187 |
+
public function getProductCount($wid,$sid) {
|
188 |
+
$productcount = 0;
|
189 |
+
$collection = Mage::getResourceModel('catalog/product_collection');
|
190 |
+
$collection->addStoreFilter($sid);
|
191 |
+
$collection->addWebsiteFilter($wid);
|
192 |
+
// Retrieve product count in collection
|
193 |
+
$productcount = $collection->getSize();
|
194 |
+
return $productcount;
|
195 |
+
}
|
196 |
|
197 |
+
public function pushFeed($filepath){
|
198 |
+
try{
|
199 |
+
$logger = Mage::getSingleton('expertrec_recommendation/log');
|
200 |
+
$url = Mage::getStoreConfig(self::FEED_UPLOAD_ENDPOINT);
|
201 |
+
if(empty($url)){
|
202 |
+
$logger->log("Upload endpoint is not configured");
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
$filename = end(explode("/", $filepath));
|
206 |
+
$file = new CurlFile($filepath,'',$filename);
|
207 |
+
$fields = array('file'=>$file);
|
208 |
+
$ch = curl_init();
|
209 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
210 |
+
curl_setopt($ch, CURLOPT_POST,true);
|
211 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
|
212 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
213 |
+
$logger->log('Pushing the feed to '.$url);
|
214 |
+
// push the feed to the server
|
215 |
+
$response = curl_exec($ch);
|
216 |
+
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
217 |
+
$logger->log("Response from the server: ".json_encode($response));
|
218 |
+
if($status != 200) {
|
219 |
+
throw new Exception('Unexpected response from server');
|
220 |
+
}
|
221 |
+
$logger->log("File Successfully uploaded to the server.");
|
222 |
+
Mage::helper('expertrec_recommendation/filehelper')->deleteFile($filepath);
|
223 |
+
}catch(Exception $ex){
|
224 |
+
$logger->log("Error while uploading the feed because of " . $ex->getMessage());
|
225 |
return false;
|
226 |
}
|
227 |
+
curl_close($ch);
|
228 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
+
}
|
231 |
+
?>
|
|
|
|
|
|
|
|
|
|
app/code/community/Expertrec/Recommendation/Helper/Filehelper.php
CHANGED
@@ -1,88 +1,77 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Helper_Filehelper extends Mage_Core_Helper_Abstract{
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
$filePath = $file->getRealPath();
|
26 |
-
$relativePath = substr($filePath, strlen($rootPath) + 1);
|
27 |
-
|
28 |
-
// Add current file to archive
|
29 |
-
$zip->addFile($filePath, $relativePath);
|
30 |
}
|
|
|
|
|
|
|
31 |
}
|
32 |
-
|
33 |
-
|
34 |
-
$zip->close();
|
35 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Feed compression done");
|
36 |
}
|
37 |
-
|
38 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error: feed compression error: ".$e->getMessage());
|
39 |
}
|
40 |
-
return $this;
|
41 |
-
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
55 |
}
|
56 |
-
return $this;
|
57 |
-
}
|
58 |
-
|
59 |
-
public function deleteFile($file){
|
60 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Deleting file: ".$file);
|
61 |
-
unlink($file);
|
62 |
-
return $this;
|
63 |
-
}
|
64 |
-
|
65 |
-
public function cleanDir($path) {
|
66 |
-
try{
|
67 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Deleting feed directory: ".$path);
|
68 |
-
if (is_dir($path) === true){
|
69 |
-
$files = array_diff(scandir($path), array('.', '..'));
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Deleted file: ".$file);
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
81 |
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
-
return $this;
|
86 |
}
|
87 |
-
|
88 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Helper_Filehelper extends Mage_Core_Helper_Abstract{
|
4 |
|
5 |
+
public function createFeedZipFile($rootPath,$zipFileName) {
|
6 |
+
// Mage::getSingleton('expertrec_recommendation/log')->log("Feed compression initiated");
|
7 |
+
if(!is_dir($rootPath)){
|
8 |
+
return $this;
|
9 |
+
}
|
10 |
+
try{
|
11 |
+
// Create recursive directory iterator
|
12 |
+
$files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY);
|
13 |
+
if(count($files)){
|
14 |
+
$zip = new ZipArchive();
|
15 |
+
$zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
16 |
+
foreach ($files as $name => $file){
|
17 |
+
// Skip directories (they would be added automatically)
|
18 |
+
if (!$file->isDir()){
|
19 |
+
// Get real and relative path for current file
|
20 |
+
$filePath = $file->getRealPath();
|
21 |
+
$relativePath = substr($filePath, strlen($rootPath) + 1);
|
22 |
+
// Add current file to archive
|
23 |
+
$zip->addFile($filePath, $relativePath);
|
24 |
+
}
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
+
// Zip archive will be created only after closing object
|
27 |
+
$zip->close();
|
28 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Feed compression done");
|
29 |
}
|
30 |
+
}catch(Exception $e){
|
31 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error: feed compression error: ".$e->getMessage());
|
|
|
|
|
32 |
}
|
33 |
+
return $this;
|
|
|
34 |
}
|
|
|
|
|
35 |
|
36 |
+
public function createZipFile($path,$fileName,$zipFileName){
|
37 |
+
Mage::getSingleton('expertrec_recommendation/log')->log($zipFileName." compression initiated");
|
38 |
+
try{
|
39 |
+
$zip = new ZipArchive();
|
40 |
+
if ( $zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
|
41 |
+
$zip->addFile($path.'/'.$fileName, $fileName);
|
42 |
+
$zip->close();
|
43 |
+
Mage::getSingleton('expertrec_recommendation/log')->log($zipFileName." compression done");
|
44 |
+
}
|
45 |
+
}catch(Exception $e){
|
46 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error: Create Zip file error: ".$e->getMessage());
|
47 |
+
}
|
48 |
+
return $this;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
public function deleteFile($file){
|
52 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Deleting file: ".$file);
|
53 |
+
unlink($file);
|
54 |
+
return $this;
|
55 |
+
}
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
public function cleanDir($path) {
|
58 |
+
try{
|
59 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Deleting feed directory: ".$path);
|
60 |
+
if (is_dir($path) === true){
|
61 |
+
$files = array_diff(scandir($path), array('.', '..'));
|
62 |
+
foreach ($files as $file){
|
63 |
+
if (is_dir($file) === true ) {
|
64 |
+
self::deleteDir(realpath($path) . '/' . $file);
|
65 |
+
}else {
|
66 |
+
unlink(realpath($path) . '/' . $file);
|
67 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Deleted file: ".$file);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}catch(Exception $e){
|
72 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error: deleting dir error: ".$e->getMessage());
|
73 |
+
}
|
74 |
+
return $this;
|
75 |
}
|
|
|
76 |
}
|
77 |
+
?>
|
|
app/code/community/Expertrec/Recommendation/Helper/Search/Layout.php
CHANGED
@@ -1,514 +1,447 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abstract{
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
-
return $this;
|
39 |
-
}
|
40 |
-
|
41 |
-
public function getIsAjax(){
|
42 |
-
return $this->_isAjax;
|
43 |
-
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
$finalUrl = rtrim(Mage::helper('core/url')->removeRequestParam($url, $paramKey, false),'&');
|
48 |
-
return $finalUrl;
|
49 |
-
}
|
50 |
-
|
51 |
-
protected function getToolbarDiv(){
|
52 |
-
|
53 |
-
$result = '<div class="toolbar"><div class="sorter">';
|
54 |
-
$result .= '<p class="view-mode"><label>'.$this->__('View as').'</label>';
|
55 |
-
|
56 |
-
if($this->_confArray["mode"] == 'grid'){
|
57 |
-
$result .= '<strong title="Grid" class="grid">Grid</strong><a href="'.$this->removeRequestParam("mode").'&mode=list" title="List" class="list">List</a>';
|
58 |
-
}else{
|
59 |
-
$result .= '<a href= "'.$this->removeRequestParam("mode").'&mode=grid" title="Grid" class="grid">Grid</a><strong title="List" class="list">List</strong>';
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
if(
|
70 |
-
$result .= '<
|
71 |
}else{
|
72 |
-
$result .= '<
|
73 |
}
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$totalNum = $this->_confArray["count"];
|
83 |
-
$totalPage = ceil($totalNum/$this->_itemsPerPage);
|
84 |
-
$previous = $this->_confArray["curPage"]-1;
|
85 |
-
$firstNum = $previous * $this->_itemsPerPage + 1;
|
86 |
-
$lastNum = min(($this->_confArray["curPage"] * $this->_itemsPerPage),$totalNum);
|
87 |
-
|
88 |
-
if($totalPage > 1){
|
89 |
-
$result .= '<p class="amount amount--has-pages">';
|
90 |
-
$result .= $this->__('Showing %s - %s of %s', $firstNum, $lastNum, $totalNum);
|
91 |
-
}else{
|
92 |
-
$result .= '<p class="amount amount--no-pages">';
|
93 |
-
$result .= '<strong>'.$this->__('Showing %s Item(s)', $totalNum) .'</strong>';
|
94 |
-
}
|
95 |
-
$result .= '</p>';
|
96 |
-
$result .= '</div>';//close count-container
|
97 |
-
|
98 |
-
$result .= '<div class="pages"><strong>Page:</strong>';
|
99 |
-
$result .= '<ol>';
|
100 |
-
|
101 |
-
//pager
|
102 |
-
if($previous >= 1){
|
103 |
-
$result .= '<li><a class="previous i-previous" href="'.$this->removeRequestParam("p").'&p='.(string)$previous.'" title="Previous">Prev</a></li>';
|
104 |
-
}
|
105 |
-
|
106 |
-
$pages = Mage::helper('expertrec_recommendation')
|
107 |
-
->getPages($this->_confArray["curPage"],$totalNum,$this->_displayPages,$this->_itemsPerPage);
|
108 |
-
if(count($pages) > 1){
|
109 |
-
foreach ($pages as $page){
|
110 |
-
if($page == $this->_confArray["curPage"]){
|
111 |
-
$result .= '<li class="current">'.(string)($this->_confArray["curPage"]).'</li>';
|
112 |
}else{
|
113 |
-
$result .= '<
|
114 |
}
|
115 |
}
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
$
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
return $result;
|
129 |
-
}
|
130 |
-
|
131 |
-
protected function getGridProductsDiv($data){
|
132 |
-
$confArray = $this->_confArray;
|
133 |
-
|
134 |
-
$result = '<ul class="products-grid products-grid--max-3-col">';
|
135 |
-
|
136 |
-
foreach ($data as $item) {
|
137 |
-
if(!isset($item["entity_id"]) && !isset($item["title"]) && !isset($item["url"]) && !isset($item["image_url"])){
|
138 |
-
continue;
|
139 |
-
}
|
140 |
-
$msrp = "";
|
141 |
-
$price = "";
|
142 |
-
$compareUrl = Mage::helper('expertrec_recommendation')->getProductCompareUrl($item['entity_id']);
|
143 |
-
$wishlistUrl = Mage::helper('expertrec_recommendation')->getWishlistUrl($item['entity_id']);
|
144 |
-
$cartUrl = Mage::helper('expertrec_recommendation')->getAddToCartUrl($item['entity_id']);
|
145 |
-
|
146 |
-
if(!empty($item["msrp"]) && $item["msrp"] != "None" && $item["msrp"] != "0"){
|
147 |
-
$msrp =$item['msrp'];
|
148 |
-
}
|
149 |
-
if(!empty($item["price"]) && $item["price"] != "None" && $item["price"] != "0"){
|
150 |
-
$price = $item['price'];
|
151 |
-
}
|
152 |
-
|
153 |
-
if($this->_convertPrice){
|
154 |
-
$price = Mage::helper('expertrec_recommendation')->getFormatCurrency($price,$item['entity_id'],$this->_fetchPrice);
|
155 |
-
$msrp = Mage::helper('expertrec_recommendation')->getFormatCurrency($msrp,$item['entity_id'],$this->_fetchPrice);
|
156 |
}else{
|
157 |
-
$
|
158 |
-
$
|
159 |
}
|
160 |
-
|
161 |
-
$result .= '
|
162 |
-
$result .= '<
|
163 |
-
$result .= '<
|
164 |
-
|
165 |
-
$
|
166 |
-
|
167 |
-
$result .= '</h2>';
|
168 |
-
$result .= '<div class="price-box">';
|
169 |
-
if(!empty($msrp)){
|
170 |
-
$result .= '<p class="old-price">';
|
171 |
-
$result .= '<span class="price-label">Regular Price:</span>';
|
172 |
-
$result .= '<span class="price" id="old-price-'.$item['entity_id'].'">'.$msrp.'</span>';
|
173 |
-
$result .= '</p>';
|
174 |
-
|
175 |
-
$result .= '<p class="special-price">';
|
176 |
-
$result .= '<span class="price-label">Special Price</span>';
|
177 |
-
$result .= '<span class="price" id="product-price-'.$item['entity_id'].'">'.$price.'</span>';
|
178 |
-
$result .= '</p>';
|
179 |
-
}else{
|
180 |
-
$result .= '<span class="regular-price" id="product-price-'.$item['entity_id'].'"><span class="price">'.$price.'</span></span>';
|
181 |
-
}
|
182 |
-
$result .= '</div>';
|
183 |
-
$result .= '<div class="actions">';
|
184 |
-
|
185 |
-
if(!empty($cartUrl)){
|
186 |
-
$result .= '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\''.$cartUrl.'\')">';
|
187 |
-
$result .= '<span><span>Add to Cart</span></span>';
|
188 |
-
$result .= '</button>';
|
189 |
}
|
190 |
-
$
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
-
|
196 |
-
|
197 |
-
$result .= '<a href="'.$
|
198 |
-
$result .= '</li>';
|
199 |
}
|
200 |
-
$result .= '</
|
201 |
-
$result .= '</div>'
|
202 |
-
$result .= '</div>'
|
203 |
-
$result .= '</
|
204 |
-
|
205 |
}
|
206 |
-
$result .= '</ul>';
|
207 |
-
|
208 |
-
return $result;
|
209 |
-
}
|
210 |
-
|
211 |
-
protected function getListProductsDiv($data){
|
212 |
-
$confArray = $this->_confArray;
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
$
|
230 |
-
|
231 |
-
|
232 |
-
$
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
$
|
240 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
|
|
|
|
|
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
$
|
246 |
-
|
247 |
-
$
|
248 |
-
$
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$
|
262 |
-
|
263 |
-
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
$result .= '</p>';
|
270 |
-
|
271 |
-
$
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
$result .= '
|
280 |
-
$result .= '
|
281 |
-
$result .= '
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
if(!empty($wishlistUrl)){
|
288 |
-
$result .= '<li><a href="'.$wishlistUrl.'" class="link-wishlist"> <i class="fa fa-heart" aria-hidden="true"></i> Wishlist</a></li>';
|
289 |
-
}
|
290 |
-
if(!empty($compareUrl)){
|
291 |
-
$result .= '<li><span class="separator">|</span>';
|
292 |
-
$result .= '<a href="'.$compareUrl.'" class="link-compare"> <i class="fa fa-balance-scale" aria-hidden="true"></i> Compare</a>';
|
293 |
$result .= '</li>';
|
|
|
294 |
}
|
295 |
-
$result .= '</
|
296 |
-
$result
|
297 |
-
$result .= '<div class="desc std">'.$description;
|
298 |
-
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="link-learn">Learn More</a>';
|
299 |
-
$result .= '</div>'; //desc
|
300 |
-
$result .= '</div>'; // f-fix
|
301 |
-
$result .= '</div>'; //product-shop
|
302 |
-
$result .= '</li>';
|
303 |
-
|
304 |
-
$index = $index + 1;
|
305 |
}
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
if(!in_array($label, $att)){
|
326 |
-
$att[] = $label;
|
327 |
}
|
328 |
-
$url
|
329 |
-
}else{
|
330 |
-
$url .= "&".str_replace(" ","_",$fhead).'='.$label;
|
331 |
}
|
332 |
-
return $url;
|
333 |
-
}
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
$class .= '-selected';
|
351 |
}
|
|
|
352 |
}
|
353 |
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
$linkUrl = $baseUrl.'&'.str_replace(' ', '_', $fKey)."=".implode('%2C', $flist);
|
365 |
-
return $linkUrl;
|
366 |
-
}
|
367 |
-
|
368 |
-
protected function getNavigationState(){
|
369 |
-
$result = '';
|
370 |
-
$confArray = $this->_confArray;
|
371 |
-
|
372 |
-
try{
|
373 |
-
if(!empty($confArray["filters"])){
|
374 |
-
$filters = $confArray["filters"];
|
375 |
-
$result .= '<div class="currently">';
|
376 |
-
$result .= '<p class="block-subtitle">'.$this->__('Currently Shopping by:').'</p>';
|
377 |
-
$result .= '<ol>';
|
378 |
-
foreach ($filters as $fKey => $fValue){
|
379 |
-
$result .= '<li>';
|
380 |
-
$result .= '<span class="label">'.$this->__(str_replace('_', ' ', $fKey)).':</span>';
|
381 |
-
$listSubFilter = preg_split('/(%2C|,)/', $fValue);
|
382 |
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
$remainSubFilterList = array_diff($listSubFilter, array($sfKey));
|
389 |
-
|
390 |
$result .= '<span class="multivalue">'.str_replace('+', ' ', $sfKey).'</span>';
|
391 |
$result .= '<a class="btn-remove-inline" href="'.$this->getClearLinkUrl($fKey,$remainSubFilterList).'" title="'.$this->__('Remove This Item').'">';
|
392 |
$result .= '<i class="fa fa-times-circle" aria-hidden="true"></i>';
|
393 |
$result .= '</a>';
|
394 |
$result .= '</span>';
|
|
|
395 |
}
|
|
|
396 |
}
|
397 |
-
|
398 |
-
$result .= '</
|
|
|
|
|
|
|
399 |
}
|
400 |
-
|
401 |
-
|
402 |
-
$result .= '<div class="actions">';
|
403 |
-
$result .= '<a href="'.strtok($confArray["url"], '?').'?q='.$confArray["query"].'">'.$this->__('Clear All').'</a>';
|
404 |
-
$result .= '</div>';
|
405 |
}
|
406 |
-
|
407 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting navigation state: ".$e->getMessage());
|
408 |
}
|
409 |
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
$result .= '
|
446 |
-
|
447 |
-
|
448 |
-
$result .= '
|
449 |
-
$result .= '<i class="fa fa-check-square-o" aria-hidden="true"></i>';
|
450 |
}
|
451 |
-
$result .= '
|
452 |
-
|
453 |
-
$result .= ' <span class="count">('.$facetCount.')</span>';
|
454 |
-
$result .= '</a>';
|
455 |
-
$result .= '</li>';
|
456 |
}
|
457 |
-
|
458 |
-
$result .= '</ol>';
|
459 |
-
$result .= '</dd>';
|
460 |
}
|
461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
}
|
463 |
-
|
464 |
-
$result .= '</dl>';
|
465 |
-
$result .= '<script type="text/javascript">decorateDataList(\'narrow-by-list\')</script>';
|
466 |
-
$result .= '<div class="mobile-only mobile-filter-closer" onclick="erCloseFilter()"> <i class="fa fa-times" aria-hidden="true"></i> Close Filter </div>';
|
467 |
-
|
468 |
-
$result .= '</div>'; // block-content close
|
469 |
-
$result .= '</div>'; // block-layered-nav close
|
470 |
-
$result .= '</div>'; // er_Filteroption close
|
471 |
-
|
472 |
-
return $result;
|
473 |
-
}
|
474 |
-
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
$finalResult .= '<
|
|
|
|
|
|
|
495 |
}else{
|
496 |
-
$
|
497 |
-
$finalResult .= '<
|
498 |
}
|
499 |
-
|
500 |
-
$finalResult .= '<div class="toolbar-bottom">';
|
501 |
-
$finalResult .= $toolbar;
|
502 |
-
$finalResult .= '</div>';
|
503 |
-
$finalResult .= '</div>';
|
504 |
-
}else{
|
505 |
-
$noResult = $this->__('Your search returns no results.');
|
506 |
-
$finalResult .= '<p class="note-msg">'.$noResult.'</p>';
|
507 |
}
|
508 |
-
|
509 |
-
return $finalResult;
|
510 |
-
|
511 |
}
|
512 |
-
}
|
513 |
-
|
514 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abstract{
|
4 |
+
|
5 |
+
const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
|
6 |
+
const SEARCH_IS_AJAX = 'search/is_ajax';
|
7 |
+
const SEARCH_DISPLAY_PAGES = 'search/display_pages';
|
8 |
+
const SEARCH_FETCH_PRICE = 'search/fetch_price';
|
9 |
+
const SEARCH_CONVERT_PRICE = 'search/convert_price';
|
10 |
+
|
11 |
+
protected $_itemsPerPage;
|
12 |
+
protected $_displayPages = 5;
|
13 |
+
protected $_isAjax = false;
|
14 |
+
protected $_confArray;
|
15 |
+
protected $_fetchPrice = false;
|
16 |
+
protected $_convertPrice = false;
|
17 |
+
protected $_singleSelectFilters = array();
|
18 |
+
|
19 |
+
public function init($confArray){
|
20 |
+
$this->_confArray = $confArray;
|
21 |
+
try{
|
22 |
+
$singleFilters = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_SINGLE_SELECT_FILTERS);
|
23 |
+
$isAjax = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_IS_AJAX);
|
24 |
+
$displayPages = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_DISPLAY_PAGES);
|
25 |
+
$fetchPrice = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_FETCH_PRICE);
|
26 |
+
$convertPrice = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_CONVERT_PRICE);
|
27 |
+
$this->_singleSelectFilters = isset($singleFilters) ? explode(',', $singleFilters) : $this->_singleSelectFilters;
|
28 |
+
$this->_isAjax = isset($isAjax) && $isAjax == 'true' ? true : false;
|
29 |
+
$this->_fetchPrice = isset($fetchPrice) && $fetchPrice == 'true' ? true : false;
|
30 |
+
$this->_convertPrice = isset($convertPrice) && $convertPrice == 'true' ? true : false;
|
31 |
+
$this->_displayPages = !empty($displayPages) ? (int)$displayPages : $this->_displayPages;
|
32 |
+
$this->_itemsPerPage = Mage::helper('expertrec_recommendation/autocompletehelper')->getItemsPerPage();
|
33 |
+
}catch (Exception $e) {
|
34 |
+
Mage::getSingleton('expertrec_recommendation/log')->log('Search Layout Helper::init exception: '.$e->getMessage());
|
35 |
+
}
|
36 |
+
return $this;
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
public function getIsAjax(){
|
40 |
+
return $this->_isAjax;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
+
protected function removeRequestParam($paramKey,$url=''){
|
44 |
+
$url = !empty($url) ? $url : $this->_confArray["url"];
|
45 |
+
$finalUrl = rtrim(Mage::helper('core/url')->removeRequestParam($url, $paramKey, false),'&');
|
46 |
+
return $finalUrl;
|
47 |
+
}
|
48 |
|
49 |
+
protected function getToolbarDiv(){
|
50 |
+
$result = '<div class="toolbar"><div class="sorter">';
|
51 |
+
$result .= '<p class="view-mode"><label>'.$this->__('View as').'</label>';
|
52 |
+
if($this->_confArray["mode"] == 'grid'){
|
53 |
+
$result .= '<strong title="Grid" class="grid">Grid</strong><a href="'.$this->removeRequestParam("mode").'&mode=list" title="List" class="list">List</a>';
|
54 |
}else{
|
55 |
+
$result .= '<a href= "'.$this->removeRequestParam("mode").'&mode=grid" title="Grid" class="grid">Grid</a><strong title="List" class="list">List</strong>';
|
56 |
}
|
57 |
+
$result .= '</p>';
|
58 |
+
$result .= '<div class="sort-by"><label>'.$this->__('Sort By').'</label>';
|
59 |
+
$result .= '<select onchange="setLocation(this.value)" title="'.$this->__('Sort By').'">';
|
60 |
+
// Sort by
|
61 |
+
$orderArray = array("relevance"=>"Relevance", 'popularity'=>"Popularity", "price+asc"=>"Price - Low to High", "price+desc"=>"Price - High to Low");
|
62 |
+
foreach ($orderArray as $oKey => $oValue) {
|
63 |
+
if(urlencode($this->_confArray["order"]) == $oKey){
|
64 |
+
$result .= '<option value="'.$this->removeRequestParam("order").'&order='.$oKey.'" selected="selected">'.$this->__($oValue).'</option>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}else{
|
66 |
+
$result .= '<option value="'.$this->removeRequestParam("order").'&order='.$oKey.'">'.$this->__($oValue).' </option>';
|
67 |
}
|
68 |
}
|
69 |
+
$result .= '</select>';
|
70 |
+
$result .= '</div></div>';// Close sorter
|
71 |
+
$result .= '<div class="pager">';
|
72 |
+
$result .= '<div class="count-container">';
|
73 |
+
$totalNum = $this->_confArray["count"];
|
74 |
+
$totalPage = ceil($totalNum/$this->_itemsPerPage);
|
75 |
+
$previous = $this->_confArray["curPage"]-1;
|
76 |
+
$firstNum = $previous * $this->_itemsPerPage + 1;
|
77 |
+
$lastNum = min(($this->_confArray["curPage"] * $this->_itemsPerPage),$totalNum);
|
78 |
+
if($totalPage > 1){
|
79 |
+
$result .= '<p class="amount amount--has-pages">';
|
80 |
+
$result .= $this->__('Showing %s - %s of %s', $firstNum, $lastNum, $totalNum);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}else{
|
82 |
+
$result .= '<p class="amount amount--no-pages">';
|
83 |
+
$result .= '<strong>'.$this->__('Showing %s Item(s)', $totalNum) .'</strong>';
|
84 |
}
|
85 |
+
$result .= '</p>';
|
86 |
+
$result .= '</div>';// Close count-container
|
87 |
+
$result .= '<div class="pages"><strong>Page:</strong>';
|
88 |
+
$result .= '<ol>';
|
89 |
+
// Pager
|
90 |
+
if($previous >= 1){
|
91 |
+
$result .= '<li><a class="previous i-previous" href="'.$this->removeRequestParam("p").'&p='.(string)$previous.'" title="Previous">Prev</a></li>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
+
$pages = Mage::helper('expertrec_recommendation')->getPages($this->_confArray["curPage"],$totalNum,$this->_displayPages,$this->_itemsPerPage);
|
94 |
+
if(count($pages) > 1){
|
95 |
+
foreach ($pages as $page){
|
96 |
+
if($page == $this->_confArray["curPage"]){
|
97 |
+
$result .= '<li class="current">'.(string)($this->_confArray["curPage"]).'</li>';
|
98 |
+
}else{
|
99 |
+
$result .= '<li><a href="'.$this->removeRequestParam("p").'&p='.(string)$page.'">'.(string)$page.'</a></li>';
|
100 |
+
}
|
101 |
+
}
|
102 |
}
|
103 |
+
$next = $this->_confArray["curPage"]+1;
|
104 |
+
if($next <= $totalPage){
|
105 |
+
$result .= '<li><a class="next i-next" href="'.$this->removeRequestParam("p").'&p='.(string)$next.'" title="Next">Next</a></li>';
|
|
|
106 |
}
|
107 |
+
$result .= '</ol>';
|
108 |
+
$result .= '</div>';//close pages
|
109 |
+
$result .= '</div>';//close pager
|
110 |
+
$result .= '</div>';//close toolbar
|
111 |
+
return $result;
|
112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
protected function getGridProductsDiv($data){
|
115 |
+
$confArray = $this->_confArray;
|
116 |
+
$result = '<ul class="products-grid products-grid--max-3-col">';
|
117 |
+
foreach ($data as $item) {
|
118 |
+
if(!isset($item["entity_id"]) && !isset($item["title"]) && !isset($item["url"]) && !isset($item["image_url"])){
|
119 |
+
continue;
|
120 |
+
}
|
121 |
+
$msrp = "";
|
122 |
+
$price = "";
|
123 |
+
$compareUrl = Mage::helper('expertrec_recommendation')->getProductCompareUrl($item['entity_id']);
|
124 |
+
$wishlistUrl = Mage::helper('expertrec_recommendation')->getWishlistUrl($item['entity_id']);
|
125 |
+
$cartUrl = Mage::helper('expertrec_recommendation')->getAddToCartUrl($item['entity_id']);
|
126 |
+
if(!empty($item["msrp"]) && $item["msrp"] != "None" && $item["msrp"] != "0"){
|
127 |
+
$msrp =$item['msrp'];
|
128 |
+
}
|
129 |
+
if(!empty($item["price"]) && $item["price"] != "None" && $item["price"] != "0"){
|
130 |
+
$price = $item['price'];
|
131 |
+
}
|
132 |
+
if($this->_convertPrice){
|
133 |
+
$price = Mage::helper('expertrec_recommendation')->getFormatCurrency($price,$item['entity_id'],$this->_fetchPrice);
|
134 |
+
$msrp = Mage::helper('expertrec_recommendation')->getFormatCurrency($msrp,$item['entity_id'],$this->_fetchPrice);
|
135 |
+
}else{
|
136 |
+
$price = Mage::helper('expertrec_recommendation')->getFormatPrice($price);
|
137 |
+
$msrp = Mage::helper('expertrec_recommendation')->getFormatPrice($msrp);
|
138 |
+
}
|
139 |
+
$result .= '<li class="item last">';
|
140 |
+
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="product-image">';
|
141 |
+
$result .= '<img id="product-collection-image-'.$item['entity_id'].'" src="'.$item['image_url'].'" alt="'.$item['title'].'">';
|
142 |
+
$result .= '</a>';
|
143 |
+
$result .= '<div class="product-info" style="padding-bottom: 75px; min-height: 133px;"><h2 class="product-name">';
|
144 |
+
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'">'.$item['title'].'</a>';
|
145 |
+
$result .= '</h2>';
|
146 |
+
$result .= '<div class="price-box">';
|
147 |
+
if(!empty($msrp)){
|
148 |
+
$result .= '<p class="old-price">';
|
149 |
+
$result .= '<span class="price-label">Regular Price:</span>';
|
150 |
+
$result .= '<span class="price" id="old-price-'.$item['entity_id'].'">'.$msrp.'</span>';
|
151 |
+
$result .= '</p>';
|
152 |
+
$result .= '<p class="special-price">';
|
153 |
+
$result .= '<span class="price-label">Special Price</span>';
|
154 |
+
$result .= '<span class="price" id="product-price-'.$item['entity_id'].'">'.$price.'</span>';
|
155 |
+
$result .= '</p>';
|
156 |
+
}else{
|
157 |
+
$result .= '<span class="regular-price" id="product-price-'.$item['entity_id'].'"><span class="price">'.$price.'</span></span>';
|
158 |
+
}
|
159 |
+
$result .= '</div>';
|
160 |
+
$result .= '<div class="actions">';
|
161 |
+
if(!empty($cartUrl)){
|
162 |
+
$result .= '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\''.$cartUrl.'\')">';
|
163 |
+
$result .= '<span><span>Add to Cart</span></span>';
|
164 |
+
$result .= '</button>';
|
165 |
+
}
|
166 |
+
$result .= '<ul class="add-to-links">';
|
167 |
+
if(!empty($wishlistUrl)){
|
168 |
+
$result .= '<li><a href="'.$wishlistUrl.'" class="link-wishlist"> <i class="fa fa-heart" aria-hidden="true"></i> Wishlist</a></li>';
|
169 |
+
}
|
170 |
+
if(!empty($compareUrl)){
|
171 |
+
$result .= '<li><span class="separator">|</span>';
|
172 |
+
$result .= '<a href="'.$compareUrl.'" class="link-compare"> <i class="fa fa-balance-scale" aria-hidden="true"></i> Compare</a>';
|
173 |
+
$result .= '</li>';
|
174 |
+
}
|
175 |
+
$result .= '</ul>'; //add to links
|
176 |
+
$result .= '</div>'; // actions div
|
177 |
+
$result .= '</div>'; //product-info div
|
178 |
+
$result .= '</li>';
|
179 |
}
|
180 |
+
$result .= '</ul>';
|
181 |
+
return $result;
|
182 |
+
}
|
183 |
|
184 |
+
protected function getListProductsDiv($data){
|
185 |
+
$confArray = $this->_confArray;
|
186 |
+
$result = '<ol class="products-list" id="products-list">';
|
187 |
+
$index = 1;
|
188 |
+
$data_size = count($data);
|
189 |
+
foreach ($data as $item) {
|
190 |
+
if(!isset($item["entity_id"]) && !isset($item["title"]) && !isset($item["url"]) && !isset($item["image_url"])){
|
191 |
+
continue;
|
192 |
+
}
|
193 |
+
$msrp = "";
|
194 |
+
$price = "";
|
195 |
+
$compareUrl = Mage::helper('expertrec_recommendation')->getProductCompareUrl($item['entity_id']);
|
196 |
+
$wishlistUrl = Mage::helper('expertrec_recommendation')->getWishlistUrl($item['entity_id']);
|
197 |
+
$cartUrl = Mage::helper('expertrec_recommendation')->getAddToCartUrl($item['entity_id']);
|
198 |
+
$description = isset($item['desc']) ? $item['desc'] : (Mage::helper('expertrec_recommendation')->getProductDescription($item['entity_id']));
|
199 |
+
if(!empty($item["msrp"]) && $item["msrp"] != "None" && $item["msrp"] != "0"){
|
200 |
+
$msrp =$item['msrp'];
|
201 |
+
}
|
202 |
+
if(!empty($item["price"]) && $item["price"] != "None" && $item["price"] != "0"){
|
203 |
+
$price = $item['price'];
|
204 |
+
}
|
205 |
+
if($this->_convertPrice){
|
206 |
+
$price = Mage::helper('expertrec_recommendation')->getFormatCurrency($price,$item['entity_id'],$this->_fetchPrice);
|
207 |
+
$msrp = Mage::helper('expertrec_recommendation')->getFormatCurrency($msrp,$item['entity_id'],$this->_fetchPrice);
|
208 |
+
}else{
|
209 |
+
$price = Mage::helper('expertrec_recommendation')->getFormatPrice($price);
|
210 |
+
$msrp = Mage::helper('expertrec_recommendation')->getFormatPrice($msrp);
|
211 |
+
}
|
212 |
+
$odd_even = $data_size == $index ? 'last ' : '';
|
213 |
+
$odd_even .= ($index % 2) == 0 ? 'even' : 'odd';
|
214 |
+
$result .= '<li class="item '.$odd_even.'">';
|
215 |
+
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="product-image">';
|
216 |
+
$result .= '<img id="product-collection-image-'.$item['entity_id'].'" src="'.$item['image_url'].'" alt="'.$item['title'].'">';
|
217 |
+
$result .= '</a>';
|
218 |
+
$result .= '<div class="product-shop">';
|
219 |
+
$result .= '<div class="f-fix">';
|
220 |
+
$result .= '<div class="product-primary">';
|
221 |
+
$result .= '<h2 class="product-name">';
|
222 |
+
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'">'.$item['title'].'</a>';
|
223 |
+
$result .= '</h2>';
|
224 |
+
$result .= '</div>'; //product-primary
|
225 |
+
$result .= '<div class="product-secondary">';
|
226 |
+
$result .= '<div class="price-box">';
|
227 |
+
if(!empty($msrp)){
|
228 |
+
$result .= '<p class="old-price">';
|
229 |
+
$result .= '<span class="price-label">Regular Price:</span>';
|
230 |
+
$result .= '<span class="price" id="old-price-'.$item['entity_id'].'">'.$msrp.'</span>';
|
231 |
+
$result .= '</p>';
|
232 |
+
|
233 |
+
$result .= '<p class="special-price">';
|
234 |
+
$result .= '<span class="price-label">Special Price</span>';
|
235 |
+
$result .= '<span class="price" id="product-price-'.$item['entity_id'].'">'.$price.'</span>';
|
236 |
+
$result .= '</p>';
|
237 |
+
}else{
|
238 |
+
$result .= '<span class="regular-price" id="product-price-'.$item['entity_id'].'"><span class="price">'.$price.'</span></span>';
|
239 |
+
}
|
240 |
+
$result .= '</div>'; //price-box
|
241 |
+
$result .= '</div>'; //product-secondary
|
242 |
+
$result .= '<div class="product-secondary">';
|
243 |
+
$result .= '<p class="action">';
|
244 |
+
if(!empty($cartUrl)){
|
245 |
+
$result .= '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\''.$cartUrl.'\')">';
|
246 |
+
$result .= '<span><span>Add to Cart</span></span>';
|
247 |
+
$result .= '</button>';
|
248 |
+
}
|
249 |
$result .= '</p>';
|
250 |
+
$result .= '<ul class="add-to-links">';
|
251 |
+
if(!empty($wishlistUrl)){
|
252 |
+
$result .= '<li><a href="'.$wishlistUrl.'" class="link-wishlist"> <i class="fa fa-heart" aria-hidden="true"></i> Wishlist</a></li>';
|
253 |
+
}
|
254 |
+
if(!empty($compareUrl)){
|
255 |
+
$result .= '<li><span class="separator">|</span>';
|
256 |
+
$result .= '<a href="'.$compareUrl.'" class="link-compare"> <i class="fa fa-balance-scale" aria-hidden="true"></i> Compare</a>';
|
257 |
+
$result .= '</li>';
|
258 |
+
}
|
259 |
+
$result .= '</ul>'; //add to links
|
260 |
+
$result .= '</div>'; //product-secondary
|
261 |
+
$result .= '<div class="desc std">'.$description;
|
262 |
+
$result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="link-learn">Learn More</a>';
|
263 |
+
$result .= '</div>'; //desc
|
264 |
+
$result .= '</div>'; // f-fix
|
265 |
+
$result .= '</div>'; //product-shop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
$result .= '</li>';
|
267 |
+
$index = $index + 1;
|
268 |
}
|
269 |
+
$result .= '</ol>';
|
270 |
+
return $result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
|
273 |
+
/*
|
274 |
+
* @param string facet-header
|
275 |
+
* @param string facet-label
|
276 |
+
* @return string url
|
277 |
+
*/
|
278 |
+
protected function getFacetUrl($fhead,$facetLabel){
|
279 |
+
$confArray = $this->_confArray;
|
280 |
+
$url = $this->removeRequestParam($fhead);
|
281 |
+
$filter = isset($confArray["filters"][$fhead]) ? $confArray["filters"][$fhead] : '';
|
282 |
+
$label = str_replace(" ","+",$facetLabel);
|
283 |
+
if(!in_array($fhead, $this->_singleSelectFilters) && !empty($filter)){
|
284 |
+
$att = preg_split('/(%2C|,)/', $filter);
|
285 |
+
if(!in_array($label, $att)){
|
286 |
+
$att[] = $label;
|
287 |
+
}
|
288 |
+
$url .= "&".str_replace(" ","_",$fhead).'='.implode('%2C', $att);
|
289 |
+
}else{
|
290 |
+
$url .= "&".str_replace(" ","_",$fhead).'='.$label;
|
|
|
|
|
291 |
}
|
292 |
+
return $url;
|
|
|
|
|
293 |
}
|
|
|
|
|
294 |
|
295 |
+
/*
|
296 |
+
* @param string facet-header
|
297 |
+
* @param string facet-label
|
298 |
+
* @return string class
|
299 |
+
*/
|
300 |
+
protected function getFacetClass($fhead,$facetLabel){
|
301 |
+
$confArray = $this->_confArray;
|
302 |
+
$class = $fhead == "category" ? "expertrec-filter-cat" : "expertrec-filter-attr";
|
303 |
+
$filter = isset($confArray["filters"][$fhead]) ? $confArray["filters"][$fhead] : '';
|
304 |
+
$label = str_replace(" ","+",$facetLabel);
|
305 |
+
if(!empty($filter)){
|
306 |
+
$att = preg_split('/(%2C|,)/', $filter);
|
307 |
+
if(in_array($label, $att)){
|
308 |
+
$class .= '-selected';
|
309 |
+
}
|
|
|
310 |
}
|
311 |
+
return $class;
|
312 |
}
|
313 |
|
314 |
+
/*
|
315 |
+
* @param filterkey string
|
316 |
+
* @param filterlist Array
|
317 |
+
* @return url
|
318 |
+
*/
|
319 |
+
protected function getClearLinkUrl($fKey,$flist){
|
320 |
+
$baseUrl = $this->removeRequestParam($fKey);
|
321 |
+
$linkUrl = $baseUrl.'&'.str_replace(' ', '_', $fKey)."=".implode('%2C', $flist);
|
322 |
+
return $linkUrl;
|
323 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
+
protected function getNavigationState(){
|
326 |
+
$result = '';
|
327 |
+
$confArray = $this->_confArray;
|
328 |
+
try{
|
329 |
+
if(!empty($confArray["filters"])){
|
330 |
+
$filters = $confArray["filters"];
|
331 |
+
$result .= '<div class="currently">';
|
332 |
+
$result .= '<p class="block-subtitle">'.$this->__('Currently Shopping by:').'</p>';
|
333 |
+
$result .= '<ol>';
|
334 |
+
foreach ($filters as $fKey => $fValue){
|
335 |
+
$result .= '<li>';
|
336 |
+
$result .= '<span class="label">'.$this->__(str_replace('_', ' ', $fKey)).':</span>';
|
337 |
+
$listSubFilter = preg_split('/(%2C|,)/', $fValue);
|
338 |
+
if(in_array($fKey, $this->_singleSelectFilters) || count($listSubFilter) == 1){
|
339 |
+
$result .= '<span class="value">'.str_replace('+', ' ', $listSubFilter[0]).'</span>';
|
340 |
+
$result .= '<a class="btn-remove" href="'.$this->removeRequestParam($fKey).'" title="'.$this->__('Remove This Item').'"><i class="fa fa-times" aria-hidden="true"></i></a>';
|
341 |
+
}else{
|
342 |
+
foreach ($listSubFilter as $sfKey) {
|
343 |
$remainSubFilterList = array_diff($listSubFilter, array($sfKey));
|
|
|
344 |
$result .= '<span class="multivalue">'.str_replace('+', ' ', $sfKey).'</span>';
|
345 |
$result .= '<a class="btn-remove-inline" href="'.$this->getClearLinkUrl($fKey,$remainSubFilterList).'" title="'.$this->__('Remove This Item').'">';
|
346 |
$result .= '<i class="fa fa-times-circle" aria-hidden="true"></i>';
|
347 |
$result .= '</a>';
|
348 |
$result .= '</span>';
|
349 |
+
}
|
350 |
}
|
351 |
+
$result .= '</li>';
|
352 |
}
|
353 |
+
$result .= '</ol>';
|
354 |
+
$result .= '</div>';
|
355 |
+
$result .= '<div class="actions">';
|
356 |
+
$result .= '<a href="'.strtok($confArray["url"], '?').'?q='.$confArray["query"].'">'.$this->__('Clear All').'</a>';
|
357 |
+
$result .= '</div>';
|
358 |
}
|
359 |
+
}catch(Exception $e){
|
360 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting navigation state: ".$e->getMessage());
|
|
|
|
|
|
|
361 |
}
|
362 |
+
return $result;
|
|
|
363 |
}
|
364 |
|
365 |
+
/*
|
366 |
+
* @param Array facetlist
|
367 |
+
* @return html string
|
368 |
+
*/
|
369 |
+
public function prepareFilterLayout($facets){
|
370 |
+
$result = '<div class="listing-filter">';
|
371 |
+
$result .= '<a href="javascript:;" onclick="erOpenFilter()">';
|
372 |
+
$result .= '<i class="fa fa-filter" aria-hidden="true"></i> Filter By </a>';
|
373 |
+
$result .= '</div>';
|
374 |
+
$result .= '<div id="er_Filteroption" class="overlay-filter">';
|
375 |
+
$result .= '<div class="block block-layered-nav expertrec-overflow-scroll-enabled">';
|
376 |
+
$result .= '<div class="block-title">';
|
377 |
+
$result .= '<strong><span>'.$this->__('Shop By').'</span></strong>';
|
378 |
+
$result .= '</div>';
|
379 |
+
$result .= '<div class="block-content toggle-content">';
|
380 |
+
$result .= '<div style="clear:both;"></div>';
|
381 |
+
$result .= '<p class="block-subtitle mobile-only"><i class="fa fa-filter" aria-hidden="true"></i> Filter By</p>';
|
382 |
+
$result .= '<dl id="narrow-by-list">';
|
383 |
+
foreach ($facets as $fKey => $fValue) {
|
384 |
+
if(count($fValue)){
|
385 |
+
$result .= '<dt>'.$fKey.'</dt>';
|
386 |
+
$result .= '<dd class="filter-search">';
|
387 |
+
$result .= '<ol>';
|
388 |
+
foreach ($fValue as $facetLabel => $facetCount) {
|
389 |
+
$result .= '<li class="'.$this->getFacetClass($fKey,$facetLabel).'">';
|
390 |
+
if($this->_isAjax){
|
391 |
+
$result .= '<a href="javascript:;">';
|
392 |
+
$result .= '<input class="ajaxUrl" type="hidden" value="'.$this->getFacetUrl($fKey,$facetLabel).'">';
|
393 |
+
}else{
|
394 |
+
$result .= '<a href="'.$this->getFacetUrl($fKey,$facetLabel).'">';
|
395 |
+
}
|
396 |
+
if(!in_array($fKey, $this->_singleSelectFilters)){
|
397 |
+
$result .= '<i class="fa fa-square-o" aria-hidden="true"></i>';
|
398 |
+
$result .= '<i class="fa fa-check-square-o" aria-hidden="true"></i>';
|
399 |
+
}
|
400 |
+
$result .= ' '.ucwords(strip_tags($facetLabel));
|
401 |
+
$result .= ' <span class="count">('.$facetCount.')</span>';
|
402 |
+
$result .= '</a>';
|
403 |
+
$result .= '</li>';
|
|
|
404 |
}
|
405 |
+
$result .= '</ol>';
|
406 |
+
$result .= '</dd>';
|
|
|
|
|
|
|
407 |
}
|
|
|
|
|
|
|
408 |
}
|
409 |
+
$result .= '</dl>';
|
410 |
+
$result .= '<script type="text/javascript">decorateDataList(\'narrow-by-list\')</script>';
|
411 |
+
$result .= '<div class="mobile-only mobile-filter-closer" onclick="erCloseFilter()"> <i class="fa fa-times" aria-hidden="true"></i> Close Filter </div>';
|
412 |
+
$result .= '</div>'; // block-content close
|
413 |
+
$result .= '</div>'; // block-layered-nav close
|
414 |
+
$result .= '</div>'; // er_Filteroption close
|
415 |
+
return $result;
|
416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
+
/*
|
419 |
+
* @param list of products
|
420 |
+
* @return html string
|
421 |
+
*/
|
422 |
+
public function prepareLayout($data){
|
423 |
+
$confArray = $this->_confArray;
|
424 |
+
$finalResult = $this->getNavigationState();
|
425 |
+
if(!empty($confArray["count"])){
|
426 |
+
$toolbar = $this->getToolbarDiv();
|
427 |
+
$finalResult .= '<div class="category-products">';
|
428 |
+
$finalResult .= $toolbar;
|
429 |
+
if($confArray["mode"] == 'grid'){
|
430 |
+
$finalResult .= $this->getGridProductsDiv($data);
|
431 |
+
$finalResult .= '<script type="text/javascript">decorateGeneric($$("ul.products-grid"), ["odd","even","first","last"])</script>';
|
432 |
+
}else{
|
433 |
+
$finalResult .= $this->getListProductsDiv($data);
|
434 |
+
$finalResult .= '<script type="text/javascript">decorateList("products-list", "none-recursive")</script>';
|
435 |
+
}
|
436 |
+
$finalResult .= '<div class="toolbar-bottom">';
|
437 |
+
$finalResult .= $toolbar;
|
438 |
+
$finalResult .= '</div>';
|
439 |
+
$finalResult .= '</div>';
|
440 |
}else{
|
441 |
+
$noResult = $this->__('Your search returns no results.');
|
442 |
+
$finalResult .= '<p class="note-msg">'.$noResult.'</p>';
|
443 |
}
|
444 |
+
return $finalResult;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
}
|
|
|
|
|
|
|
446 |
}
|
|
|
|
|
447 |
?>
|
app/code/community/Expertrec/Recommendation/Helper/Suggestionhelper.php
CHANGED
@@ -1,122 +1,100 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Helper_Suggestionhelper extends Mage_Core_Helper_Abstract{
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
$aRow = array();
|
52 |
-
foreach ($this->_ofields as $field) {
|
53 |
-
$fValue = $suggestion->getData($field);
|
54 |
-
if(empty($fValue)){
|
55 |
-
$fValue = 'None';
|
56 |
}
|
57 |
-
|
58 |
-
$aRow
|
59 |
}
|
60 |
-
|
61 |
-
//writing data row
|
62 |
-
$this->_oWriter->writeDataRow($aRow);
|
63 |
}
|
64 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
-
|
67 |
-
$this->closeWriters();
|
68 |
-
|
69 |
-
$logger->log("Finished ".$this->_fileName." data export for store #".$storeId);
|
70 |
-
$logger->logMemoryUsage();
|
71 |
-
|
72 |
-
return true;
|
73 |
-
|
74 |
-
} catch (Exception $e) {
|
75 |
-
$logger->log( "Exception during suggestion feed generation: ".$e->getMessage());
|
76 |
-
return false;
|
77 |
}
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
->setStoreId($storeId);
|
86 |
-
|
87 |
-
$collection->getSelect()->where('query_text != "__empty__"');
|
88 |
-
|
89 |
-
return $collection;
|
90 |
-
}
|
91 |
-
|
92 |
-
protected function initWriters(Mage_Core_Model_Store $oStore, $vFeedname) {
|
93 |
-
|
94 |
-
$oWriter = Mage::getModel('expertrec_recommendation/writer_csv')->init($oStore->getCode(), $vFeedname);
|
95 |
-
if ($oWriter instanceof Expertrec_Recommendation_Model_Writer_Abstract) {
|
96 |
-
$this->_oWriter = $oWriter;
|
97 |
}
|
98 |
-
|
99 |
-
return $this;
|
100 |
-
}
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
$this
|
108 |
-
|
109 |
-
}catch (Exception $e) {
|
110 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error in writing header: ".$e->getMessage());
|
111 |
-
return false;
|
112 |
}
|
113 |
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
}
|
121 |
-
|
122 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Helper_Suggestionhelper extends Mage_Core_Helper_Abstract{
|
4 |
+
|
5 |
+
protected $_fileName='expertrec_sugg_feed';
|
6 |
+
protected $_oWriter;
|
7 |
+
protected $_ofields;
|
8 |
+
|
9 |
+
public function exportPopularProducts() {
|
10 |
+
try {
|
11 |
+
$logger = Mage::getSingleton('expertrec_recommendation/log');
|
12 |
+
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
13 |
+
$storeId = $feedConfig->storeId;
|
14 |
+
//load Store by given store id
|
15 |
+
$oStore = Mage::getModel('core/store')->load($storeId);
|
16 |
+
if(!isset($oStore)){
|
17 |
+
$logger->log("Store id is not set");
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
// $logger->log("Beginning ".$this->_fileName." export for store #".$storeId);
|
21 |
+
$logger->logMemoryUsage();
|
22 |
+
// $logger->log("Initialising file writers...");
|
23 |
+
$this->initWriters($oStore, $this->_fileName);
|
24 |
+
// Prepare the csv file header
|
25 |
+
// $logger->log("Begin preparing header rows...");
|
26 |
+
//if any error occur during header writing, it will return false
|
27 |
+
if(!$this->prepareHeaders()){
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
$collection = $this->getSuggestionCollection($storeId)->setPageSize($feedConfig->pageSize);
|
31 |
+
$pageEnd = $feedConfig->pageEnd;
|
32 |
+
$lastPageNumber = $collection->getLastPageNumber();
|
33 |
+
if($pageEnd != 0 && $pageEnd < $lastPageNumber){
|
34 |
+
$pages = $pageEnd;
|
35 |
+
}else{
|
36 |
+
$pages = $lastPageNumber;
|
37 |
+
}
|
38 |
+
$logger->log("Total no. of pages for which we are collecting popular products feed in this reqeust: #".$pages);
|
39 |
+
for($currentPage = $feedConfig->pageStart; $currentPage <= $pages; $currentPage++) {
|
40 |
+
$logger->log("Collecting popular products feed for page: #".$currentPage);
|
41 |
+
$collection->setCurPage($currentPage);
|
42 |
+
foreach ($collection as $suggestion) {
|
43 |
+
$aRow = array();
|
44 |
+
foreach ($this->_ofields as $field) {
|
45 |
+
$fValue = $suggestion->getData($field);
|
46 |
+
if(empty($fValue)){
|
47 |
+
$fValue = 'None';
|
48 |
+
}
|
49 |
+
//$logger->log("key: ".$field." value: ".$fValue);
|
50 |
+
$aRow[$field] = $fValue;
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
+
//writing data row
|
53 |
+
$this->_oWriter->writeDataRow($aRow);
|
54 |
}
|
55 |
+
$collection->clear();
|
|
|
|
|
56 |
}
|
57 |
+
$this->closeWriters();
|
58 |
+
$logger->log("Finished ".$this->_fileName." data export for store #".$storeId);
|
59 |
+
$logger->logMemoryUsage();
|
60 |
+
return true;
|
61 |
+
}catch (Exception $e) {
|
62 |
+
$logger->log( "Exception during suggestion feed generation: ".$e->getMessage());
|
63 |
+
return false;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
+
protected function getSuggestionCollection($storeId){
|
68 |
+
$collection = Mage::getResourceModel('catalogsearch/query_collection')
|
69 |
+
->addStoreFilter($storeId)
|
70 |
+
->setStoreId($storeId);
|
71 |
+
$collection->getSelect()->where('query_text != "__empty__"');
|
72 |
+
return $collection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
|
|
|
|
|
|
74 |
|
75 |
+
protected function initWriters(Mage_Core_Model_Store $oStore, $vFeedname) {
|
76 |
+
$oWriter = Mage::getModel('expertrec_recommendation/writer_csv')->init($oStore->getCode(), $vFeedname);
|
77 |
+
if ($oWriter instanceof Expertrec_Recommendation_Model_Writer_Abstract) {
|
78 |
+
$this->_oWriter = $oWriter;
|
79 |
+
}
|
80 |
+
return $this;
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
+
protected function prepareHeaders() {
|
84 |
+
try{
|
85 |
+
$this->_ofields = array('query_id','query_text','num_results','popularity','redirect',' synonym_for','is_active','is_processed','updated_at');
|
86 |
+
//writing header row
|
87 |
+
$this->_oWriter->setHeader($this->_ofields)->writeHeaderRow();
|
88 |
+
}catch (Exception $e) {
|
89 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error in writing header: ".$e->getMessage());
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
return true;
|
93 |
+
}
|
94 |
|
95 |
+
protected function closeWriters() {
|
96 |
+
$this->_oWriter->close();
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
}
|
100 |
+
?>
|
|
app/code/community/Expertrec/Recommendation/Model/Api/Request.php
CHANGED
@@ -1,148 +1,117 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
* Class to make the request to the Expertrec api
|
5 |
-
*
|
6 |
-
* @category Expertrec
|
7 |
-
* @package Expertrec_Recommendation
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
class Expertrec_Recommendation_Model_Api_Request extends Varien_Object {
|
11 |
-
|
12 |
-
const LOG_URL = "https://log.expertrec.com/v2/collect/";
|
13 |
-
|
14 |
-
/**
|
15 |
-
* end url where the request is firing
|
16 |
-
*/
|
17 |
-
protected $url = "";
|
18 |
-
|
19 |
-
protected $userId = "";
|
20 |
-
|
21 |
-
protected $prepareRequestStatus=false;
|
22 |
-
|
23 |
/**
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
public function setUserId($uid){
|
51 |
-
$this->userId = $uid;
|
52 |
-
return $this;
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
public function setMethod($method) {
|
57 |
-
$this->method = $method;
|
58 |
-
return $this;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function setPrepareRequestStatus($status=false){
|
62 |
-
$this->prepareRequestStatus = $status;
|
63 |
-
return $this;
|
64 |
-
}
|
65 |
-
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Prepare Url and User_id before sending request
|
69 |
-
*/
|
70 |
-
|
71 |
-
public function prepareRequest(){
|
72 |
-
$uid = array_key_exists('ci_id', $_COOKIE) ? $_COOKIE['ci_id'] : 'Not_Found';
|
73 |
-
|
74 |
-
$mid = Mage::getModel('expertrec_recommendation/validate')->getSiteKey();
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
$this->setPrepareRequestStatus(false);
|
79 |
return $this;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
|
|
|
|
|
|
|
84 |
|
85 |
-
$
|
86 |
-
|
87 |
-
|
|
|
88 |
|
89 |
-
|
90 |
-
|
|
|
|
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
99 |
->setHeaders($this->headers)
|
100 |
->setMethod($this->method)
|
101 |
->setParameterGet("user",$this->userId)
|
102 |
->setConfig(array('timeout' => 1));
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
108 |
}
|
109 |
-
return $request;
|
110 |
-
}
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
$status
|
133 |
-
|
134 |
-
|
135 |
-
Mage::getSingleton('expertrec_recommendation/log')->log(sprintf($this->url ." failed because HTTP error: %s", $e->getMessage()),Zend_Log::ERR);
|
136 |
return false;
|
137 |
}
|
138 |
-
|
139 |
-
if($status >= 200 && $status < 400){
|
140 |
-
return true;
|
141 |
-
}
|
142 |
-
return false;
|
143 |
}
|
144 |
-
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
?>
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
+
* Class to make the request to the Expertrec api
|
5 |
+
*
|
6 |
+
* @category Expertrec
|
7 |
+
* @package Expertrec_Recommendation
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class Expertrec_Recommendation_Model_Api_Request extends Varien_Object {
|
11 |
+
|
12 |
+
const LOG_URL = "https://log.expertrec.com/v2/collect/";
|
13 |
+
/**
|
14 |
+
* end url where the request is firing
|
15 |
+
*/
|
16 |
+
protected $url = "";
|
17 |
+
protected $userId = "";
|
18 |
+
protected $prepareRequestStatus=false;
|
19 |
+
/**
|
20 |
+
* http method
|
21 |
+
*/
|
22 |
+
protected $method = Zend_Http_Client::GET;
|
23 |
+
protected $headers = array();
|
24 |
+
|
25 |
+
public function setHeaders(array $headers) {
|
26 |
+
$this->headers = $headers;
|
27 |
+
return $this;
|
28 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
public function setHeader($header,$value) {
|
31 |
+
$this->headers[$header] = $value;
|
|
|
32 |
return $this;
|
33 |
}
|
34 |
|
35 |
+
public function setUrl($url) {
|
36 |
+
$this->url = $url;
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
|
40 |
+
public function setUserId($uid){
|
41 |
+
$this->userId = $uid;
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
|
45 |
+
public function setMethod($method) {
|
46 |
+
$this->method = $method;
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
|
50 |
+
public function setPrepareRequestStatus($status=false){
|
51 |
+
$this->prepareRequestStatus = $status;
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
|
55 |
+
/**
|
56 |
+
* Prepare Url and User_id before sending request
|
57 |
+
*/
|
58 |
+
public function prepareRequest(){
|
59 |
+
$uid = array_key_exists('ci_id', $_COOKIE) ? $_COOKIE['ci_id'] : 'Not_Found';
|
60 |
+
$mid = Mage::getModel('expertrec_recommendation/validate')->getSiteKey();
|
61 |
+
if (empty($mid)) {
|
62 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("merchant_id missing",Zend_Log::ERR);
|
63 |
+
$this->setPrepareRequestStatus(false);
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
$this->setUserId($uid);
|
67 |
+
$this->setUrl(self::LOG_URL.$mid);
|
68 |
+
$this->setPrepareRequestStatus(true);
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
|
72 |
+
/**
|
73 |
+
* @return Zend_Http_Client
|
74 |
+
*/
|
75 |
+
protected function getRestClient(){
|
76 |
+
$request = new Zend_Http_Client();
|
77 |
+
$request->setUri($this->url)
|
78 |
->setHeaders($this->headers)
|
79 |
->setMethod($this->method)
|
80 |
->setParameterGet("user",$this->userId)
|
81 |
->setConfig(array('timeout' => 1));
|
82 |
+
if($this->method == Zend_Http_Client::GET) {
|
83 |
+
$request->setParameterGet($this->getData());
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
$request->setParameterPost($this->getData());
|
87 |
+
}
|
88 |
+
return $request;
|
89 |
}
|
|
|
|
|
90 |
|
91 |
+
/**
|
92 |
+
* Method which will make the api call
|
93 |
+
*
|
94 |
+
* @return boolean
|
95 |
+
*/
|
96 |
+
public function sendRequest(){
|
97 |
+
$status = 0;
|
98 |
+
//if mid and uid are not set, it will not proceed
|
99 |
+
if(!$this->prepareRequestStatus){
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
try {
|
103 |
+
$request = $this->getRestClient();
|
104 |
+
$response = $request->request();
|
105 |
+
//set status code
|
106 |
+
$status = (int)$response->getStatus();
|
107 |
+
} catch (Zend_Http_Client_Exception $e) {
|
108 |
+
Mage::getSingleton('expertrec_recommendation/log')->log(sprintf($this->url ." failed because HTTP error: %s", $e->getMessage()),Zend_Log::ERR);
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
if($status >= 200 && $status < 400){
|
112 |
+
return true;
|
113 |
+
}
|
|
|
114 |
return false;
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
|
|
|
|
|
|
|
|
117 |
?>
|
app/code/community/Expertrec/Recommendation/Model/Feed.php
CHANGED
@@ -1,43 +1,36 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
class Expertrec_Recommendation_Model_Feed {
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$status
|
29 |
-
|
30 |
-
Mage::getSingleton('expertrec_recommendation/log')->log(
|
31 |
-
|
32 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Website id and Store id are not set",Zend_Log::ERR);
|
33 |
}
|
34 |
-
return $status;
|
35 |
-
|
36 |
-
} catch (Exception $e) {
|
37 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception during feed generation: ".$e->getMessage(),Zend_Log::ERR);
|
38 |
-
return false;
|
39 |
}
|
40 |
-
|
41 |
}
|
42 |
-
|
43 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Feed generator class
|
5 |
+
*
|
6 |
+
* @category Expertrec
|
7 |
+
* @package Expertrec_Recommendation
|
8 |
+
* @copyright Copyright (c) 2016 CloudInfra LLC.
|
9 |
+
*/
|
10 |
+
class Expertrec_Recommendation_Model_Feed {
|
11 |
+
protected $_feedName='expertrec_feed';
|
12 |
|
13 |
+
public function exportFeeds() {
|
14 |
+
try {
|
15 |
+
$status = false;
|
16 |
+
//load Website by given website id
|
17 |
+
$website = Mage::getModel('core/website')->load(Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->websiteId);
|
18 |
+
//load Store by given store id
|
19 |
+
$oStore = Mage::getModel('core/store')->load(Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->storeId);
|
20 |
+
if(isset($website) && isset($oStore)){
|
21 |
+
//Appending website name to feedName
|
22 |
+
$this->_feedName .= '_'.str_replace(" ", "", (string)$website->getName());
|
23 |
+
//Start feed creation process
|
24 |
+
$status = Mage::getSingleton('expertrec_recommendation/feed_feedcreator')->export($website,$oStore,$this->_feedName);
|
25 |
+
Mage::getSingleton('expertrec_recommendation/log')->log('Expertrec Datafeeder finished creating file');
|
26 |
+
}else{
|
27 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Website id and Store id are not set",Zend_Log::ERR);
|
28 |
+
}
|
29 |
+
return $status;
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception during feed generation: ".$e->getMessage(),Zend_Log::ERR);
|
32 |
+
return false;
|
|
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
|
|
35 |
}
|
36 |
+
?>
|
|
app/code/community/Expertrec/Recommendation/Model/Feed/Feedconfig.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Model_Feed_Feedconfig {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Model_Feed_Feedconfig {
|
4 |
|
5 |
+
var $pageSize=50;
|
6 |
+
var $imageWidth = 250;
|
7 |
+
var $imageHeight = 250;
|
8 |
+
var $generateImage=false;
|
9 |
+
var $websiteId=0;
|
10 |
+
var $storeId=0;
|
11 |
+
var $feedFilePath='';
|
12 |
+
var $pageStart=1;
|
13 |
+
var $pageEnd =0;
|
14 |
|
15 |
+
protected $secret;
|
16 |
+
protected $merchant_id;
|
17 |
|
18 |
+
public function setImageHeight($height=250) {
|
19 |
+
$this->imageHeight = (int)$height;
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
|
23 |
+
public function setImageWidth($wid=250) {
|
24 |
+
$this->imageWidth = (int)$wid;
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
|
28 |
+
public function setGenerateImage($img=true){
|
29 |
+
$this->generateImage = $img;
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
|
33 |
+
public function setWebsiteId($wid=0){
|
34 |
+
$this->websiteId = (int)$wid;
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
|
38 |
+
public function setStoreId($sid=0){
|
39 |
+
$this->storeId = (int)$sid;
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
|
43 |
+
public function setFeedFilePath($path=''){
|
44 |
+
$this->feedFilePath=$path;
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
|
48 |
+
public function setSecret($pwd=null){
|
49 |
+
$this->secret = $pwd;
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
|
53 |
+
public function getSecret(){
|
54 |
+
return $this->secret;
|
55 |
+
}
|
56 |
|
57 |
+
public function setMerchantId($mid=''){
|
58 |
+
$this->merchant_id = (string)$mid;
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
|
62 |
+
public function getMerchantId(){
|
63 |
+
return $this->merchant_id;
|
64 |
+
}
|
65 |
|
66 |
+
public function setPageStart($st=1){
|
67 |
+
$this->pageStart = (int)$st;
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
|
71 |
+
public function setPageEnd($en=0){
|
72 |
+
$this->pageEnd = (int)$en;
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
public function setPageSize($size=50) {
|
76 |
+
$this->pageSize = (int)$size;
|
77 |
+
return $this;
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Expertrec/Recommendation/Model/Feed/Feedcreator.php
CHANGED
@@ -1,162 +1,126 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
class Expertrec_Recommendation_Model_Feed_Feedcreator {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$logger->logMemoryUsage();
|
44 |
-
|
45 |
-
//get product collection
|
46 |
-
$logger->log("Getting product collection for store#".$oStore->getId()." - ".$oStore->getName());
|
47 |
-
|
48 |
-
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
49 |
-
|
50 |
-
$collection=Mage::getSingleton('expertrec_recommendation/feed_feedfilter')->addBasicFilter($website,$oStore)
|
51 |
->setPageSize($feedConfig->pageSize);
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$pages
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$logger->log("Collecting feed for page: #".$currentPage);
|
65 |
-
$collection->setCurPage($currentPage);
|
66 |
-
foreach ($collection as $product) {
|
67 |
-
try{
|
68 |
-
|
69 |
$aRow = $formatter->prepareRow($this->_ofields,$product);
|
70 |
-
|
71 |
//writing data row
|
72 |
$this->_oWriter->writeDataRow($aRow);
|
73 |
}
|
74 |
-
|
75 |
-
$logger->log("Error in feed creation for page:--".$e->getMessage());
|
76 |
-
$logger->log('callstack on error in feed creation per page : '.mageDebugBacktrace(true, true, true));
|
77 |
-
// continue;
|
78 |
-
}
|
79 |
}
|
80 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
-
|
83 |
-
$this->closeWriters();
|
84 |
-
|
85 |
-
$logger->log("Finished $vFeedname data export for store #".$oStore->getId()." - ".$oStore->getName());
|
86 |
-
$logger->logMemoryUsage();
|
87 |
-
return true;
|
88 |
-
}catch (Exception $e) {
|
89 |
-
$logger->log("Error in feed creation:--".$e->getMessage());
|
90 |
-
$logger->log('callstack on error in feed creation : '.mageDebugBacktrace(true, true, true));
|
91 |
-
return false;
|
92 |
}
|
93 |
-
}
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
if ($oWriter instanceof Expertrec_Recommendation_Model_Writer_Abstract) {
|
100 |
-
$this->_oWriter = $oWriter;
|
101 |
-
}
|
102 |
-
|
103 |
-
return $this;
|
104 |
-
}
|
105 |
-
|
106 |
-
protected function prepareHeaders() {
|
107 |
-
try{
|
108 |
-
$storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
|
109 |
-
$storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
|
110 |
-
if (isset($storedHeaders)){
|
111 |
-
$header = explode(',', $storedHeaders);
|
112 |
-
}else{
|
113 |
-
$header = array();
|
114 |
-
}
|
115 |
-
|
116 |
-
if(empty($header)){
|
117 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Headers are not selected. Go to the info page,select headers and try again.");
|
118 |
-
return false;
|
119 |
}
|
|
|
|
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
else{
|
127 |
-
$
|
128 |
-
$totalHeaders = array_merge($header,$filter);
|
129 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
-
|
132 |
-
$totalHeaders = $header;
|
133 |
-
}
|
134 |
-
|
135 |
-
//setting header fields array to this, so we can use it later
|
136 |
-
$this->_ofields = $totalHeaders;
|
137 |
-
|
138 |
-
//writing header row
|
139 |
-
$this->_oWriter->setHeader($totalHeaders)->writeHeaderRow();
|
140 |
-
//$this->_oWriter->setHeader($filter)->writeHeaderRow();
|
141 |
-
|
142 |
-
}catch (Exception $e) {
|
143 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error in writing header: ".$e->getMessage());
|
144 |
-
return false;
|
145 |
}
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
$this->_oWriter->close();
|
158 |
-
return $this;
|
159 |
-
}
|
160 |
-
|
161 |
-
|
162 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Feed generator class
|
5 |
+
*
|
6 |
+
* @category Expertrec
|
7 |
+
* @package Expertrec_Recommendation
|
8 |
+
* @copyright Copyright (c) 2016 CloudInfra LLC.
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*/
|
11 |
+
class Expertrec_Recommendation_Model_Feed_Feedcreator {
|
12 |
+
|
13 |
+
const CONFIG_HEADERS = 'expertrec/general/headers';
|
14 |
+
const CONFIG_FILTERS = 'expertrec/general/filters';
|
15 |
+
protected $_oWriter;
|
16 |
+
protected $_ofields=array();
|
17 |
+
|
18 |
+
public function export(Mage_Core_Model_Website $website, Mage_Core_Model_Store $oStore, $vFeedname) {
|
19 |
+
$logger = Mage::getSingleton('expertrec_recommendation/log');
|
20 |
+
try{
|
21 |
+
$logger->log("Beginning $vFeedname export for store #".$oStore->getId()." - ".$oStore->getName());
|
22 |
+
$logger->logMemoryUsage();
|
23 |
+
// $logger->log("Initialising file writers...");
|
24 |
+
$this->initWriters($oStore, $vFeedname);
|
25 |
+
// Prepare the csv file header
|
26 |
+
// $logger->log("Begin preparing header rows...");
|
27 |
+
$logger->logMemoryUsage();
|
28 |
+
//if any error occur during header writing, it will return false
|
29 |
+
if(!$this->prepareHeaders()){
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
// Initialise the formatter
|
33 |
+
// $logger->log("Initialising Feed Formatter...");
|
34 |
+
$formatter = Mage::getSingleton('expertrec_recommendation/feed_formatter');
|
35 |
+
$formatter->init();
|
36 |
+
// $logger->log("Initialised Feed Formatter.");
|
37 |
+
$logger->logMemoryUsage();
|
38 |
+
//get product collection
|
39 |
+
$logger->log("Getting product collection for store#".$oStore->getId()." - ".$oStore->getName());
|
40 |
+
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
41 |
+
$collection=Mage::getSingleton('expertrec_recommendation/feed_feedfilter')->addBasicFilter($website,$oStore)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
->setPageSize($feedConfig->pageSize);
|
43 |
+
$pageEnd = $feedConfig->pageEnd;
|
44 |
+
$lastPageNumber = $collection->getLastPageNumber();
|
45 |
+
if($pageEnd != 0 && $pageEnd < $lastPageNumber){
|
46 |
+
$pages = $pageEnd;
|
47 |
+
}else{
|
48 |
+
$pages = $lastPageNumber;
|
49 |
+
}
|
50 |
+
$logger->log("Total no. of pages for which we are collecting feed in this reqeust: #".$pages);
|
51 |
+
for($currentPage = $feedConfig->pageStart; $currentPage <= $pages; $currentPage++) {
|
52 |
+
$logger->log("Collecting feed for page: #".$currentPage);
|
53 |
+
$collection->setCurPage($currentPage);
|
54 |
+
foreach ($collection as $product) {
|
|
|
|
|
|
|
|
|
|
|
55 |
$aRow = $formatter->prepareRow($this->_ofields,$product);
|
|
|
56 |
//writing data row
|
57 |
$this->_oWriter->writeDataRow($aRow);
|
58 |
}
|
59 |
+
$collection->clear();
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
+
$this->closeWriters();
|
62 |
+
$logger->log("Finished $vFeedname data export for store #".$oStore->getId()." - ".$oStore->getName());
|
63 |
+
$logger->logMemoryUsage();
|
64 |
+
return true;
|
65 |
+
}catch (Exception $e) {
|
66 |
+
$logger->log("Error in feed creation:--".$e->getMessage());
|
67 |
+
return false;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
|
70 |
|
71 |
+
protected function initWriters(Mage_Core_Model_Store $oStore, $vFeedname) {
|
72 |
+
$oWriter = Mage::getModel('expertrec_recommendation/writer_csv')->init($oStore->getCode(), $vFeedname);
|
73 |
+
if ($oWriter instanceof Expertrec_Recommendation_Model_Writer_Abstract) {
|
74 |
+
$this->_oWriter = $oWriter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
|
79 |
+
protected function prepareHeaders() {
|
80 |
+
try{
|
81 |
+
$storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
|
82 |
+
$storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
|
83 |
+
if (isset($storedHeaders)){
|
84 |
+
$header = explode(',', $storedHeaders);
|
85 |
+
}else{
|
86 |
+
$header = array();
|
87 |
+
}
|
88 |
+
if(empty($header)){
|
89 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Headers are not selected. Go to the info page,select headers and try again.");
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
// checking for filters
|
93 |
+
if(isset($storedFilters)){
|
94 |
+
if (empty($storedFilters)){
|
95 |
+
$totalHeaders = $header;
|
96 |
+
}
|
97 |
+
else{
|
98 |
+
$filter = explode(',', $storedFilters);
|
99 |
+
$totalHeaders = array_merge($header,$filter);
|
100 |
+
}
|
101 |
}
|
102 |
else{
|
103 |
+
$totalHeaders = $header;
|
|
|
104 |
}
|
105 |
+
//setting header fields array to this, so we can use it later
|
106 |
+
$this->_ofields = $totalHeaders;
|
107 |
+
//writing header row
|
108 |
+
$this->_oWriter->setHeader($totalHeaders)->writeHeaderRow();
|
109 |
+
//$this->_oWriter->setHeader($filter)->writeHeaderRow();
|
110 |
+
}catch (Exception $e) {
|
111 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error in writing header: ".$e->getMessage());
|
112 |
+
return false;
|
113 |
}
|
114 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* Closes the file writer once finished
|
119 |
+
*
|
120 |
+
* @return $this
|
121 |
+
*/
|
122 |
+
protected function closeWriters() {
|
123 |
+
$this->_oWriter->close();
|
124 |
+
return $this;
|
125 |
+
}
|
126 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Expertrec/Recommendation/Model/Feed/Feedfilter.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
class Expertrec_Recommendation_Model_Feed_Feedfilter {
|
|
|
3 |
// adding filters selected form info page
|
4 |
const CONFIG_FILTERS = 'expertrec/general/filters';
|
5 |
-
|
6 |
-
public function addBasicFilter(Mage_Core_Model_Website $website,Mage_Core_Model_Store $oStore){
|
7 |
|
|
|
8 |
$collection = Mage::getModel('catalog/product')->getCollection();
|
9 |
-
|
10 |
$storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
|
11 |
$storedFiltersArray = array();
|
12 |
if(isset($storedFilters)){
|
@@ -14,19 +14,16 @@
|
|
14 |
$storedFiltersArray = explode(',', $storedFilters);
|
15 |
}
|
16 |
}
|
17 |
-
|
18 |
$visible_1 = in_array('not_visible_individually',$storedFiltersArray) ? 1 : 0;
|
19 |
$visible_2 = in_array('visible_catalog',$storedFiltersArray) ? 2 : 0;
|
20 |
$visible_3 = in_array('visible_search',$storedFiltersArray) ? 3 : 0;
|
21 |
$visible_4 = in_array('visible_catalog_search',$storedFiltersArray) ? 4 : 0;
|
22 |
$visiblityCondition = array('in' => array("$visible_1","$visible_2","$visible_3","$visible_4"));
|
23 |
-
|
24 |
$coreResource = Mage::getSingleton("core/resource");
|
25 |
$catalogInventoryTable = method_exists($coreResource, 'getTableName')
|
26 |
? $coreResource->getTableName('cataloginventory_stock_item') : 'cataloginventory_stock_item';
|
27 |
$stockfields = array("qty" => "qty", "manage_stock" => "manage_stock",
|
28 |
"use_config_manage_stock" => "use_config_manage_stock", "is_in_stock" => "is_in_stock");
|
29 |
-
|
30 |
$collection
|
31 |
->addWebsiteFilter($website->getWebsiteId())
|
32 |
->setStoreId($oStore->getId())
|
@@ -35,11 +32,9 @@
|
|
35 |
->addCategoryIds()
|
36 |
// ->addAttributeToFilter('visibility',$visiblityCondition)
|
37 |
->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
|
38 |
-
|
39 |
if(in_array('not_visible_individually',$storedFiltersArray) || in_array('visible_catalog',$storedFiltersArray) || in_array('visible_search',$storedFiltersArray) || in_array('visible_catalog_search',$storedFiltersArray) ){
|
40 |
$collection->addAttributeToFilter('visibility',$visiblityCondition);
|
41 |
}
|
42 |
-
|
43 |
// if(in_array('filter_by_stock',$storedFiltersArray)){
|
44 |
// $collection
|
45 |
// ->joinField(
|
@@ -52,20 +47,12 @@
|
|
52 |
// )
|
53 |
// ->addAttributeToFilter('is_in_stock', array('eq' => 1));
|
54 |
// }
|
55 |
-
|
56 |
// if(in_array('filter_by_status',$storedFiltersArray)){
|
57 |
// $collection->addAttributeToFilter('status', array('eq' => 1));
|
58 |
// }
|
59 |
-
|
60 |
//filters out products which are Disabled
|
61 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
62 |
-
|
63 |
-
// echo "collection <pre>";
|
64 |
-
// print_r($collection->getSize());
|
65 |
-
// print_r($collection->getData());
|
66 |
-
// exit();
|
67 |
-
|
68 |
return $collection;
|
69 |
}
|
70 |
}
|
71 |
-
?>
|
1 |
<?php
|
2 |
+
|
3 |
class Expertrec_Recommendation_Model_Feed_Feedfilter {
|
4 |
+
|
5 |
// adding filters selected form info page
|
6 |
const CONFIG_FILTERS = 'expertrec/general/filters';
|
|
|
|
|
7 |
|
8 |
+
public function addBasicFilter(Mage_Core_Model_Website $website,Mage_Core_Model_Store $oStore){
|
9 |
$collection = Mage::getModel('catalog/product')->getCollection();
|
|
|
10 |
$storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
|
11 |
$storedFiltersArray = array();
|
12 |
if(isset($storedFilters)){
|
14 |
$storedFiltersArray = explode(',', $storedFilters);
|
15 |
}
|
16 |
}
|
|
|
17 |
$visible_1 = in_array('not_visible_individually',$storedFiltersArray) ? 1 : 0;
|
18 |
$visible_2 = in_array('visible_catalog',$storedFiltersArray) ? 2 : 0;
|
19 |
$visible_3 = in_array('visible_search',$storedFiltersArray) ? 3 : 0;
|
20 |
$visible_4 = in_array('visible_catalog_search',$storedFiltersArray) ? 4 : 0;
|
21 |
$visiblityCondition = array('in' => array("$visible_1","$visible_2","$visible_3","$visible_4"));
|
|
|
22 |
$coreResource = Mage::getSingleton("core/resource");
|
23 |
$catalogInventoryTable = method_exists($coreResource, 'getTableName')
|
24 |
? $coreResource->getTableName('cataloginventory_stock_item') : 'cataloginventory_stock_item';
|
25 |
$stockfields = array("qty" => "qty", "manage_stock" => "manage_stock",
|
26 |
"use_config_manage_stock" => "use_config_manage_stock", "is_in_stock" => "is_in_stock");
|
|
|
27 |
$collection
|
28 |
->addWebsiteFilter($website->getWebsiteId())
|
29 |
->setStoreId($oStore->getId())
|
32 |
->addCategoryIds()
|
33 |
// ->addAttributeToFilter('visibility',$visiblityCondition)
|
34 |
->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
|
|
|
35 |
if(in_array('not_visible_individually',$storedFiltersArray) || in_array('visible_catalog',$storedFiltersArray) || in_array('visible_search',$storedFiltersArray) || in_array('visible_catalog_search',$storedFiltersArray) ){
|
36 |
$collection->addAttributeToFilter('visibility',$visiblityCondition);
|
37 |
}
|
|
|
38 |
// if(in_array('filter_by_stock',$storedFiltersArray)){
|
39 |
// $collection
|
40 |
// ->joinField(
|
47 |
// )
|
48 |
// ->addAttributeToFilter('is_in_stock', array('eq' => 1));
|
49 |
// }
|
|
|
50 |
// if(in_array('filter_by_status',$storedFiltersArray)){
|
51 |
// $collection->addAttributeToFilter('status', array('eq' => 1));
|
52 |
// }
|
|
|
53 |
//filters out products which are Disabled
|
54 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
return $collection;
|
56 |
}
|
57 |
}
|
58 |
+
?>
|
app/code/community/Expertrec/Recommendation/Model/Feed/Formatter.php
CHANGED
@@ -1,127 +1,117 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Expertrec_Recommendation_Model_Feed_Formatter {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
public function init() {
|
14 |
-
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
15 |
-
$this->_oConfig['imageWidth'] = $feedConfig->imageWidth;
|
16 |
-
$this->_oConfig['imageHeight'] = $feedConfig->imageHeight;
|
17 |
-
$this->_oConfig['generateImage'] = $feedConfig->generateImage;
|
18 |
-
//Mage::getSingleton('expertrec_recommendation/log')->log($this->_oConfig['imageWidth']."---->".$this->_oConfig['imageHeight']."---->".$this->_oConfig['generateImage']);
|
19 |
-
return $this;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function prepareRow($fields,$product) {
|
23 |
-
$aFeedRow = array();
|
24 |
|
25 |
-
|
26 |
-
$
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
case 'expert_smallImage':
|
33 |
-
$vValue = $this->_getImage($skey,$product);
|
34 |
-
break;
|
35 |
-
case 'expert_thumbnail':
|
36 |
-
$vValue = $this->_getImage($skey,$product);
|
37 |
-
break;
|
38 |
-
case 'expert_category':
|
39 |
-
$vValue = $this->_getCategories($product,0);
|
40 |
-
break;
|
41 |
-
case 'expert_category_ids':
|
42 |
-
$vValue = $this->_getCategories($product,1);
|
43 |
-
break;
|
44 |
-
case 'expert_url':
|
45 |
-
//$vValue=$product->getProductUrl();
|
46 |
-
//changing ProductUrl from /index.php/catalog/product/view/id/539/s/racer-back-maxi-dress/ to /index.php/racer-back-maxi-dress.html
|
47 |
-
$url = Mage::getBaseUrl().$product->url_path;
|
48 |
-
$vValue=$url;
|
49 |
-
break;
|
50 |
-
case 'qty':
|
51 |
-
$vValue = (int)$product->getData("qty");
|
52 |
-
break;
|
53 |
-
default:
|
54 |
-
$attributedata = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $skey)->getData();
|
55 |
-
$vValue =$product->getData($skey);
|
56 |
-
//For multiselect attr, need to use attrText to retrieve label value
|
57 |
-
if(!empty($vValue) && array_key_exists('frontend_input',$attributedata)
|
58 |
-
&& (isset($attributedata['frontend_input']) && $attributedata['frontend_input'] == 'select'))
|
59 |
-
{
|
60 |
-
$vValue .= chr(4).$product->getAttributeText($skey);
|
61 |
-
//Mage::getSingleton('expertrec_recommendation/log')->log(" The select dropdown is : ".$attributedata['frontend_input']." key is : ".$skey);
|
62 |
-
}
|
63 |
-
break;
|
64 |
-
}
|
65 |
-
|
66 |
-
if(empty($vValue)){
|
67 |
-
$vValue = (string)$vValue == "0" ? 0 : 'None';
|
68 |
-
}
|
69 |
-
//Mage::getSingleton('expertrec_recommendation/log')->log("data---------->: ".$skey."----------->".$vValue);
|
70 |
-
$aFeedRow[$skey] = $vValue;
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
|
|
|
|
120 |
}
|
121 |
-
|
122 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error while fetching the image" . $e->getMessage());
|
123 |
}
|
124 |
-
|
125 |
-
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getData('image');
|
126 |
-
}
|
127 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
class Expertrec_Recommendation_Model_Feed_Formatter {
|
4 |
|
5 |
+
//getting image width and height from db
|
6 |
+
const IMAGE_WIDTH = 'expertrec/general/expertrec_image_width';
|
7 |
+
const IMAGE_HEIGHT = 'expertrec/general/expertrec_image_height';
|
8 |
+
const THUMBNAIL_WIDTH = 'expertrec/general/expertrec_thumbnail_width';
|
9 |
+
const THUMBNAIL_HEIGHT = 'expertrec/general/expertrec_thumbnail_height';
|
10 |
|
11 |
+
protected $_oConfig= array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
public function init() {
|
14 |
+
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
15 |
+
$this->_oConfig['imageWidth'] = $feedConfig->imageWidth;
|
16 |
+
$this->_oConfig['imageHeight'] = $feedConfig->imageHeight;
|
17 |
+
$this->_oConfig['generateImage'] = $feedConfig->generateImage;
|
18 |
+
//Mage::getSingleton('expertrec_recommendation/log')->log($this->_oConfig['imageWidth']."---->".$this->_oConfig['imageHeight']."---->".$this->_oConfig['generateImage']);
|
19 |
+
return $this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
+
public function prepareRow($fields,$product) {
|
23 |
+
$aFeedRow = array();
|
24 |
+
foreach ($fields as $vKey) {
|
25 |
+
$vValue='';
|
26 |
+
$skey = (string) $vKey;
|
27 |
+
switch ($skey) {
|
28 |
+
case 'expert_image':
|
29 |
+
$vValue = $this->_getImage($skey,$product);
|
30 |
+
break;
|
31 |
+
case 'expert_smallImage':
|
32 |
+
$vValue = $this->_getImage($skey,$product);
|
33 |
+
break;
|
34 |
+
case 'expert_thumbnail':
|
35 |
+
$vValue = $this->_getImage($skey,$product);
|
36 |
+
break;
|
37 |
+
case 'expert_category':
|
38 |
+
$vValue = $this->_getCategories($product,0);
|
39 |
+
break;
|
40 |
+
case 'expert_category_ids':
|
41 |
+
$vValue = $this->_getCategories($product,1);
|
42 |
+
break;
|
43 |
+
case 'expert_url':
|
44 |
+
//$vValue=$product->getProductUrl();
|
45 |
+
//changing ProductUrl from /index.php/catalog/product/view/id/539/s/racer-back-maxi-dress/ to /index.php/racer-back-maxi-dress.html
|
46 |
+
$url = Mage::getBaseUrl().$product->url_path;
|
47 |
+
$vValue=$url;
|
48 |
+
break;
|
49 |
+
case 'qty':
|
50 |
+
$vValue = (int)$product->getData("qty");
|
51 |
+
break;
|
52 |
+
default:
|
53 |
+
$attributedata = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $skey)->getData();
|
54 |
+
$vValue =$product->getData($skey);
|
55 |
+
//For multiselect attr, need to use attrText to retrieve label value
|
56 |
+
if(!empty($vValue) && array_key_exists('frontend_input',$attributedata)
|
57 |
+
&& (isset($attributedata['frontend_input']) && $attributedata['frontend_input'] == 'select')){
|
58 |
+
$vValue .= chr(4).$product->getAttributeText($skey);
|
59 |
+
//Mage::getSingleton('expertrec_recommendation/log')->log(" The select dropdown is : ".$attributedata['frontend_input']." key is : ".$skey);
|
60 |
+
}
|
61 |
+
break;
|
62 |
}
|
63 |
+
if(empty($vValue)){
|
64 |
+
$vValue = (string)$vValue == "0" ? 0 : 'None';
|
65 |
+
}
|
66 |
+
//Mage::getSingleton('expertrec_recommendation/log')->log("data---------->: ".$skey."----------->".$vValue);
|
67 |
+
$aFeedRow[$skey] = $vValue;
|
68 |
}
|
69 |
+
return $aFeedRow;
|
70 |
+
}
|
71 |
+
|
72 |
+
/*
|
73 |
+
@idstr determines if this combination is called for categories, or for category ids
|
74 |
+
*/
|
75 |
+
protected function _getCategories($product,$idstr){
|
76 |
+
$path = Mage::getSingleton('expertrec_recommendation/translator_category')
|
77 |
+
->translate($product,$idstr);
|
78 |
+
return $path;
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _getImage($fieldName, $product) {
|
82 |
+
try {
|
83 |
+
$width = Mage::getStoreConfig(self::IMAGE_WIDTH);
|
84 |
+
$height = Mage::getStoreConfig(self::IMAGE_HEIGHT);
|
85 |
+
$twidth = Mage::getStoreConfig(self::THUMBNAIL_WIDTH);
|
86 |
+
$theight = Mage::getStoreConfig(self::THUMBNAIL_HEIGHT);
|
87 |
+
if('expert_image' == $fieldName ){
|
88 |
+
if($this->_oConfig['generateImage']){
|
89 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize($this->_oConfig['imageWidth'], $this->_oConfig['imageHeight']);
|
90 |
+
}else if(!empty($width) && !empty($height)){
|
91 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize($width, $height);
|
92 |
+
}else if(empty($width) && !empty($height)){
|
93 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize($this->_oConfig['imageWidth'], $height);
|
94 |
+
}else if(empty($height) && !empty($width)){
|
95 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize($width, $this->_oConfig['imageHeight']);
|
96 |
+
}else if(empty($height) && empty($width)){
|
97 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize($this->_oConfig['imageWidth'], $this->_oConfig['imageHeight']);
|
98 |
+
}
|
99 |
+
}else if('expert_smallImage' == $fieldName){
|
100 |
+
return (string)Mage::helper('catalog/image')->init($product, 'image')->resize(250,250);
|
101 |
+
}else if ('expert_thumbnail' == $fieldName) {
|
102 |
+
if(!empty($twidth) && !empty($theight)){
|
103 |
+
return (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize($twidth, $theight);
|
104 |
+
}else if(empty($twidth) && !empty($theight)){
|
105 |
+
return (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(80, $theight);
|
106 |
+
}else if(empty($theight) && !empty($twidth)){
|
107 |
+
return (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize($twidth, 80);
|
108 |
+
}else if(empty($theight) && empty($twidth)){
|
109 |
+
return (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(80,80);
|
110 |
+
}
|
111 |
}
|
112 |
+
} catch (Exception $e) {
|
113 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error while fetching the image" . $e->getMessage());
|
114 |
}
|
115 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getData('image');
|
|
|
116 |
}
|
117 |
+
}
|
|
|
|
|
|
app/code/community/Expertrec/Recommendation/Model/Log.php
CHANGED
@@ -1,28 +1,24 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
class Expertrec_Recommendation_Model_Log {
|
12 |
-
|
13 |
// Name of the log file in var/log
|
14 |
const LOG_FILE = 'expertrec_feed.log';
|
15 |
const FEED_PATH = '/Expertrec';
|
16 |
-
|
17 |
-
|
18 |
/**
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
24 |
public function log($message, $level = Zend_Log::INFO, $bDeveloperModeOnly = false) {
|
25 |
-
|
26 |
try{
|
27 |
$vFeedDir = "/tmp".self::FEED_PATH;
|
28 |
if (!is_dir($vFeedDir)) {
|
@@ -43,19 +39,16 @@ class Expertrec_Recommendation_Model_Log {
|
|
43 |
}catch(Exception $e){
|
44 |
return $this;
|
45 |
}
|
46 |
-
|
47 |
}
|
48 |
-
|
49 |
/**
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
public function logMemoryUsage() {
|
54 |
$iCurrentKb = ceil(memory_get_usage(true) / 1024);
|
55 |
$iPeakKb = ceil(memory_get_peak_usage(true) / 1024);
|
56 |
$this->log("Memory Usage - Current (Kb): ".$iCurrentKb." Peak (Kb): ".$iPeakKb, Zend_Log::DEBUG);
|
57 |
return $this;
|
58 |
}
|
59 |
-
|
60 |
-
|
61 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Simple logging interface for this extension
|
4 |
+
*
|
5 |
+
* @category Expertrec
|
6 |
+
* @package Expertrec_Recommendation
|
7 |
+
* @copyright Copyright (c) 2016 CloudInfra LLC.
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
+
*/
|
10 |
class Expertrec_Recommendation_Model_Log {
|
|
|
11 |
// Name of the log file in var/log
|
12 |
const LOG_FILE = 'expertrec_feed.log';
|
13 |
const FEED_PATH = '/Expertrec';
|
|
|
|
|
14 |
/**
|
15 |
+
* Logging for Feed exporter
|
16 |
+
* @param string $message
|
17 |
+
* @param int $level ZEND_LOG log level
|
18 |
+
* @param boolean $bDeveloperModeOnly True to log only in Developer mode
|
19 |
+
*/
|
20 |
+
|
21 |
public function log($message, $level = Zend_Log::INFO, $bDeveloperModeOnly = false) {
|
|
|
22 |
try{
|
23 |
$vFeedDir = "/tmp".self::FEED_PATH;
|
24 |
if (!is_dir($vFeedDir)) {
|
39 |
}catch(Exception $e){
|
40 |
return $this;
|
41 |
}
|
|
|
42 |
}
|
43 |
+
|
44 |
/**
|
45 |
+
* Logs the current php memory usage.
|
46 |
+
*
|
47 |
+
*/
|
48 |
public function logMemoryUsage() {
|
49 |
$iCurrentKb = ceil(memory_get_usage(true) / 1024);
|
50 |
$iPeakKb = ceil(memory_get_peak_usage(true) / 1024);
|
51 |
$this->log("Memory Usage - Current (Kb): ".$iCurrentKb." Peak (Kb): ".$iPeakKb, Zend_Log::DEBUG);
|
52 |
return $this;
|
53 |
}
|
|
|
|
|
54 |
}
|
app/code/community/Expertrec/Recommendation/Model/Observer.php
CHANGED
@@ -491,7 +491,7 @@ class Expertrec_Recommendation_Model_Observer {
|
|
491 |
|
492 |
$mid = Mage::getStoreConfig(self::MERCHANT_ID);
|
493 |
$feedUrl = "https://feed.expertrec.com/magento/n01eba6261ad7f174cd3a16523e86e65/";
|
494 |
-
$finalUrl = $feedUrl.''.$mid.'/
|
495 |
|
496 |
//sending request
|
497 |
$response = Mage::getModel('expertrec_recommendation/api_request')
|
491 |
|
492 |
$mid = Mage::getStoreConfig(self::MERCHANT_ID);
|
493 |
$feedUrl = "https://feed.expertrec.com/magento/n01eba6261ad7f174cd3a16523e86e65/";
|
494 |
+
$finalUrl = $feedUrl.''.$mid.'/stock';
|
495 |
|
496 |
//sending request
|
497 |
$response = Mage::getModel('expertrec_recommendation/api_request')
|
app/code/community/Expertrec/Recommendation/Model/Translator/Category.php
CHANGED
@@ -1,50 +1,41 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
class Expertrec_Recommendation_Model_Translator_Category {
|
8 |
-
|
9 |
protected $_categoryPaths = array();
|
10 |
protected $_categoryIdPaths = array();
|
11 |
-
|
12 |
/**
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
18 |
public function translate($product,$idStr) {
|
19 |
$categoryPathArray=array();
|
20 |
$categoryArray = array_unique($product->getCategoryIds());
|
21 |
foreach ($categoryArray as $category_id) {
|
22 |
-
|
23 |
-
if($idStr == 0)
|
24 |
-
{
|
25 |
$curPath=$this->_getCategoryPath($category_id);
|
26 |
-
}
|
27 |
-
elseif ($idStr == 1)
|
28 |
-
{
|
29 |
$curPath=$this->_getCategoryIdPath($category_id);
|
30 |
}
|
31 |
-
|
32 |
if(!empty($curPath)){
|
33 |
-
|
34 |
}
|
35 |
}
|
36 |
-
|
37 |
-
//Mage::getSingleton('expertrec_recommendation/log')->log(" The categories are : ".implode(chr(4),$categoryPathArray));
|
38 |
return implode(chr(4),$categoryPathArray);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
protected function _getCategoryPath($categoryId) {
|
49 |
try{
|
50 |
if (!array_key_exists($categoryId, $this->_categoryPaths)) {
|
@@ -65,16 +56,15 @@ class Expertrec_Recommendation_Model_Translator_Category {
|
|
65 |
Mage::getSingleton('expertrec_recommendation/log')->log("Error in getCategoryPath: ".$e->getMessage());
|
66 |
return '';
|
67 |
}
|
68 |
-
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
protected function _getCategoryIdPath($categoryId) {
|
79 |
try{
|
80 |
if (!array_key_exists($categoryId, $this->_categoryIdPaths)) {
|
@@ -82,7 +72,7 @@ class Expertrec_Recommendation_Model_Translator_Category {
|
|
82 |
if ($category === null || !$category->getIsActive() || $category->getLevel() == 1){
|
83 |
$this->_categoryIdPaths[$categoryId] = '';
|
84 |
}else {
|
85 |
-
|
86 |
$parentCategoryPath = $this->_getCategoryIdPath($category->getParentId());
|
87 |
if ($parentCategoryPath == '') {
|
88 |
$this->_categoryIdPaths[$categoryId] = $categoryId;
|
@@ -96,7 +86,5 @@ class Expertrec_Recommendation_Model_Translator_Category {
|
|
96 |
Mage::getSingleton('expertrec_recommendation/log')->log("Error in getCategoryPath: ".$e->getMessage());
|
97 |
return '';
|
98 |
}
|
99 |
-
|
100 |
}
|
101 |
-
|
102 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Translates category ids into a complete path.
|
4 |
+
*/
|
|
|
5 |
class Expertrec_Recommendation_Model_Translator_Category {
|
|
|
6 |
protected $_categoryPaths = array();
|
7 |
protected $_categoryIdPaths = array();
|
|
|
8 |
/**
|
9 |
+
* Translates a category id stored in the supplied field to a full category path.
|
10 |
+
*
|
11 |
+
* @param $product
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
|
15 |
public function translate($product,$idStr) {
|
16 |
$categoryPathArray=array();
|
17 |
$categoryArray = array_unique($product->getCategoryIds());
|
18 |
foreach ($categoryArray as $category_id) {
|
19 |
+
if($idStr == 0){
|
|
|
|
|
20 |
$curPath=$this->_getCategoryPath($category_id);
|
21 |
+
}elseif ($idStr == 1){
|
|
|
|
|
22 |
$curPath=$this->_getCategoryIdPath($category_id);
|
23 |
}
|
|
|
24 |
if(!empty($curPath)){
|
25 |
+
$categoryPathArray[] = $curPath;
|
26 |
}
|
27 |
}
|
28 |
+
//Mage::getSingleton('expertrec_recommendation/log')->log(" The categories are : ".implode(chr(4),$categoryPathArray));
|
|
|
29 |
return implode(chr(4),$categoryPathArray);
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
+
* First check given category_id present in the global category_path Array or not. If not found then make a db call to
|
34 |
+
* fetch category path and set it to category_path array.
|
35 |
+
*
|
36 |
+
* @param category id
|
37 |
+
* @return category path
|
38 |
+
*/
|
39 |
protected function _getCategoryPath($categoryId) {
|
40 |
try{
|
41 |
if (!array_key_exists($categoryId, $this->_categoryPaths)) {
|
56 |
Mage::getSingleton('expertrec_recommendation/log')->log("Error in getCategoryPath: ".$e->getMessage());
|
57 |
return '';
|
58 |
}
|
|
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
+
* First check given category_id present in the global category_path Array or not. If not found then make a db call to
|
63 |
+
* fetch category path and set it to category_path array.
|
64 |
+
*
|
65 |
+
* @param category id
|
66 |
+
* @return category path
|
67 |
+
*/
|
68 |
protected function _getCategoryIdPath($categoryId) {
|
69 |
try{
|
70 |
if (!array_key_exists($categoryId, $this->_categoryIdPaths)) {
|
72 |
if ($category === null || !$category->getIsActive() || $category->getLevel() == 1){
|
73 |
$this->_categoryIdPaths[$categoryId] = '';
|
74 |
}else {
|
75 |
+
//Mage::getSingleton('expertrec_recommendation/log')->log("Inside category ID");
|
76 |
$parentCategoryPath = $this->_getCategoryIdPath($category->getParentId());
|
77 |
if ($parentCategoryPath == '') {
|
78 |
$this->_categoryIdPaths[$categoryId] = $categoryId;
|
86 |
Mage::getSingleton('expertrec_recommendation/log')->log("Error in getCategoryPath: ".$e->getMessage());
|
87 |
return '';
|
88 |
}
|
|
|
89 |
}
|
90 |
+
}
|
|
app/code/community/Expertrec/Recommendation/Model/Validate.php
CHANGED
@@ -6,49 +6,40 @@
|
|
6 |
** @package Expertrec_Recommendation
|
7 |
** @copyright Copyright (c) 2016 CloudInfra LLC.
|
8 |
**/
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
if($Password == '' || $Password == self::DEFAULT_SECRET || $Password != $this->getPassword()){
|
22 |
-
return false;
|
23 |
-
}
|
24 |
-
return true;
|
25 |
}
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
->setSecret($storedPwd);
|
34 |
-
}
|
35 |
-
|
36 |
-
return $storedPwd;
|
37 |
}
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
|
46 |
-
->setMerchantId($storedMid);
|
47 |
-
}
|
48 |
-
|
49 |
-
return $storedMid;
|
50 |
}
|
51 |
-
|
|
|
52 |
}
|
53 |
-
|
54 |
-
?>
|
6 |
** @package Expertrec_Recommendation
|
7 |
** @copyright Copyright (c) 2016 CloudInfra LLC.
|
8 |
**/
|
9 |
+
class Expertrec_Recommendation_Model_Validate {
|
10 |
+
const CONFIG_SECRET = 'expertrec/general/secret';
|
11 |
+
const CONFIG_MID = 'expertrec/general/mid';
|
12 |
+
const DEFAULT_SECRET = '519545f988a1c619ad9927f704914753';
|
13 |
+
/*
|
14 |
+
*@param password
|
15 |
+
*@return boolean
|
16 |
+
*/
|
17 |
+
|
18 |
+
public function checkPassword($Password){
|
19 |
+
if($Password == '' || $Password == self::DEFAULT_SECRET || $Password != $this->getPassword()){
|
20 |
+
return false;
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
+
return true;
|
23 |
+
}
|
24 |
|
25 |
+
public function getPassword(){
|
26 |
+
$storedPwd = Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->getSecret();
|
27 |
+
if(empty($storedPwd)){
|
28 |
+
$storedPwd = base64_decode(Mage::getStoreConfig(self::CONFIG_SECRET));
|
29 |
+
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
|
30 |
+
->setSecret($storedPwd);
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
+
return $storedPwd;
|
33 |
+
}
|
34 |
|
35 |
+
public function getSiteKey(){
|
36 |
+
$storedMid = Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->getMerchantId();
|
37 |
+
if(empty($storedMid)){
|
38 |
+
$storedMid = Mage::getStoreConfig(self::CONFIG_MID);
|
39 |
+
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
|
40 |
+
->setMerchantId($storedMid);
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
+
return $storedMid;
|
43 |
+
}
|
44 |
}
|
45 |
+
?>
|
|
app/code/community/Expertrec/Recommendation/Model/Writer/Abstract.php
CHANGED
@@ -1,32 +1,27 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
abstract class Expertrec_Recommendation_Model_Writer_Abstract extends Varien_Object {
|
4 |
-
|
5 |
protected $_vFileExtension = 'csv';
|
6 |
const FEED_PATH = '/Expertrec';
|
7 |
|
8 |
public function init($vStoreCode, $vFeedname) {
|
9 |
$this->setFilename($this->_getFilename($vStoreCode, $vFeedname));
|
10 |
}
|
11 |
-
|
12 |
/**
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
abstract function writeHeaderRow();
|
18 |
-
|
19 |
/**
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
abstract function writeDataRow($aRow);
|
26 |
-
|
27 |
/**
|
28 |
-
|
29 |
-
|
30 |
abstract function close();
|
31 |
|
32 |
protected function _getFilename($vStoreCode, $vFeedname) {
|
@@ -38,24 +33,19 @@ abstract class Expertrec_Recommendation_Model_Writer_Abstract extends Varien_Obj
|
|
38 |
return false;
|
39 |
}
|
40 |
}
|
41 |
-
|
42 |
//Appending storecode,timestamp and file_extension in feedname
|
43 |
$vtimestamp = (string)time();
|
44 |
$vFileName = $vFeedDir.'/'.$vFeedname.'-'.$vStoreCode.'_'.$vtimestamp.'.'.$this->_vFileExtension;
|
45 |
-
|
46 |
if (!file_exists($vFileName)) {
|
47 |
-
|
48 |
}
|
49 |
//setting filename to file config
|
50 |
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->setFeedFilePath($vFileName);
|
51 |
-
|
52 |
if (is_writable($vFileName)) {
|
53 |
return $vFileName;
|
54 |
} else {
|
55 |
$this->_log("Feed file is not writable: ".$vFileName);
|
56 |
return false;
|
57 |
}
|
58 |
-
|
59 |
}
|
60 |
-
|
61 |
-
}
|
1 |
<?php
|
|
|
2 |
abstract class Expertrec_Recommendation_Model_Writer_Abstract extends Varien_Object {
|
|
|
3 |
protected $_vFileExtension = 'csv';
|
4 |
const FEED_PATH = '/Expertrec';
|
5 |
|
6 |
public function init($vStoreCode, $vFeedname) {
|
7 |
$this->setFilename($this->_getFilename($vStoreCode, $vFeedname));
|
8 |
}
|
|
|
9 |
/**
|
10 |
+
* Writes the header row to the file where appropriate
|
11 |
+
*
|
12 |
+
* @return $this
|
13 |
+
*/
|
14 |
abstract function writeHeaderRow();
|
|
|
15 |
/**
|
16 |
+
* Writes a data row to the file
|
17 |
+
*
|
18 |
+
* @param array $aData Data to write. keys in this array must be the same as the keys in the setHeader array.
|
19 |
+
* @return $this
|
20 |
+
*/
|
21 |
abstract function writeDataRow($aRow);
|
|
|
22 |
/**
|
23 |
+
* Closes the file once finished.
|
24 |
+
*/
|
25 |
abstract function close();
|
26 |
|
27 |
protected function _getFilename($vStoreCode, $vFeedname) {
|
33 |
return false;
|
34 |
}
|
35 |
}
|
|
|
36 |
//Appending storecode,timestamp and file_extension in feedname
|
37 |
$vtimestamp = (string)time();
|
38 |
$vFileName = $vFeedDir.'/'.$vFeedname.'-'.$vStoreCode.'_'.$vtimestamp.'.'.$this->_vFileExtension;
|
|
|
39 |
if (!file_exists($vFileName)) {
|
40 |
+
touch($vFileName);
|
41 |
}
|
42 |
//setting filename to file config
|
43 |
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->setFeedFilePath($vFileName);
|
|
|
44 |
if (is_writable($vFileName)) {
|
45 |
return $vFileName;
|
46 |
} else {
|
47 |
$this->_log("Feed file is not writable: ".$vFileName);
|
48 |
return false;
|
49 |
}
|
|
|
50 |
}
|
51 |
+
}
|
|
app/code/community/Expertrec/Recommendation/Model/Writer/Csv.php
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
class Expertrec_Recommendation_Model_Writer_Csv extends Expertrec_Recommendation_Model_Writer_Abstract {
|
18 |
-
|
19 |
protected $_vFileExtension = 'csv';
|
20 |
|
21 |
public function __construct() {
|
@@ -24,10 +22,8 @@ class Expertrec_Recommendation_Model_Writer_Csv extends Expertrec_Recommendation
|
|
24 |
->setEnclosure('"');
|
25 |
}
|
26 |
|
27 |
-
|
28 |
public function init($vStoreCode, $vFeedname) {
|
29 |
parent::init($vStoreCode, $vFeedname);
|
30 |
-
|
31 |
// Fail if there are issues creating the output file.
|
32 |
if ($this->getFilename() === false) {
|
33 |
return false;
|
@@ -37,51 +33,43 @@ class Expertrec_Recommendation_Model_Writer_Csv extends Expertrec_Recommendation
|
|
37 |
$oIo = new Varien_Io_File();
|
38 |
$oIo->open(array('path' => dirname($vFileName)));
|
39 |
$oIo->streamOpen($vFileName);
|
40 |
-
|
41 |
$this->setStreamWriter($oIo);
|
42 |
}
|
43 |
-
|
44 |
return $this;
|
45 |
}
|
46 |
|
47 |
-
|
48 |
/**
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
public function writeHeaderRow() {
|
54 |
$this->getStreamWriter()->streamWriteCsv($this->getHeader(), $this->getDelimiter(), $this->getEnclosure());
|
55 |
return $this;
|
56 |
}
|
57 |
|
58 |
-
|
59 |
/**
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
public function writeDataRow($aData) {
|
66 |
$aRow = array();
|
67 |
foreach ($this->getHeader() as $vKey) {
|
68 |
-
|
69 |
if (is_array($aData[$vKey])) {
|
70 |
$aRow[] = implode(',', $aData[$vKey]);
|
71 |
} else {
|
72 |
$aRow[] = $aData[$vKey];
|
73 |
}
|
74 |
-
|
75 |
}
|
76 |
$this->getStreamWriter()->streamWriteCsv($aRow, $this->getDelimiter(), $this->getEnclosure());
|
77 |
-
|
78 |
return $this;
|
79 |
}
|
80 |
-
|
81 |
-
|
82 |
/**
|
83 |
-
|
84 |
-
|
85 |
public function close() {
|
86 |
$this->getStreamWriter()->streamClose();
|
87 |
return $this;
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Very lightweight CSV file writer. No formatting or validation of the export
|
4 |
+
* data is performed, however care is taken to ensure fields are always
|
5 |
+
* exported in the correct order even when fields are missing.
|
6 |
+
*
|
7 |
+
* @category Expertrec
|
8 |
+
* @package Expertrec_Recommendation
|
9 |
+
* @copyright Copyright (c) 2016 CloudInfra LLC.
|
10 |
+
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* @method setHeader()
|
12 |
+
* @method getHeader()
|
13 |
+
* @method setStreamWriter()
|
14 |
+
* @method getStreamWriter()
|
15 |
+
*/
|
16 |
class Expertrec_Recommendation_Model_Writer_Csv extends Expertrec_Recommendation_Model_Writer_Abstract {
|
|
|
17 |
protected $_vFileExtension = 'csv';
|
18 |
|
19 |
public function __construct() {
|
22 |
->setEnclosure('"');
|
23 |
}
|
24 |
|
|
|
25 |
public function init($vStoreCode, $vFeedname) {
|
26 |
parent::init($vStoreCode, $vFeedname);
|
|
|
27 |
// Fail if there are issues creating the output file.
|
28 |
if ($this->getFilename() === false) {
|
29 |
return false;
|
33 |
$oIo = new Varien_Io_File();
|
34 |
$oIo->open(array('path' => dirname($vFileName)));
|
35 |
$oIo->streamOpen($vFileName);
|
|
|
36 |
$this->setStreamWriter($oIo);
|
37 |
}
|
|
|
38 |
return $this;
|
39 |
}
|
40 |
|
|
|
41 |
/**
|
42 |
+
* Writes the header row to the csv
|
43 |
+
*
|
44 |
+
* @return $this
|
45 |
+
*/
|
46 |
public function writeHeaderRow() {
|
47 |
$this->getStreamWriter()->streamWriteCsv($this->getHeader(), $this->getDelimiter(), $this->getEnclosure());
|
48 |
return $this;
|
49 |
}
|
50 |
|
|
|
51 |
/**
|
52 |
+
* Writes a data row to the csv
|
53 |
+
*
|
54 |
+
* @param array $aData Data to write. keys in this array must be the same as the keys in the setHeader array.
|
55 |
+
* @return $this
|
56 |
+
*/
|
57 |
public function writeDataRow($aData) {
|
58 |
$aRow = array();
|
59 |
foreach ($this->getHeader() as $vKey) {
|
|
|
60 |
if (is_array($aData[$vKey])) {
|
61 |
$aRow[] = implode(',', $aData[$vKey]);
|
62 |
} else {
|
63 |
$aRow[] = $aData[$vKey];
|
64 |
}
|
|
|
65 |
}
|
66 |
$this->getStreamWriter()->streamWriteCsv($aRow, $this->getDelimiter(), $this->getEnclosure());
|
|
|
67 |
return $this;
|
68 |
}
|
69 |
+
|
|
|
70 |
/**
|
71 |
+
* Closes the CSV file once finished.
|
72 |
+
*/
|
73 |
public function close() {
|
74 |
$this->getStreamWriter()->streamClose();
|
75 |
return $this;
|
app/code/community/Expertrec/Recommendation/controllers/Adminhtml/IndexController.php
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
-
// added support email
|
10 |
-
public function mailAction(){
|
11 |
-
return $this->_redirectUrl("mailto:support@expertrec.com?/");
|
12 |
-
}
|
13 |
-
}
|
14 |
?>
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
external links to magento.expertrec.com and support mail action in admin-panel dashboard
|
4 |
+
*/
|
5 |
+
class Expertrec_Recommendation_Adminhtml_IndexController extends Mage_Core_Controller_Front_Action
|
6 |
+
{
|
7 |
+
const MERCHANT_ID = 'expertrec/general/mid';
|
8 |
+
public function indexAction(){
|
9 |
+
$mid = Mage::getStoreConfig(self::MERCHANT_ID);
|
10 |
+
$url = 'https://magento.expertrec.com/home?mid='.$mid;
|
11 |
+
return $this->_redirectUrl($url);
|
12 |
+
}
|
13 |
+
// added support email
|
14 |
+
public function mailAction(){
|
15 |
+
return $this->_redirectUrl("mailto:support@expertrec.com?/");
|
16 |
+
}
|
17 |
}
|
|
|
|
|
|
|
|
|
|
|
18 |
?>
|
app/code/community/Expertrec/Recommendation/controllers/ApiController.php
CHANGED
@@ -27,8 +27,8 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
|
|
27 |
const PUSHED_FEED_PAGES = 'expertrec/general/expertrec_feed_pushed_pages';
|
28 |
|
29 |
|
30 |
-
const BUILD_NO = "
|
31 |
-
const EXPERTREC_VERSION = "1.2.
|
32 |
private $_password;
|
33 |
private $_websiteId = array();
|
34 |
private $_storeId = array();
|
@@ -510,8 +510,7 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
|
|
510 |
|
511 |
$textToStoreKeyMapArray = array("api"=>self::SEARCH_LIST_API,"facet_list"=>self::SEARCH_FACET_LIST,"single_select_filter"=>self::SEARCH_SINGLE_SELECT_FILTERS,"items_per_page"=>self::SEARCH_ITEMS_PER_PAGE,"display_pages"=>self::SEARCH_DISPLAY_PAGES);
|
512 |
|
513 |
-
$chekboxArray = array("search_enable"=>self::SEARCH_LIST_ENABLE,"fetch_price"=>self::SEARCH_FETCH_PRICE,"convert_price"=>self::SEARCH_CONVERT_PRICE,"is_ajax"=>self::SEARCH_IS_AJAX);
|
514 |
-
// ,"custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
|
515 |
|
516 |
// input
|
517 |
foreach ($textArray as $tKey => $tValue) {
|
27 |
const PUSHED_FEED_PAGES = 'expertrec/general/expertrec_feed_pushed_pages';
|
28 |
|
29 |
|
30 |
+
const BUILD_NO = "1492666192";
|
31 |
+
const EXPERTREC_VERSION = "1.2.12";
|
32 |
private $_password;
|
33 |
private $_websiteId = array();
|
34 |
private $_storeId = array();
|
510 |
|
511 |
$textToStoreKeyMapArray = array("api"=>self::SEARCH_LIST_API,"facet_list"=>self::SEARCH_FACET_LIST,"single_select_filter"=>self::SEARCH_SINGLE_SELECT_FILTERS,"items_per_page"=>self::SEARCH_ITEMS_PER_PAGE,"display_pages"=>self::SEARCH_DISPLAY_PAGES);
|
512 |
|
513 |
+
$chekboxArray = array("search_enable"=>self::SEARCH_LIST_ENABLE,"fetch_price"=>self::SEARCH_FETCH_PRICE,"convert_price"=>self::SEARCH_CONVERT_PRICE,"is_ajax"=>self::SEARCH_IS_AJAX,"custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
|
|
|
514 |
|
515 |
// input
|
516 |
foreach ($textArray as $tKey => $tValue) {
|
app/code/community/Expertrec/Recommendation/controllers/ConfigController.php
CHANGED
@@ -1,262 +1,220 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
$storedPwd = Mage::getModel('expertrec_recommendation/validate')->getPassword();
|
34 |
-
|
35 |
-
//if passwoed is not valid then it will not proceed
|
36 |
-
if($pwd != $storedPwd){
|
37 |
-
die("Authentication failed");
|
38 |
-
}
|
39 |
-
|
40 |
-
// $encoded_secret = base64_encode($secret);
|
41 |
-
|
42 |
-
//store mid and secret then clear cache
|
43 |
-
Mage::helper("expertrec_recommendation")
|
44 |
-
->saveConfig('secret',$secret)
|
45 |
-
->saveConfig('mid',$mid)
|
46 |
-
->clearCache();
|
47 |
-
|
48 |
-
// need to remove, we now no longer use cache.
|
49 |
-
//update config variable
|
50 |
-
$decoded_secret = base64_decode($secret);
|
51 |
-
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
|
52 |
-
->setSecret($decoded_secret)
|
53 |
-
->setMerchantId($mid);
|
54 |
-
|
55 |
-
die("Successfully updated mid and secret");
|
56 |
-
}catch(Exception $e){
|
57 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Updating mid & secret error: ".$e->getMessage());
|
58 |
-
die("Unable to configure mid and secret");
|
59 |
-
}
|
60 |
-
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
public function saveheadersAction(){
|
65 |
-
try{
|
66 |
-
$requestParams = Mage::app()->getRequest()->getParams();
|
67 |
-
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
68 |
-
// Check password. if invalid password, it will not proceed.
|
69 |
-
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
70 |
-
die('ERROR: The specified password is invalid.');
|
71 |
-
}
|
72 |
-
$attrArray = array();
|
73 |
-
if(isset($requestParams['selected_headers'])){
|
74 |
-
if(!empty($requestParams['check_list'])){
|
75 |
-
foreach($requestParams['check_list'] as $selected){
|
76 |
-
$attrArray[] = $selected;
|
77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
}
|
93 |
-
if(isset($requestParams['imageheight']) ? $requestParams['imageheight'] : ''){
|
94 |
-
$imageHeight = $requestParams['imageheight'];
|
95 |
-
// store image width and height
|
96 |
-
Mage::helper("expertrec_recommendation")
|
97 |
-
->saveConfig('expertrec_image_height',$imageHeight);
|
98 |
-
echo "Image Height updated</br>";
|
99 |
-
}
|
100 |
-
else{
|
101 |
-
Mage::helper("expertrec_recommendation")
|
102 |
-
->saveConfig('expertrec_image_height','');
|
103 |
-
echo "Not Updating Image Height</br>";
|
104 |
}
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
Mage::helper("expertrec_recommendation")
|
117 |
-
|
118 |
-
|
119 |
}
|
120 |
-
if(
|
121 |
-
$
|
122 |
-
|
|
|
|
|
123 |
Mage::helper("expertrec_recommendation")
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
else{
|
128 |
Mage::helper("expertrec_recommendation")
|
129 |
-
|
130 |
-
|
|
|
131 |
}
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
138 |
}
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
-
|
150 |
Mage::helper("expertrec_recommendation")
|
151 |
-
|
152 |
-
|
153 |
-
die("Successfully updated selected headers. Please close this tab and reload the info page.");
|
154 |
}
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
}
|
157 |
-
die("Invalid request");
|
158 |
-
}
|
159 |
-
catch(Exception $e){
|
160 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Updating feed header error: ".$e->getMessage());
|
161 |
-
die("Unable to update headers");
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
public function savefeedconfAction(){
|
166 |
-
try{
|
167 |
-
$requestParams = Mage::app()->getRequest()->getParams();
|
168 |
-
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
169 |
-
|
170 |
-
// Check password. if invalid password, it will not proceed.
|
171 |
-
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
172 |
-
die('ERROR: The specified password is invalid.');
|
173 |
-
}
|
174 |
-
|
175 |
-
$feedConfArray = array();
|
176 |
-
if(isset($requestParams['feed_conf'])){
|
177 |
-
$feedConfArray[self::FEED_LOG_ENDPOINT] = isset($requestParams['log_api']) ? $requestParams['log_api'] : '';
|
178 |
-
$feedConfArray[self::FEED_UPLOAD_ENDPOINT] = isset($requestParams['upload_api']) ? $requestParams['upload_api'] : '';
|
179 |
-
|
180 |
-
if(!empty($requestParams['upload_feed'])){
|
181 |
-
$feedConfArray["is_upload"] = "true";
|
182 |
-
}else{
|
183 |
-
$feedConfArray["is_upload"] = "false";
|
184 |
-
}
|
185 |
-
|
186 |
-
foreach ($feedConfArray as $sKey => $sValue) {
|
187 |
-
//storing search config
|
188 |
-
Mage::helper("expertrec_recommendation")
|
189 |
-
->saveConfig($sKey,$sValue);
|
190 |
-
}
|
191 |
-
|
192 |
-
//clear cache
|
193 |
-
Mage::helper("expertrec_recommendation")
|
194 |
-
->clearCache();
|
195 |
-
|
196 |
-
die("Successfully updated feed config. Please close this tab and reload the info page.");
|
197 |
-
}
|
198 |
-
|
199 |
-
die("Invalid request");
|
200 |
-
|
201 |
-
}catch(Exception $e){
|
202 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Updating feed config error: ".$e->getMessage());
|
203 |
-
die("Unable to update feed config");
|
204 |
-
}
|
205 |
-
}
|
206 |
-
|
207 |
-
public function savesearchAction(){
|
208 |
-
try{
|
209 |
-
$requestParams = Mage::app()->getRequest()->getParams();
|
210 |
-
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
211 |
-
|
212 |
-
// Check password. if invalid password, it will not proceed.
|
213 |
-
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
214 |
-
die('ERROR: The specified password is invalid.');
|
215 |
-
}
|
216 |
-
|
217 |
-
$searchConfArray = array();
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
}
|
245 |
-
|
246 |
-
//clear cache
|
247 |
-
Mage::helper("expertrec_recommendation")
|
248 |
-
->clearCache();
|
249 |
-
|
250 |
-
die("Successfully updated search config. Please close this tab and reload the info page.");
|
251 |
-
}
|
252 |
-
|
253 |
-
die("Invalid request");
|
254 |
-
|
255 |
-
}catch(Exception $e){
|
256 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Updating search config error: ".$e->getMessage());
|
257 |
-
die("Unable to update search config");
|
258 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
-
|
261 |
-
}
|
262 |
-
?>
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
editAction as api to magento-signon to getmid and secret,
|
4 |
+
saves header,feed and search configuration in db.
|
5 |
+
*/
|
6 |
+
class Expertrec_Recommendation_ConfigController extends Mage_Core_Controller_Front_Action {
|
7 |
+
const SEARCH_LIST_ENABLE = 'search/enable';
|
8 |
+
const SEARCH_LIST_API = 'search/api';
|
9 |
+
const SEARCH_FACET_LIST = 'search/facets_list';
|
10 |
+
const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
|
11 |
+
const SEARCH_IS_AJAX = 'search/is_ajax';
|
12 |
+
const SEARCH_ITEMS_PER_PAGE = 'search/items_per_page';
|
13 |
+
const SEARCH_DISPLAY_PAGES = 'search/display_pages';
|
14 |
+
const SEARCH_FETCH_PRICE = 'search/fetch_price';
|
15 |
+
const SEARCH_CONVERT_PRICE = 'search/convert_price';
|
16 |
+
const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
|
17 |
+
const FEED_LOG_ENDPOINT = 'log_endpoint';
|
18 |
+
const FEED_UPLOAD_ENDPOINT = 'upload_endpoint';
|
19 |
+
|
20 |
+
// return websites and stores information
|
21 |
+
public function editAction(){
|
22 |
+
try{
|
23 |
+
//return array of all parameters sent
|
24 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
25 |
+
// Get parameters from the requestParams array
|
26 |
+
$mid = isset($requestParams['mid']) ? $requestParams['mid'] : '';
|
27 |
+
$secret = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
28 |
+
$pwd = isset($requestParams['pwd']) ? $requestParams['pwd'] : '';
|
29 |
+
if(empty($mid) || empty($secret) || empty($pwd)){
|
30 |
+
die("Invalid parameters given.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
+
$storedPwd = Mage::getModel('expertrec_recommendation/validate')->getPassword();
|
33 |
+
//if passwoed is not valid then it will not proceed
|
34 |
+
if($pwd != $storedPwd){
|
35 |
+
die("Authentication failed");
|
36 |
+
}
|
37 |
+
//store mid and secret then clear cache
|
38 |
+
Mage::helper("expertrec_recommendation")
|
39 |
+
->saveConfig('secret',$secret)
|
40 |
+
->saveConfig('mid',$mid)
|
41 |
+
->clearCache();
|
42 |
+
// need to remove, we now no longer use cache.
|
43 |
+
//update config variable
|
44 |
+
$decoded_secret = base64_decode($secret);
|
45 |
+
Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
|
46 |
+
->setSecret($decoded_secret)
|
47 |
+
->setMerchantId($mid);
|
48 |
+
die("Successfully updated mid and secret");
|
49 |
+
}catch(Exception $e){
|
50 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Updating mid & secret error: ".$e->getMessage());
|
51 |
+
die("Unable to configure mid and secret");
|
52 |
+
}
|
53 |
+
}
|
54 |
|
55 |
+
public function saveheadersAction(){
|
56 |
+
try{
|
57 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
58 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
59 |
+
// Check password. if invalid password, it will not proceed.
|
60 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
61 |
+
die('ERROR: The specified password is invalid.');
|
62 |
+
}
|
63 |
+
$attrArray = array();
|
64 |
+
if(isset($requestParams['selected_headers'])){
|
65 |
+
if(!empty($requestParams['check_list'])){
|
66 |
+
foreach($requestParams['check_list'] as $selected){
|
67 |
+
$attrArray[] = $selected;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
+
if(count($attrArray) > 0){
|
70 |
+
// check for field expert_image
|
71 |
+
if(in_array("expert_image", $attrArray)){
|
72 |
+
if(isset($requestParams['imagewidth']) ? $requestParams['imagewidth'] : ''){
|
73 |
+
$imageWidth = $requestParams['imagewidth'];
|
74 |
+
Mage::helper("expertrec_recommendation")
|
75 |
+
->saveConfig('expertrec_image_width',$imageWidth);
|
76 |
+
echo "Image Width updated</br>";
|
77 |
+
}else{
|
78 |
+
Mage::helper("expertrec_recommendation")
|
79 |
+
->saveConfig('expertrec_image_width','');
|
80 |
+
echo "Not Updating Image Width</br>";
|
81 |
+
}
|
82 |
+
if(isset($requestParams['imageheight']) ? $requestParams['imageheight'] : ''){
|
83 |
+
$imageHeight = $requestParams['imageheight'];
|
84 |
+
// store image width and height
|
85 |
+
Mage::helper("expertrec_recommendation")
|
86 |
+
->saveConfig('expertrec_image_height',$imageHeight);
|
87 |
+
echo "Image Height updated</br>";
|
88 |
+
}else{
|
89 |
+
Mage::helper("expertrec_recommendation")
|
90 |
+
->saveConfig('expertrec_image_height','');
|
91 |
+
echo "Not Updating Image Height</br>";
|
92 |
+
}
|
93 |
}
|
94 |
+
// check for field expert_thumbnail
|
95 |
+
if(in_array("expert_thumbnail", $attrArray)){
|
96 |
+
if(isset($requestParams['thumbnailwidth']) ? $requestParams['thumbnailwidth'] : ''){
|
97 |
+
$thumbnailWidth = $requestParams['thumbnailwidth'];
|
98 |
+
Mage::helper("expertrec_recommendation")
|
99 |
+
->saveConfig('expertrec_thumbnail_width',$thumbnailWidth);
|
100 |
+
echo "Thumbnail Width updated</br>";
|
101 |
+
}else{
|
102 |
+
Mage::helper("expertrec_recommendation")
|
103 |
+
->saveConfig('expertrec_thumbnail_width','');
|
104 |
+
echo "Not Updating Thumbnail Width</br>";
|
105 |
+
}
|
106 |
+
if(isset($requestParams['thumbnailheight']) ? $requestParams['thumbnailheight'] : ''){
|
107 |
+
$thumbnailHeight = $requestParams['thumbnailheight'];
|
108 |
+
// store thumbnail width and height
|
109 |
+
Mage::helper("expertrec_recommendation")
|
110 |
+
->saveConfig('expertrec_thumbnail_height',$thumbnailHeight);
|
111 |
+
echo "Thumbnail Height updated</br>";
|
112 |
+
}else{
|
113 |
+
Mage::helper("expertrec_recommendation")
|
114 |
+
->saveConfig('expertrec_thumbnail_height','');
|
115 |
+
echo "Not Updating Thumbnail Height</br>";
|
116 |
+
}
|
117 |
+
}
|
118 |
+
//store headers then clear cache
|
119 |
Mage::helper("expertrec_recommendation")
|
120 |
+
->saveConfig('headers',implode(',', $attrArray))
|
121 |
+
->clearCache();
|
122 |
}
|
123 |
+
if(!empty($requestParams['filter_check_list'])){
|
124 |
+
foreach($requestParams['filter_check_list'] as $selected){
|
125 |
+
$filterArray[] = $selected;
|
126 |
+
}
|
127 |
+
//store headers then clear cache
|
128 |
Mage::helper("expertrec_recommendation")
|
129 |
+
->saveConfig('filters',implode(',', $filterArray))
|
130 |
+
->clearCache();
|
131 |
+
die("Successfully updated selected headers and filters. Please close this tab and reload the info page.");
|
132 |
+
}else{
|
133 |
Mage::helper("expertrec_recommendation")
|
134 |
+
->saveConfig('filters','')
|
135 |
+
->clearCache();
|
136 |
+
die("Successfully updated selected headers. Please close this tab and reload the info page.");
|
137 |
}
|
138 |
}
|
139 |
+
}
|
140 |
+
die("Invalid request");
|
141 |
+
}
|
142 |
+
catch(Exception $e){
|
143 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Updating feed header error: ".$e->getMessage());
|
144 |
+
die("Unable to update headers");
|
145 |
+
}
|
146 |
+
}
|
147 |
|
148 |
+
public function savefeedconfAction(){
|
149 |
+
try{
|
150 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
151 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
152 |
+
// Check password. if invalid password, it will not proceed.
|
153 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
154 |
+
die('ERROR: The specified password is invalid.');
|
155 |
}
|
156 |
+
$feedConfArray = array();
|
157 |
+
if(isset($requestParams['feed_conf'])){
|
158 |
+
$feedConfArray[self::FEED_LOG_ENDPOINT] = isset($requestParams['log_api']) ? $requestParams['log_api'] : '';
|
159 |
+
$feedConfArray[self::FEED_UPLOAD_ENDPOINT] = isset($requestParams['upload_api']) ? $requestParams['upload_api'] : '';
|
160 |
+
if(!empty($requestParams['upload_feed'])){
|
161 |
+
$feedConfArray["is_upload"] = "true";
|
162 |
+
}else{
|
163 |
+
$feedConfArray["is_upload"] = "false";
|
164 |
+
}
|
165 |
+
foreach ($feedConfArray as $sKey => $sValue) {
|
166 |
+
//storing search config
|
167 |
+
Mage::helper("expertrec_recommendation")
|
168 |
+
->saveConfig($sKey,$sValue);
|
169 |
}
|
170 |
+
//clear cache
|
171 |
Mage::helper("expertrec_recommendation")
|
172 |
+
->clearCache();
|
173 |
+
die("Successfully updated feed config. Please close this tab and reload the info page.");
|
|
|
174 |
}
|
175 |
+
die("Invalid request");
|
176 |
+
}catch(Exception $e){
|
177 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Updating feed config error: ".$e->getMessage());
|
178 |
+
die("Unable to update feed config");
|
179 |
}
|
180 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
public function savesearchAction(){
|
183 |
+
try{
|
184 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
185 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
186 |
+
// Check password. if invalid password, it will not proceed.
|
187 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
188 |
+
die('ERROR: The specified password is invalid.');
|
189 |
+
}
|
190 |
+
$searchConfArray = array();
|
191 |
+
if(isset($requestParams['selected_search'])){
|
192 |
+
$searchConfArray[self::SEARCH_LIST_API] = isset($requestParams['api'])?$requestParams['api']:'';
|
193 |
+
$searchConfArray[self::SEARCH_FACET_LIST] = isset($requestParams['facet_list']) ? $requestParams['facet_list'] : '';
|
194 |
+
$searchConfArray[self::SEARCH_SINGLE_SELECT_FILTERS] = isset($requestParams['single_select_filter']) ? $requestParams['single_select_filter'] : '';
|
195 |
+
$searchConfArray[self::SEARCH_ITEMS_PER_PAGE] = isset($requestParams['items_per_page']) ? $requestParams['items_per_page'] : '';
|
196 |
+
$searchConfArray[self::SEARCH_DISPLAY_PAGES] = isset($requestParams['display_pages']) ? $requestParams['display_pages'] : '';
|
197 |
+
$searchCheckedList = isset($requestParams['search_check_list']) ? $requestParams['search_check_list'] : array();
|
198 |
+
$searchConfArray[self::SEARCH_LIST_ENABLE] = in_array("search_enable", $searchCheckedList) ? "true" : "false";
|
199 |
+
$searchConfArray[self::SEARCH_FETCH_PRICE] = in_array("fetch_price", $searchCheckedList) ? "true" : "false";
|
200 |
+
$searchConfArray[self::SEARCH_CONVERT_PRICE] = in_array("convert_price", $searchCheckedList) ? "true" : "false";
|
201 |
+
$searchConfArray[self::SEARCH_IS_AJAX] = in_array("is_ajax", $searchCheckedList) ? "true" : "false";
|
202 |
+
$searchConfArray[self::SEARCH_CUSTOM_TEMPLATE] = in_array("custom_template", $searchCheckedList) ? "true" : "false";
|
203 |
+
foreach ($searchConfArray as $sKey => $sValue) {
|
204 |
+
//storing search config
|
205 |
+
Mage::helper("expertrec_recommendation")
|
206 |
+
->saveConfig($sKey,$sValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
+
//clear cache
|
209 |
+
Mage::helper("expertrec_recommendation")
|
210 |
+
->clearCache();
|
211 |
+
die("Successfully updated search config. Please close this tab and reload the info page.");
|
212 |
+
}
|
213 |
+
die("Invalid request");
|
214 |
+
}catch(Exception $e){
|
215 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Updating search config error: ".$e->getMessage());
|
216 |
+
die("Unable to update search config");
|
217 |
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
?>
|
app/code/community/Expertrec/Recommendation/controllers/IndexController.php
CHANGED
@@ -1,209 +1,178 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
2 |
class Expertrec_Recommendation_IndexController extends Mage_Core_Controller_Front_Action{
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$this->runMain(true);
|
35 |
-
|
36 |
-
}else{
|
37 |
-
$this->runMain();
|
38 |
-
}
|
39 |
-
|
40 |
-
}catch (Exception $e) {
|
41 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while preparing the main appilication: ".$e->getMessage());
|
42 |
-
}
|
43 |
-
}
|
44 |
-
public function cleanAction(){
|
45 |
-
try{
|
46 |
-
//return array of all parameters sent
|
47 |
-
$requestParams = Mage::app()->getRequest()->getParams();
|
48 |
-
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
49 |
-
|
50 |
-
// Check password. if invalid password, it will not proceed.
|
51 |
-
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
52 |
-
die('ERROR: The specified password is invalid.');
|
53 |
-
}
|
54 |
-
|
55 |
-
$vFeedDir = "/tmp".self::FEED_PATH;
|
56 |
-
|
57 |
-
//delete all files in Expertrec
|
58 |
-
Mage::helper('expertrec_recommendation/filehelper')->cleanDir($vFeedDir);
|
59 |
-
|
60 |
-
die("successfully deleted all files.");
|
61 |
-
|
62 |
-
}catch (Exception $e) {
|
63 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while cleaning Expertrec feed dir: ".$e->getMessage());
|
64 |
-
}
|
65 |
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
//base Directory path
|
78 |
-
$logPath = "/tmp".self::FEED_PATH."/expertrec_feed.log";
|
79 |
-
$this->downloadFile($logPath);
|
80 |
-
return;
|
81 |
-
}catch (Exception $e) {
|
82 |
-
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while getting log file: ".$e->getMessage());
|
83 |
-
die('ERROR: Unable to download log file.');
|
84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
// Check password. if invalid password, it will not proceed.
|
106 |
-
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
107 |
-
die('ERROR: The specified password is invalid.');
|
108 |
-
}
|
109 |
-
|
110 |
-
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
111 |
-
|
112 |
-
|
113 |
-
// if website_id and store_id are not given in the request then retuen with error message
|
114 |
-
if(empty($storeId) && empty($websiteId)){
|
115 |
-
die("ERROR: Blank website_id and store_id are not alowed. Edit this request and set website_id and store_id.");
|
116 |
-
}else{
|
117 |
-
$feedConfig
|
118 |
-
->setWebsiteId($websiteId)
|
119 |
-
->setStoreId($storeId);
|
120 |
-
}
|
121 |
-
|
122 |
-
|
123 |
-
//Limiting feed collection in one request
|
124 |
-
if(!empty($pageStart) && !empty($pageEnd)){
|
125 |
-
$feedConfig->setPageStart($pageStart)
|
126 |
-
->setPageEnd($pageEnd);
|
127 |
-
}
|
128 |
-
|
129 |
-
//Limiting number of products in a page during feed collection
|
130 |
-
if(!empty($pageSize)){
|
131 |
-
$feedConfig->setPageSize($pageSize);
|
132 |
-
}
|
133 |
-
|
134 |
-
// check whether the image is to generate or not
|
135 |
-
if(!empty($imageWidth) && !empty($imageHeight)){
|
136 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("setting Image width and height.");
|
137 |
-
$feedConfig
|
138 |
-
->setGenerateImage(true)
|
139 |
-
->setImageHeight($imageHeight)
|
140 |
-
->setImageWidth($imageWidth);
|
141 |
-
}else{
|
142 |
-
$feedConfig->setGenerateImage(false);
|
143 |
-
}
|
144 |
-
|
145 |
-
// If the command is export, then run the native export
|
146 |
-
if($Command == 'export'){
|
147 |
-
if(!Mage::getModel('expertrec_recommendation/feed')->exportFeeds()){
|
148 |
-
die("Error: Feed not created. Please try again after some time.");
|
149 |
-
}
|
150 |
-
|
151 |
-
}else if($Command == 'getpp'){
|
152 |
-
if(!Mage::helper('expertrec_recommendation/suggestionhelper')->exportPopularProducts()){
|
153 |
-
die("Error: Popolar products feed not created. Please try again after some time.");
|
154 |
-
}
|
155 |
-
}else{
|
156 |
-
die("The requested URL /expertrec-feed/ was not found on this server.");
|
157 |
-
}
|
158 |
-
|
159 |
-
$feedFilePath=$feedConfig->feedFilePath;
|
160 |
-
|
161 |
-
if($upload){
|
162 |
-
Mage::helper('expertrec_recommendation')->pushFeed($feedFilePath);
|
163 |
-
}else{
|
164 |
-
$this->downloadFile($feedFilePath,true);
|
165 |
-
}
|
166 |
-
return;
|
167 |
-
}catch(Exception $e){
|
168 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error: Entry point error: ".$e->getMessage());
|
169 |
-
}
|
170 |
}
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
die("File downloaded successfully.");
|
200 |
-
} else {
|
201 |
-
die("Error: File not found.");
|
202 |
-
}
|
203 |
-
}catch(Exception $e){
|
204 |
-
Mage::getSingleton('expertrec_recommendation/log')->log("Error: returning feed error: ".$e->getMessage());
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
}
|
209 |
-
?>
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
Get feed manually from info page
|
4 |
+
*/
|
5 |
class Expertrec_Recommendation_IndexController extends Mage_Core_Controller_Front_Action{
|
6 |
+
const FEED_PATH = '/Expertrec';
|
7 |
+
const IS_UPLOAD_FEED = 'expertrec/general/is_upload';
|
8 |
+
|
9 |
+
public function indexAction (){
|
10 |
+
try{
|
11 |
+
//Increase memory limit
|
12 |
+
ini_set('memory_limit', '1024M');
|
13 |
+
//Increase maximum execution time to 5 hours (default in magento)
|
14 |
+
set_time_limit(18000);
|
15 |
+
// Run main application
|
16 |
+
$isUpload = Mage::getStoreConfig(self::IS_UPLOAD_FEED);
|
17 |
+
if(isset($isUpload) && $isUpload == 'true'){
|
18 |
+
ob_end_clean();
|
19 |
+
//avoid apache to kill the php running
|
20 |
+
ignore_user_abort(true);
|
21 |
+
ob_start();//start buffer output
|
22 |
+
echo "Feed generation started in background.";
|
23 |
+
//close session file on server side to avoid blocking other requests
|
24 |
+
session_write_close();
|
25 |
+
//send header to avoid the browser side to take content as gzip format
|
26 |
+
header("Content-Encoding: none");
|
27 |
+
header("Content-Length: ".ob_get_length());
|
28 |
+
header("Connection: close");
|
29 |
+
ob_end_flush();
|
30 |
+
flush();
|
31 |
+
$this->runMain(true);
|
32 |
+
}else{
|
33 |
+
$this->runMain();
|
34 |
+
}
|
35 |
+
}catch (Exception $e) {
|
36 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while preparing the main appilication: ".$e->getMessage());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function cleanAction(){
|
41 |
+
try{
|
42 |
+
//return array of all parameters sent
|
43 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
44 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
45 |
+
// Check password. if invalid password, it will not proceed.
|
46 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
47 |
+
die('ERROR: The specified password is invalid.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
+
$vFeedDir = "/tmp".self::FEED_PATH;
|
50 |
+
//delete all files in Expertrec
|
51 |
+
Mage::helper('expertrec_recommendation/filehelper')->cleanDir($vFeedDir);
|
52 |
+
die("successfully deleted all files.");
|
53 |
+
}catch (Exception $e) {
|
54 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while cleaning Expertrec feed dir: ".$e->getMessage());
|
55 |
}
|
56 |
+
}
|
57 |
+
|
58 |
+
public function getlogAction(){
|
59 |
+
try{
|
60 |
+
//return array of all parameters sent
|
61 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
62 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
63 |
+
// Check password. if invalid password, it will not proceed.
|
64 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
65 |
+
die('ERROR: The specified password is invalid.');
|
66 |
+
}
|
67 |
+
//base Directory path
|
68 |
+
$logPath = "/tmp".self::FEED_PATH."/expertrec_feed.log";
|
69 |
+
$this->downloadFile($logPath);
|
70 |
+
return;
|
71 |
+
}catch (Exception $e) {
|
72 |
+
Mage::getSingleton('expertrec_recommendation/log')->log( "Exception while getting log file: ".$e->getMessage());
|
73 |
+
die('ERROR: Unable to download log file.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
+
}
|
76 |
+
|
77 |
+
private function runMain($upload = false){
|
78 |
+
try{
|
79 |
+
//return array of all parameters sent
|
80 |
+
$requestParams = Mage::app()->getRequest()->getParams();
|
81 |
+
// Get parameters from the requestParams array
|
82 |
+
$Command = isset($requestParams['cmd']) ? $requestParams['cmd'] : '';
|
83 |
+
$Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
|
84 |
+
$imageWidth = isset($requestParams['width']) ? $requestParams['width'] : '';
|
85 |
+
$imageHeight = isset($requestParams['height']) ? $requestParams['height'] : '';
|
86 |
+
$storeId = isset($requestParams['sid']) ? $requestParams['sid'] : '';
|
87 |
+
$websiteId = isset($requestParams['wid']) ? $requestParams['wid'] : '';
|
88 |
+
$pageStart = isset($requestParams['ps']) ? $requestParams['ps'] : '';
|
89 |
+
$pageEnd = isset($requestParams['pe']) ? $requestParams['pe'] : '';
|
90 |
+
$pageSize = isset($requestParams['psize']) ? $requestParams['psize'] : '';
|
91 |
+
// Check password. if invalid password, it will not proceed.
|
92 |
+
if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
|
93 |
+
die('ERROR: The specified password is invalid.');
|
94 |
+
}
|
95 |
+
$feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
|
96 |
+
// if website_id and store_id are not given in the request then retuen with error message
|
97 |
+
if(empty($storeId) && empty($websiteId)){
|
98 |
+
die("ERROR: Blank website_id and store_id are not alowed. Edit this request and set website_id and store_id.");
|
99 |
+
}else{
|
100 |
+
$feedConfig
|
101 |
+
->setWebsiteId($websiteId)
|
102 |
+
->setStoreId($storeId);
|
103 |
+
}
|
104 |
+
//Limiting feed collection in one request
|
105 |
+
if(!empty($pageStart) && !empty($pageEnd)){
|
106 |
+
$feedConfig->setPageStart($pageStart)
|
107 |
+
->setPageEnd($pageEnd);
|
108 |
+
}
|
109 |
+
//Limiting number of products in a page during feed collection
|
110 |
+
if(!empty($pageSize)){
|
111 |
+
$feedConfig->setPageSize($pageSize);
|
112 |
+
}
|
113 |
+
// check whether the image is to generate or not
|
114 |
+
if(!empty($imageWidth) && !empty($imageHeight)){
|
115 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("setting Image width and height.");
|
116 |
+
$feedConfig
|
117 |
+
->setGenerateImage(true)
|
118 |
+
->setImageHeight($imageHeight)
|
119 |
+
->setImageWidth($imageWidth);
|
120 |
+
}else{
|
121 |
+
$feedConfig->setGenerateImage(false);
|
122 |
+
}
|
123 |
+
// If the command is export, then run the native export
|
124 |
+
if($Command == 'export'){
|
125 |
+
if(!Mage::getModel('expertrec_recommendation/feed')->exportFeeds()){
|
126 |
+
die("Error: Feed not created. Please try again after some time.");
|
127 |
+
}
|
128 |
+
}else if($Command == 'getpp'){
|
129 |
+
if(!Mage::helper('expertrec_recommendation/suggestionhelper')->exportPopularProducts()){
|
130 |
+
die("Error: Popolar products feed not created. Please try again after some time.");
|
131 |
+
}
|
132 |
+
}else{
|
133 |
+
die("The requested URL /expertrec-feed/ was not found on this server.");
|
134 |
+
}
|
135 |
+
$feedFilePath=$feedConfig->feedFilePath;
|
136 |
+
if($upload){
|
137 |
+
Mage::helper('expertrec_recommendation')->pushFeed($feedFilePath);
|
138 |
+
}else{
|
139 |
+
$this->downloadFile($feedFilePath,true);
|
140 |
+
}
|
141 |
+
return;
|
142 |
+
}catch(Exception $e){
|
143 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error: Entry point error: ".$e->getMessage());
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
private function downloadFile($attachment_location,$delete = false){
|
148 |
+
try{
|
149 |
+
$fileName = substr($attachment_location, strrpos($attachment_location, '/') + 1);
|
150 |
+
if (file_exists($attachment_location)) {
|
151 |
+
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
|
152 |
+
header('Expires: 0');
|
153 |
+
header('Cache-Control: must-revalidate, post-check=0,pre-check=0');
|
154 |
+
header('Content-Description: File Transfer');
|
155 |
+
header("Content-Type: application/octet-stream");
|
156 |
+
header('Pragma: public');
|
157 |
+
header("Content-Length:".filesize($attachment_location));
|
158 |
+
header("Content-Disposition: attachment; filename=".$fileName);
|
159 |
+
//header is set, so clear the output buffer before downloading file
|
160 |
+
ob_clean();
|
161 |
+
flush();
|
162 |
+
//download file
|
163 |
+
readfile($attachment_location);
|
164 |
+
if($delete){
|
165 |
+
//deleting file
|
166 |
+
Mage::helper('expertrec_recommendation/filehelper')->deleteFile($attachment_location);
|
167 |
+
}
|
168 |
+
die("File downloaded successfully.");
|
169 |
+
} else {
|
170 |
+
die("Error: File not found.");
|
171 |
+
}
|
172 |
+
}catch(Exception $e){
|
173 |
+
Mage::getSingleton('expertrec_recommendation/log')->log("Error: returning feed error: ".$e->getMessage());
|
174 |
+
}
|
175 |
+
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
178 |
+
?>
|
app/code/community/Expertrec/Recommendation/etc/adminhtml.xml
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<menu>
|
|
|
|
|
|
|
|
|
4 |
<expertrec translate="title" module="expertrec_recommendation">
|
5 |
<title>Expertrec</title>
|
6 |
<sort_order>99</sort_order>
|
@@ -10,19 +14,17 @@
|
|
10 |
<sort_order>10</sort_order>
|
11 |
<action>expertrec-signup</action>
|
12 |
</expertrec>
|
13 |
-
<!-- added user upload feed -->
|
14 |
<feed translate="title">
|
15 |
<title>Upload Feed</title>
|
16 |
<sort_order>15</sort_order>
|
17 |
<action>expertrec_recommendation/api/feed</action>
|
18 |
</feed>
|
19 |
-
<!-- added support mail -->
|
20 |
<support translate="title">
|
21 |
-
<title>
|
22 |
<sort_order>90</sort_order>
|
23 |
<action>expertrec-signup/index/mail</action>
|
24 |
</support>
|
25 |
</children>
|
26 |
</expertrec>
|
27 |
</menu>
|
28 |
-
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<menu>
|
4 |
+
<!--
|
5 |
+
Added admin-panel DropDown as Expertrec with magento.expertrec.com,
|
6 |
+
upload feed,support mail links.
|
7 |
+
-->
|
8 |
<expertrec translate="title" module="expertrec_recommendation">
|
9 |
<title>Expertrec</title>
|
10 |
<sort_order>99</sort_order>
|
14 |
<sort_order>10</sort_order>
|
15 |
<action>expertrec-signup</action>
|
16 |
</expertrec>
|
|
|
17 |
<feed translate="title">
|
18 |
<title>Upload Feed</title>
|
19 |
<sort_order>15</sort_order>
|
20 |
<action>expertrec_recommendation/api/feed</action>
|
21 |
</feed>
|
|
|
22 |
<support translate="title">
|
23 |
+
<title>support@expertrec.com</title>
|
24 |
<sort_order>90</sort_order>
|
25 |
<action>expertrec-signup/index/mail</action>
|
26 |
</support>
|
27 |
</children>
|
28 |
</expertrec>
|
29 |
</menu>
|
30 |
+
</config>
|
app/code/community/Expertrec/Recommendation/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Expertrec_Recommendation>
|
5 |
-
<version>1.2.
|
6 |
</Expertrec_Recommendation>
|
7 |
</modules>
|
8 |
<global>
|
@@ -29,33 +29,18 @@
|
|
29 |
</expertrec_setup>
|
30 |
</resources>
|
31 |
<events>
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
<method>trackAddToCart</method>
|
38 |
-
</expertrec_recommendation_track_addtocart>
|
39 |
-
</observers>
|
40 |
-
</checkout_cart_product_add_after>
|
41 |
-
<sales_order_payment_place_end>
|
42 |
-
<observers>
|
43 |
-
<expertrec_recommendation_track_order>
|
44 |
-
<type>singleton</type>
|
45 |
-
<class>expertrec_recommendation/observer</class>
|
46 |
-
<method>trackOrder</method>
|
47 |
-
</expertrec_recommendation_track_order>
|
48 |
-
</observers>
|
49 |
-
</sales_order_payment_place_end>
|
50 |
-
<sales_quote_remove_item>
|
51 |
<observers>
|
52 |
-
<
|
53 |
-
<type>singleton</type>
|
54 |
<class>expertrec_recommendation/observer</class>
|
55 |
-
<method>
|
56 |
-
</
|
57 |
</observers>
|
58 |
-
</
|
59 |
<catalog_product_delete_before>
|
60 |
<observers>
|
61 |
<expertrec_recommendation_track_delete>
|
@@ -65,15 +50,6 @@
|
|
65 |
</expertrec_recommendation_track_delete>
|
66 |
</observers>
|
67 |
</catalog_product_delete_before>
|
68 |
-
<catalog_product_save_commit_after>
|
69 |
-
<observers>
|
70 |
-
<expertrec_recommendation_stockupdate>
|
71 |
-
<class>expertrec_recommendation/observer</class>
|
72 |
-
<method>saveProduct</method>
|
73 |
-
</expertrec_recommendation_stockupdate>
|
74 |
-
</observers>
|
75 |
-
</catalog_product_save_commit_after>
|
76 |
-
<!-- Hook on New Category and Category Edit -->
|
77 |
<catalog_category_save_commit_after>
|
78 |
<observers>
|
79 |
<expertrec_recommendation_save_category>
|
@@ -83,8 +59,7 @@
|
|
83 |
</expertrec_recommendation_save_category>
|
84 |
</observers>
|
85 |
</catalog_category_save_commit_after>
|
86 |
-
<!--
|
87 |
-
<catalog_controller_product_view>
|
88 |
<observers>
|
89 |
<itemsviewed>
|
90 |
<type>model</type>
|
@@ -92,8 +67,7 @@
|
|
92 |
<method>saveProductVisitHistory</method>
|
93 |
</itemsviewed>
|
94 |
</observers>
|
95 |
-
</catalog_controller_product_view>
|
96 |
-
<!-- Hook for adding wishlist -->
|
97 |
<wishlist_product_add_after>
|
98 |
<observers>
|
99 |
<expertrec_recommendation_add_wishlist>
|
@@ -103,7 +77,33 @@
|
|
103 |
</expertrec_recommendation_add_wishlist>
|
104 |
</observers>
|
105 |
</wishlist_product_add_after>
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
<cataloginventory_stock_item_save_after>
|
108 |
<observers>
|
109 |
<expertrec_recommendation_save_category>
|
@@ -137,8 +137,7 @@
|
|
137 |
<module>Expertrec_Recommendation_Adminhtml</module>
|
138 |
<frontName>expertrec-signup</frontName>
|
139 |
</args>
|
140 |
-
</expertrec-signup>
|
141 |
-
<!-- added support email -->
|
142 |
<expertrec>
|
143 |
<use>standard</use>
|
144 |
<args>
|
@@ -161,7 +160,6 @@
|
|
161 |
</controller_action_layout_load_before>
|
162 |
</events>
|
163 |
</frontend>
|
164 |
-
<!-- added template for admin-notification -->
|
165 |
<adminhtml>
|
166 |
<layout>
|
167 |
<updates>
|
@@ -171,5 +169,4 @@
|
|
171 |
</updates>
|
172 |
</layout>
|
173 |
</adminhtml>
|
174 |
-
|
175 |
-
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Expertrec_Recommendation>
|
5 |
+
<version>1.2.12</version>
|
6 |
</Expertrec_Recommendation>
|
7 |
</modules>
|
8 |
<global>
|
29 |
</expertrec_setup>
|
30 |
</resources>
|
31 |
<events>
|
32 |
+
<!--
|
33 |
+
Added Hook for save_product,delete_product,save_category,view_product,
|
34 |
+
add_to_wishlist,add_to_cart,remove_from_cart,place_order,sale_went_out_of_stock
|
35 |
+
-->
|
36 |
+
<catalog_product_save_commit_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
<observers>
|
38 |
+
<expertrec_recommendation_stockupdate>
|
|
|
39 |
<class>expertrec_recommendation/observer</class>
|
40 |
+
<method>saveProduct</method>
|
41 |
+
</expertrec_recommendation_stockupdate>
|
42 |
</observers>
|
43 |
+
</catalog_product_save_commit_after>
|
44 |
<catalog_product_delete_before>
|
45 |
<observers>
|
46 |
<expertrec_recommendation_track_delete>
|
50 |
</expertrec_recommendation_track_delete>
|
51 |
</observers>
|
52 |
</catalog_product_delete_before>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
<catalog_category_save_commit_after>
|
54 |
<observers>
|
55 |
<expertrec_recommendation_save_category>
|
59 |
</expertrec_recommendation_save_category>
|
60 |
</observers>
|
61 |
</catalog_category_save_commit_after>
|
62 |
+
<!-- <catalog_controller_product_view>
|
|
|
63 |
<observers>
|
64 |
<itemsviewed>
|
65 |
<type>model</type>
|
67 |
<method>saveProductVisitHistory</method>
|
68 |
</itemsviewed>
|
69 |
</observers>
|
70 |
+
</catalog_controller_product_view> -->
|
|
|
71 |
<wishlist_product_add_after>
|
72 |
<observers>
|
73 |
<expertrec_recommendation_add_wishlist>
|
77 |
</expertrec_recommendation_add_wishlist>
|
78 |
</observers>
|
79 |
</wishlist_product_add_after>
|
80 |
+
<checkout_cart_product_add_after>
|
81 |
+
<observers>
|
82 |
+
<expertrec_recommendation_track_addtocart>
|
83 |
+
<type>singleton</type>
|
84 |
+
<class>expertrec_recommendation/observer</class>
|
85 |
+
<method>trackAddToCart</method>
|
86 |
+
</expertrec_recommendation_track_addtocart>
|
87 |
+
</observers>
|
88 |
+
</checkout_cart_product_add_after>
|
89 |
+
<sales_quote_remove_item>
|
90 |
+
<observers>
|
91 |
+
<expertrec_recommendation_track_remove_item>
|
92 |
+
<type>singleton</type>
|
93 |
+
<class>expertrec_recommendation/observer</class>
|
94 |
+
<method>trackRemoveItem</method>
|
95 |
+
</expertrec_recommendation_track_remove_item>
|
96 |
+
</observers>
|
97 |
+
</sales_quote_remove_item>
|
98 |
+
<sales_order_payment_place_end>
|
99 |
+
<observers>
|
100 |
+
<expertrec_recommendation_track_order>
|
101 |
+
<type>singleton</type>
|
102 |
+
<class>expertrec_recommendation/observer</class>
|
103 |
+
<method>trackOrder</method>
|
104 |
+
</expertrec_recommendation_track_order>
|
105 |
+
</observers>
|
106 |
+
</sales_order_payment_place_end>
|
107 |
<cataloginventory_stock_item_save_after>
|
108 |
<observers>
|
109 |
<expertrec_recommendation_save_category>
|
137 |
<module>Expertrec_Recommendation_Adminhtml</module>
|
138 |
<frontName>expertrec-signup</frontName>
|
139 |
</args>
|
140 |
+
</expertrec-signup>
|
|
|
141 |
<expertrec>
|
142 |
<use>standard</use>
|
143 |
<args>
|
160 |
</controller_action_layout_load_before>
|
161 |
</events>
|
162 |
</frontend>
|
|
|
163 |
<adminhtml>
|
164 |
<layout>
|
165 |
<updates>
|
169 |
</updates>
|
170 |
</layout>
|
171 |
</adminhtml>
|
172 |
+
</config>
|
|
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.2.11.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
//echo 'Installing extension: '.get_class($this)."\n <br /> \n";
|
4 |
-
// Mage::log("Installing magento : 1.2.2");
|
5 |
-
|
6 |
-
$installer = $this;
|
7 |
-
$mage_ver = Mage::getVersion();
|
8 |
-
$php_ver = phpversion();
|
9 |
-
$host = $_SERVER['HTTP_HOST'];
|
10 |
-
$uri = $_SERVER['SCRIPT_NAME'];
|
11 |
-
$expertrec_version = "1.2.11";
|
12 |
-
// $protocol = $_SERVER['REQUEST_SCHEME'];
|
13 |
-
$installer->startSetup();
|
14 |
-
|
15 |
-
$result =array();
|
16 |
-
//install/upgrade status
|
17 |
-
$result['status'] = "Installed";
|
18 |
-
//magento version
|
19 |
-
$result['mage_ver'] = $mage_ver;
|
20 |
-
//expertrec version
|
21 |
-
$result['expertrec_ver'] = $expertrec_version;
|
22 |
-
$result['php_ver'] = $php_ver;
|
23 |
-
|
24 |
-
if (isset($_SERVER['HTTPS']) &&
|
25 |
-
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
|
26 |
-
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
27 |
-
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
28 |
-
$protocol = 'https';
|
29 |
-
}
|
30 |
-
else {
|
31 |
-
$protocol = 'http';
|
32 |
-
}
|
33 |
-
|
34 |
-
//Subdomain
|
35 |
-
$result['site_subdomain'] = $uri;
|
36 |
-
//hostname
|
37 |
-
$result['site_protocol'] = $protocol;
|
38 |
-
$result['site_host'] = $host;
|
39 |
-
//selecting for site_details
|
40 |
-
$site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
|
41 |
-
//site name and email
|
42 |
-
$result['site_name'] = $site_data[0]['value'];
|
43 |
-
$result['site_email'] = $site_data[1]['value'];
|
44 |
-
//selecting for admin_details
|
45 |
-
$admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
|
46 |
-
//admin name and email
|
47 |
-
$result['admin_firstname'] = $admin_data[0]['firstname'];
|
48 |
-
$result['admin_lastname'] = $admin_data[0]['lastname'];
|
49 |
-
$result['admin_email'] = $admin_data[0]['email'];
|
50 |
-
|
51 |
-
$postData = '';
|
52 |
-
//create name value pairs seperated by &
|
53 |
-
foreach($result as $key => $value)
|
54 |
-
{
|
55 |
-
$postData .= $key . '='.$value.'&';
|
56 |
-
}
|
57 |
-
$postData = rtrim($postData, '&');
|
58 |
-
|
59 |
-
//call install api
|
60 |
-
$url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
|
61 |
-
$curl = curl_init();
|
62 |
-
curl_setopt($curl, CURLOPT_URL, $url);
|
63 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
64 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
65 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, 130);
|
66 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
67 |
-
$response = curl_exec($curl);
|
68 |
-
curl_close($curl);
|
69 |
-
|
70 |
-
$installer->run("
|
71 |
-
INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
|
72 |
-
VALUES
|
73 |
-
('default',0,'expertrec/general/mid','new_user'),
|
74 |
-
('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
|
75 |
-
('default',0,'expertrec/general/log_endpoint','https://feed.expertrec.com/magento/9418bba77c3b75abd2842e93b8c52c4a'),
|
76 |
-
('default',0,'expertrec/general/headers','qty,is_in_stock,expert_image,expert_thumbnail,expert_category,expert_category_ids,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids,minimal_price,status,visibility'),
|
77 |
-
('default',0,'expertrec/general/expertrec_image_width',250),
|
78 |
-
('default',0,'expertrec/general/expertrec_image_height',250),
|
79 |
-
('default',0,'expertrec/general/expertrec_thumbnail_width',80),
|
80 |
-
('default',0,'expertrec/general/expertrec_thumbnail_height',80),
|
81 |
-
('default',0,'expertrec/general/expertrec_feed_push',0),
|
82 |
-
('default',0,'expertrec/general/expertrec_feed_pushed_pages','0,0,0'),
|
83 |
-
('default',0,'expertrec/general/filters','filter_by_stock,filter_by_status')
|
84 |
-
ON DUPLICATE KEY UPDATE `value`=`value`;
|
85 |
-
");
|
86 |
-
|
87 |
-
$installer->endSetup();
|
88 |
-
|
89 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.2.12.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Collect Magento_version,PHP_version,Expertrec_version, Domain and Subdomain,
|
5 |
+
Site_info from core_config_data and user_info from admin_user,
|
6 |
+
and send to expertrec/magento-install api to know new installation.
|
7 |
+
Insert some data to core_config_data as default as to be used in Extension.
|
8 |
+
*/
|
9 |
+
|
10 |
+
$installer = $this;
|
11 |
+
$mage_ver = Mage::getVersion();
|
12 |
+
$php_ver = phpversion();
|
13 |
+
$expertrec_version = "1.2.12";
|
14 |
+
|
15 |
+
$installer->startSetup();
|
16 |
+
$result =array();
|
17 |
+
|
18 |
+
$result['status'] = "Installed";
|
19 |
+
$result['mage_ver'] = $mage_ver;
|
20 |
+
$result['php_ver'] = $php_ver;
|
21 |
+
$result['expertrec_ver'] = $expertrec_version;
|
22 |
+
$result['site_host'] = $_SERVER['HTTP_HOST'];
|
23 |
+
$result['site_subdomain'] = $_SERVER['SCRIPT_NAME'];
|
24 |
+
|
25 |
+
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
26 |
+
$result['site_protocol'] = 'https';
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
$result['site_protocol'] = 'http';
|
30 |
+
}
|
31 |
+
|
32 |
+
$site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
|
33 |
+
|
34 |
+
$result['site_name'] = $site_data[0]['value'];
|
35 |
+
$result['site_email'] = $site_data[1]['value'];
|
36 |
+
|
37 |
+
$admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
|
38 |
+
|
39 |
+
$result['admin_firstname'] = $admin_data[0]['firstname'];
|
40 |
+
$result['admin_lastname'] = $admin_data[0]['lastname'];
|
41 |
+
$result['admin_email'] = $admin_data[0]['email'];
|
42 |
+
|
43 |
+
$postData = '';
|
44 |
+
foreach($result as $key => $value) {
|
45 |
+
$postData .= $key . '='.$value.'&';
|
46 |
+
}
|
47 |
+
$postData = rtrim($postData, '&');
|
48 |
+
|
49 |
+
$url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
|
50 |
+
$curl = curl_init();
|
51 |
+
curl_setopt($curl, CURLOPT_URL, $url);
|
52 |
+
curl_setopt($curl, CURLOPT_POST, 1);
|
53 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
54 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 130);
|
55 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
56 |
+
$response = curl_exec($curl);
|
57 |
+
curl_close($curl);
|
58 |
+
|
59 |
+
$installer->run("
|
60 |
+
INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
|
61 |
+
VALUES ('default',0,'expertrec/general/mid','new_user'),
|
62 |
+
('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
|
63 |
+
('default',0,'expertrec/general/log_endpoint','https://feed.expertrec.com/magento/9418bba77c3b75abd2842e93b8c52c4a'),
|
64 |
+
('default',0,'expertrec/general/headers','qty,is_in_stock,expert_image,expert_thumbnail,expert_category,expert_category_ids,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids,minimal_price,status,visibility'),
|
65 |
+
('default',0,'expertrec/general/expertrec_image_width',250),
|
66 |
+
('default',0,'expertrec/general/expertrec_image_height',250),
|
67 |
+
('default',0,'expertrec/general/expertrec_thumbnail_width',80),
|
68 |
+
('default',0,'expertrec/general/expertrec_thumbnail_height',80),
|
69 |
+
('default',0,'expertrec/general/expertrec_feed_push',0),
|
70 |
+
('default',0,'expertrec/general/expertrec_feed_pushed_pages','0,0,0'),
|
71 |
+
('default',0,'expertrec/general/filters','filter_by_stock,filter_by_status')
|
72 |
+
ON DUPLICATE KEY UPDATE `value`=`value`;
|
73 |
+
");
|
74 |
+
$installer->endSetup();
|
75 |
+
?>
|
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.2.10-1.2.11.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
//echo 'Running The Upgrade from 1.1.5 to 1.1.6 : '.get_class($this)."\n <br /> \n";
|
4 |
-
// Mage::log("Running The Upgrade to 1.2.1 : ".get_class($this));
|
5 |
-
|
6 |
-
$installer = $this;
|
7 |
-
$mage_ver = Mage::getVersion();
|
8 |
-
$php_ver = phpversion();
|
9 |
-
$host = $_SERVER['HTTP_HOST'];
|
10 |
-
$uri = $_SERVER['SCRIPT_NAME'];
|
11 |
-
$expertrec_version = "1.2.11";
|
12 |
-
// $protocol = $_SERVER['REQUEST_SCHEME'];
|
13 |
-
|
14 |
-
$installer->startSetup();
|
15 |
-
|
16 |
-
$result =array();
|
17 |
-
//status
|
18 |
-
$result['status'] = "Upgraded";
|
19 |
-
//magento version
|
20 |
-
$result['mage_ver'] = $mage_ver;
|
21 |
-
//expertrec version
|
22 |
-
$result['expertrec_ver'] = $expertrec_version;
|
23 |
-
$result['php_ver'] = $php_ver;
|
24 |
-
|
25 |
-
if (isset($_SERVER['HTTPS']) &&
|
26 |
-
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
|
27 |
-
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
28 |
-
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
29 |
-
$protocol = 'https';
|
30 |
-
}
|
31 |
-
else {
|
32 |
-
$protocol = 'http';
|
33 |
-
}
|
34 |
-
//hostname
|
35 |
-
$result['site_protocol'] = $protocol;
|
36 |
-
|
37 |
-
|
38 |
-
$result['site_host'] = $host;
|
39 |
-
//Subdomain
|
40 |
-
$result['site_subdomain'] = $uri;
|
41 |
-
//selecting for site_details
|
42 |
-
$site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
|
43 |
-
//site name and email
|
44 |
-
$result['site_name'] = $site_data[0]['value'];
|
45 |
-
$result['site_email'] = $site_data[1]['value'];
|
46 |
-
//selecting for admin_details
|
47 |
-
$admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
|
48 |
-
//admin name and email
|
49 |
-
$result['admin_firstname'] = $admin_data[0]['firstname'];
|
50 |
-
$result['admin_lastname'] = $admin_data[0]['lastname'];
|
51 |
-
$result['admin_email'] = $admin_data[0]['email'];
|
52 |
-
|
53 |
-
$postData = '';
|
54 |
-
//create name value pairs seperated by &
|
55 |
-
foreach($result as $key => $value)
|
56 |
-
{
|
57 |
-
$postData .= $key . '='.$value.'&';
|
58 |
-
}
|
59 |
-
$postData = rtrim($postData, '&');
|
60 |
-
|
61 |
-
//call install api
|
62 |
-
$url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
|
63 |
-
$curl = curl_init();
|
64 |
-
curl_setopt($curl, CURLOPT_URL, $url);
|
65 |
-
curl_setopt($curl, CURLOPT_POST, 1);
|
66 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
67 |
-
curl_setopt($curl, CURLOPT_TIMEOUT, 130);
|
68 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
69 |
-
$response = curl_exec($curl);
|
70 |
-
curl_close($curl);
|
71 |
-
|
72 |
-
$installer->run("
|
73 |
-
UPDATE {$this->getTable('core_config_data')} SET `value`=0 WHERE `path`='expertrec/general/expertrec_feed_push';
|
74 |
-
");
|
75 |
-
|
76 |
-
$installer->endSetup();
|
77 |
-
|
78 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.2.11-1.2.12.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Collect Magento_version,PHP_version,Expertrec_version, Domain and Subdomain,
|
5 |
+
Site_info from core_config_data and user_info from admin_user,
|
6 |
+
and send to expertrec/magento-install api to know Upgrade to new version.
|
7 |
+
Update feed push to 0, so that user push feed.
|
8 |
+
*/
|
9 |
+
|
10 |
+
$installer = $this;
|
11 |
+
$mage_ver = Mage::getVersion();
|
12 |
+
$php_ver = phpversion();
|
13 |
+
$expertrec_version = "1.2.12";
|
14 |
+
|
15 |
+
$installer->startSetup();
|
16 |
+
$result =array();
|
17 |
+
|
18 |
+
$result['status'] = "Upgraded";
|
19 |
+
$result['mage_ver'] = $mage_ver;
|
20 |
+
$result['php_ver'] = $php_ver;
|
21 |
+
$result['expertrec_ver'] = $expertrec_version;
|
22 |
+
$result['site_host'] = $_SERVER['HTTP_HOST'];
|
23 |
+
$result['site_subdomain'] = $_SERVER['SCRIPT_NAME'];
|
24 |
+
|
25 |
+
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
26 |
+
$result['site_protocol'] = 'https';
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
$result['site_protocol'] = 'http';
|
30 |
+
}
|
31 |
+
|
32 |
+
$site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
|
33 |
+
|
34 |
+
$result['site_name'] = $site_data[0]['value'];
|
35 |
+
$result['site_email'] = $site_data[1]['value'];
|
36 |
+
|
37 |
+
$admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
|
38 |
+
|
39 |
+
$result['admin_firstname'] = $admin_data[0]['firstname'];
|
40 |
+
$result['admin_lastname'] = $admin_data[0]['lastname'];
|
41 |
+
$result['admin_email'] = $admin_data[0]['email'];
|
42 |
+
|
43 |
+
$postData = '';
|
44 |
+
foreach($result as $key => $value) {
|
45 |
+
$postData .= $key . '='.$value.'&';
|
46 |
+
}
|
47 |
+
$postData = rtrim($postData, '&');
|
48 |
+
|
49 |
+
$url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
|
50 |
+
$curl = curl_init();
|
51 |
+
curl_setopt($curl, CURLOPT_URL, $url);
|
52 |
+
curl_setopt($curl, CURLOPT_POST, 1);
|
53 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
54 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 130);
|
55 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
56 |
+
$response = curl_exec($curl);
|
57 |
+
curl_close($curl);
|
58 |
+
|
59 |
+
$installer->run("
|
60 |
+
UPDATE {$this->getTable('core_config_data')} SET `value`=0 WHERE `path`='expertrec/general/expertrec_feed_push';
|
61 |
+
UPDATE {$this->getTable('core_config_data')} SET `value`='qty,is_in_stock,expert_image,expert_thumbnail,expert_category,expert_category_ids,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids,minimal_price,status,visibility' WHERE `path`='expertrec/general/headers';
|
62 |
+
");
|
63 |
+
$installer->endSetup();
|
64 |
+
?>
|
app/design/adminhtml/default/default/layout/expertrec/recommendation.xml
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
-
|
|
|
|
|
4 |
<default>
|
5 |
<reference name="notifications">
|
6 |
<block type="core/template" name="expertrec_recommendation_adminhtml_notifications" template="expertrec/recommendation/notifications.phtml"></block>
|
7 |
</reference>
|
8 |
</default>
|
9 |
-
|
10 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
+
<!--
|
4 |
+
Display info to upload feed on new installation on admin-panel dashboard
|
5 |
+
-->
|
6 |
<default>
|
7 |
<reference name="notifications">
|
8 |
<block type="core/template" name="expertrec_recommendation_adminhtml_notifications" template="expertrec/recommendation/notifications.phtml"></block>
|
9 |
</reference>
|
10 |
</default>
|
|
|
11 |
</layout>
|
app/design/adminhtml/default/default/template/expertrec/recommendation/notifications.phtml
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
-
|
|
|
|
|
2 |
<?php
|
3 |
-
|
4 |
$feed_push = 'expertrec/general/expertrec_feed_push';
|
5 |
$pushed = Mage::getStoreConfig($feed_push);
|
6 |
if($pushed == 0): ?>
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<?php endif;?>
|
1 |
+
<!--
|
2 |
+
Display info to upload feed on new installation
|
3 |
+
-->
|
4 |
<?php
|
|
|
5 |
$feed_push = 'expertrec/general/expertrec_feed_push';
|
6 |
$pushed = Mage::getStoreConfig($feed_push);
|
7 |
if($pushed == 0): ?>
|
8 |
+
<div class="notification-global">
|
9 |
+
<strong><?php echo $this->helper('index')->__('Expertrec: ') ?></strong>
|
10 |
+
<?php echo "Please "?>
|
11 |
+
<?php $push_feed = Mage::getBaseUrl().'expertrec-feed/api/feed';?>
|
12 |
+
<?php echo $this->helper('index')->__('<a href="%s">upload the Feed</a>.', $push_feed);?>
|
13 |
+
</div>
|
14 |
+
<?php endif;?>
|
|
|
|
app/design/frontend/base/default/layout/expertrec/recommendation.xml
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
-
<!--
|
|
|
|
|
|
|
|
|
4 |
<default>
|
5 |
<reference name="head">
|
6 |
-
|
7 |
</reference>
|
8 |
</default>
|
9 |
-
<!-- PRODUCT PAGE -->
|
10 |
<catalog_product_view>
|
11 |
<reference name="before_body_end">
|
12 |
-
|
13 |
</reference>
|
14 |
</catalog_product_view>
|
15 |
-
|
16 |
-
<!-- Search -->
|
17 |
<expertrec_autocomplete>
|
18 |
<reference name="root">
|
19 |
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
@@ -48,9 +49,9 @@
|
|
48 |
<reference name="root">
|
49 |
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
50 |
</reference>
|
51 |
-
|
52 |
<block type="expertrec_recommendation/api" name="expertrec_feed1"
|
53 |
-
|
54 |
</reference>
|
55 |
</expertrec_recommendation_api_info>
|
56 |
-
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
+
<!--
|
4 |
+
tracker to be included in all pages to include expertrec.js,
|
5 |
+
product is included in product_view page to get pid,
|
6 |
+
view is for search and info is for admin.
|
7 |
+
-->
|
8 |
<default>
|
9 |
<reference name="head">
|
10 |
+
<block name="expertrec.rec.tracking" template="expertrec/recommendation/tracker.phtml" after="-" type="core/template"/>
|
11 |
</reference>
|
12 |
</default>
|
|
|
13 |
<catalog_product_view>
|
14 |
<reference name="before_body_end">
|
15 |
+
<block name="expertrec.rec.analytics.producttracking" template="expertrec/recommendation/tracking/product.phtml" after="-" type="core/template"/>
|
16 |
</reference>
|
17 |
</catalog_product_view>
|
|
|
|
|
18 |
<expertrec_autocomplete>
|
19 |
<reference name="root">
|
20 |
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
49 |
<reference name="root">
|
50 |
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
51 |
</reference>
|
52 |
+
<reference name="content">
|
53 |
<block type="expertrec_recommendation/api" name="expertrec_feed1"
|
54 |
+
template="expertrec/feed/info.phtml"/>
|
55 |
</reference>
|
56 |
</expertrec_recommendation_api_info>
|
57 |
+
</layout>
|
app/design/frontend/base/default/template/expertrec/feed/info.phtml
CHANGED
@@ -1,664 +1,530 @@
|
|
1 |
-
|
|
|
|
|
2 |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
3 |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
4 |
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
5 |
<style type="text/css">
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
</style>
|
17 |
<script type="text/javascript">
|
18 |
-
function toggle_select()
|
19 |
-
{
|
20 |
var checkboxes = document.getElementsByName("check_list[]");
|
21 |
var button = document.getElementById("toggleSelect");
|
22 |
-
if(button.value == "Select All")
|
23 |
-
{
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
{
|
34 |
-
checkboxes[i].checked = "";
|
35 |
-
}
|
36 |
-
button.value = "Select All";
|
37 |
-
}
|
38 |
}
|
39 |
</script>
|
40 |
-
<div class="container
|
41 |
<h4 style='margin:20px auto 10px;'>Extension Version: <span style='color:red;'><?php echo (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version')?></span></h4>
|
42 |
<h4 style='margin:10px auto;'>Extension Build No.: <span style='color:red;'><?php echo Mage::registry('buildno'); ?></span></h4>
|
43 |
<h4 style='margin:10px auto;'>Magento Version: <span style='color:red;'><?php echo Mage::getVersion(); ?></span></h4>
|
44 |
<h4 style='margin:10px auto;'>Merchant ID: <span style='color:red;'><?php echo $this->getMerchantID(); ?></span></h4>
|
45 |
<ul class="nav nav-tabs" style="margin-top:20px;">
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
<?php endif;?>
|
121 |
-
|
122 |
-
<!-- <td><a href = "<?php //echo $_item['surl'] ?>"><?php //echo $_item['surl'] ?></a></td> -->
|
123 |
-
<!-- form post request -->
|
124 |
-
<td><form method="post" action="<?php echo $_item['surl'] ?>" id="webform<?php echo $_item['sid']; ?>" name="webform<?php echo $_item['sid']; ?>">
|
125 |
-
<p><?php echo $_item['link'] ?></p>
|
126 |
-
<input type="hidden" name="secret" value="<?php echo $_item['secret']?>">
|
127 |
-
<input type="hidden" name="cmd" value="<?php echo $_item['cmd']?>">
|
128 |
-
<input type="hidden" name="wid" value="<?php echo $_item['wid']?>">
|
129 |
-
<input type="hidden" name="sid" value="<?php echo $_item['sid']?>">
|
130 |
-
<button type="submit" id ="websubmit<?php echo $_item['sid']; ?>" name ="websubmit<?php echo $_item['sid']; ?>">submit</button>
|
131 |
-
</form></td>
|
132 |
-
|
133 |
-
</tr>
|
134 |
<?php endforeach; ?>
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
<p><?php echo $suggestionApi['link'].'&ps=1&pe=2' ?></p>
|
231 |
-
<input type="hidden" name="secret" value="<?php echo $suggestionApi['secret']?>">
|
232 |
-
<input type="hidden" name="cmd" value="<?php echo $suggestionApi['cmd']?>">
|
233 |
-
<input type="hidden" name="wid" value="<?php echo $suggestionApi['wid']?>">
|
234 |
-
<input type="hidden" name="sid" value="<?php echo $suggestionApi['sid']?>">
|
235 |
-
<input type="hidden" name="ps" value="1">
|
236 |
-
<input type="hidden" name="pe" value="2">
|
237 |
-
<button id="sug1sub" name="sug1sub" type="submit" name="onsubmit" value="sugg_nosize">submit</button>
|
238 |
-
</form>
|
239 |
-
|
240 |
-
<form method="post" id="sug2form" name="sug2form" action="<?php echo $suggestionApi['surl'] ?>">
|
241 |
-
<p><b>With pagination without page size(default page size is 500)</b></p>
|
242 |
-
<!-- <p><a href="<?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?>"><?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?></a></p> -->
|
243 |
-
<p><?php echo $suggestionApi['link'].'&ps=1&pe=2&psize=50' ?></p>
|
244 |
-
<input type="hidden" name="secret" value="<?php echo $suggestionApi['secret']?>">
|
245 |
-
<input type="hidden" name="cmd" value="<?php echo $suggestionApi['cmd']?>">
|
246 |
-
<input type="hidden" name="wid" value="<?php echo $suggestionApi['wid']?>">
|
247 |
-
<input type="hidden" name="sid" value="<?php echo $suggestionApi['sid']?>">
|
248 |
-
<input type="hidden" name="ps" value="1">
|
249 |
-
<input type="hidden" name="pe" value="2">
|
250 |
-
<input type="hidden" name="psize" value="50">
|
251 |
-
<button id="sug2sub" name="sug2sub" type="submit" name="onsubmit" value="sugg_size">submit</button>
|
252 |
-
</form>
|
253 |
-
|
254 |
-
</fieldset>
|
255 |
-
</div>
|
256 |
-
<div style="margin-top:20px">
|
257 |
-
<fieldset>
|
258 |
-
<legend>Getting log & Cleaning Expertrec Directory Api's</legend>
|
259 |
-
<?php $logApi = $this->getLogUrl();?>
|
260 |
-
<form id="logform" name="logform" method="post" action="<?php echo $logApi['surl'] ?>">
|
261 |
-
<p><b>Get Log Url</b></p>
|
262 |
-
<!-- <p><a href="<?php //echo $this->getLogUrl() ?>"><?php //echo $this->getLogUrl() ?></a></p> -->
|
263 |
-
<p><?php echo $logApi['link'] ?></p>
|
264 |
-
<input type="hidden" name="secret" value="<?php echo $logApi['secret']?>">
|
265 |
-
<button id="logsub" name="logsub" type="submit">submit</button>
|
266 |
-
</form>
|
267 |
-
<?php $cleanDir = $this->getCleanDirUrl();?>
|
268 |
-
<form id="cleanform" name="cleanform" method="post" action="<?php echo $cleanDir['surl'] ?>" target="_blank">
|
269 |
-
<p><b>Get Cleandir Url</b></p>
|
270 |
-
<!-- <p><a href="<?php //echo $this->getCleanDirUrl() ?>" target="_blank"><?php //echo $this->getCleanDirUrl() ?></a></p> -->
|
271 |
-
<p><?php echo $cleanDir['link'] ?></p>
|
272 |
-
<input type="hidden" name="secret" value="<?php echo $cleanDir['secret']?>">
|
273 |
-
<button id="cleansub" name="cleansub" type="submit">submit</button>
|
274 |
-
</form>
|
275 |
-
</fieldset>
|
276 |
-
</div>
|
277 |
-
<!-- xml-file
|
278 |
-
<div style="margin-top:20px">
|
279 |
-
<fieldset>
|
280 |
-
<legend>Xml File</legend>
|
281 |
-
<form method="post" action="<?php //echo $this->getBaseUrl().'xml.php';?>" target="_blank">
|
282 |
-
<input type="hidden" name="secret" value="<?php //echo $this->getSecret();?>">
|
283 |
-
<p><?php //echo $this->getBaseUrl().'xml.php'; ?></p>
|
284 |
-
<button type="submit">submit</button>
|
285 |
</form>
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
<input type="hidden" name="secret" value="<?php echo $pullFeed['secret'];?>">
|
295 |
<p><?php echo $pullFeed['link']; ?></p>
|
296 |
<button type="submit">submit</button>
|
297 |
</form>
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
<?php endforeach; ?>
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
<div style="margin-top:20px">
|
523 |
-
<fieldset>
|
524 |
-
<legend>Site Info</legend>
|
525 |
-
<table class="table table-hover" style="table-layout: fixed;">
|
526 |
-
<tbody>
|
527 |
-
<?php $siteDetails = $this->getSiteDetails();?>
|
528 |
-
<?php $installedExtensions = $this->getInstalledExtensions(); ?>
|
529 |
-
<?php $activeExtensions = $this->getActiveExtensions($installedExtensions['modulearr']); ?>
|
530 |
-
|
531 |
-
<?php if(isset($siteDetails["adminName"])): ?>
|
532 |
-
<tr>
|
533 |
-
<td style="width: 20%;"><strong>Admin name: </strong></td>
|
534 |
-
<td style="word-wrap:break-word;">
|
535 |
-
<?php echo $siteDetails["adminName"]; ?>
|
536 |
-
</td>
|
537 |
-
</tr>
|
538 |
-
<?php endif; ?>
|
539 |
-
<?php if(isset($siteDetails["adminEmail"])): ?>
|
540 |
-
<tr>
|
541 |
-
<td style="width: 20%;"><strong>Admin email: </strong></td>
|
542 |
-
<td style="word-wrap:break-word;">
|
543 |
-
<?php echo $siteDetails["adminEmail"]; ?>
|
544 |
-
</td>
|
545 |
-
</tr>
|
546 |
-
<?php endif; ?>
|
547 |
-
<?php if(isset($siteDetails["salesName"])): ?>
|
548 |
-
<tr>
|
549 |
-
<td style="width: 20%;"><strong>Sales name: </strong></td>
|
550 |
-
<td style="word-wrap:break-word;">
|
551 |
-
<?php echo $siteDetails["salesName"]; ?>
|
552 |
-
</td>
|
553 |
-
</tr>
|
554 |
-
<?php endif; ?>
|
555 |
-
<?php if(isset($siteDetails["salesEmail"])): ?>
|
556 |
-
<tr>
|
557 |
-
<td style="width: 20%;"><strong>Sales email: </strong></td>
|
558 |
-
<td style="word-wrap:break-word;">
|
559 |
-
<?php echo $siteDetails["salesEmail"]; ?>
|
560 |
-
</td>
|
561 |
-
</tr>
|
562 |
-
<?php endif; ?>
|
563 |
-
<?php if(isset($siteDetails["secureUrl"])): ?>
|
564 |
-
<tr>
|
565 |
-
<td style="width: 20%;"><strong>Web secure base URL: </strong></td>
|
566 |
-
<td style="word-wrap:break-word;">
|
567 |
-
<?php echo $siteDetails["secureUrl"]; ?>
|
568 |
-
</td>
|
569 |
-
</tr>
|
570 |
-
<?php endif; ?>
|
571 |
-
<?php if(isset($siteDetails["unsecureUrl"])): ?>
|
572 |
-
<tr>
|
573 |
-
<td style="width: 20%;"><strong>Web unsecure base URL: </strong></td>
|
574 |
-
<td style="word-wrap:break-word;">
|
575 |
-
<?php echo $siteDetails["unsecureUrl"]; ?>
|
576 |
-
</td>
|
577 |
-
</tr>
|
578 |
-
<?php endif; ?>
|
579 |
-
<?php if(isset($siteDetails["baseCurrency"])): ?>
|
580 |
-
<tr>
|
581 |
-
<td style="width: 20%;"><strong>Base currency: </strong></td>
|
582 |
-
<td style="word-wrap:break-word;">
|
583 |
-
<?php echo $siteDetails["baseCurrency"]; ?>
|
584 |
-
</td>
|
585 |
-
</tr>
|
586 |
-
<?php endif; ?>
|
587 |
-
<?php if(isset($siteDetails["defaultCurrency"])): ?>
|
588 |
-
<tr>
|
589 |
-
<td style="width: 20%;"><strong>Default currency: </strong></td>
|
590 |
-
<td style="word-wrap:break-word;">
|
591 |
-
<?php echo $siteDetails["defaultCurrency"]; ?>
|
592 |
-
</td>
|
593 |
-
</tr>
|
594 |
-
<?php endif; ?>
|
595 |
-
<?php if(isset($siteDetails["allowCurrency"])): ?>
|
596 |
-
<tr>
|
597 |
-
<td style="width: 20%;"><strong>Allowed currencies: </strong></td>
|
598 |
-
<td style="word-wrap:break-word;">
|
599 |
-
<?php echo $siteDetails["allowCurrency"]; ?>
|
600 |
-
</td>
|
601 |
-
</tr>
|
602 |
-
<?php endif; ?>
|
603 |
-
<?php if(isset($siteDetails["installedCurrency"])): ?>
|
604 |
-
<tr>
|
605 |
-
<td style="width: 20%;"><strong>Installed currencies: </strong></td>
|
606 |
-
<td style="word-wrap:break-word;">
|
607 |
-
<?php echo $siteDetails["installedCurrency"]; ?>
|
608 |
-
</td>
|
609 |
-
</tr>
|
610 |
-
<?php endif; ?>
|
611 |
-
<?php if(isset($siteDetails["defaultCountry"])): ?>
|
612 |
-
<tr>
|
613 |
-
<td style="width: 20%;"><strong>Default country: </strong></td>
|
614 |
-
<td style="word-wrap:break-word;">
|
615 |
-
<?php echo $siteDetails["defaultCountry"]; ?>
|
616 |
-
</td>
|
617 |
-
</tr>
|
618 |
-
<?php endif; ?>
|
619 |
-
<?php if(isset($siteDetails["timezone"])): ?>
|
620 |
-
<tr>
|
621 |
-
<td style="width: 20%;"><strong>Timezone: </strong></td>
|
622 |
-
<td style="word-wrap:break-word;">
|
623 |
-
<?php echo $siteDetails["timezone"]; ?>
|
624 |
-
</td>
|
625 |
-
</tr>
|
626 |
-
<?php endif; ?>
|
627 |
-
<?php if(isset($installedExtensions["modulestr"])): ?>
|
628 |
-
<tr>
|
629 |
-
<td style="width: 20%;"><strong>Installed Extensions: </strong></td>
|
630 |
-
<td style="word-wrap:break-word;">
|
631 |
-
<?php echo $installedExtensions["modulestr"]; ?>
|
632 |
-
</td>
|
633 |
-
</tr>
|
634 |
-
<?php endif; ?>
|
635 |
-
<?php if(isset($installedExtensions["errorstr"])): ?>
|
636 |
-
<tr>
|
637 |
-
<td style="width: 20%;"><strong>Installed Extensions(Error): </strong></td>
|
638 |
-
<td style="color:red;word-wrap:break-word;"><?php echo $installedExtensions['errorstr'];?></td>
|
639 |
-
</tr>
|
640 |
-
<?php endif; ?>
|
641 |
-
<?php if(isset($activeExtensions["modulestr"])): ?>
|
642 |
-
<tr>
|
643 |
-
<td style="width: 20%;"><strong>Active Extensions: </strong></td>
|
644 |
-
<td style="word-wrap:break-word;">
|
645 |
-
<?php echo $activeExtensions["modulestr"]; ?>
|
646 |
-
</td>
|
647 |
-
</tr>
|
648 |
-
<?php endif; ?>
|
649 |
-
<?php if(isset($activeExtensions["errorstr"])): ?>
|
650 |
-
<tr>
|
651 |
-
<td style="width: 20%;"><strong>Active Extensions(Error): </strong></td>
|
652 |
-
<td style="color:red;word-wrap:break-word;">
|
653 |
-
<?php echo $activeExtensions['errorstr'];?>
|
654 |
-
</td>
|
655 |
-
</tr>
|
656 |
-
<?php endif; ?>
|
657 |
-
</tbody>
|
658 |
-
</table>
|
659 |
-
</fieldset>
|
660 |
-
</div>
|
661 |
-
</div>
|
662 |
-
<!--site details section ended-->
|
663 |
-
</div>
|
664 |
-
</div>
|
1 |
+
<!--
|
2 |
+
site_details,search,header & feed configurations,Api info can be accessed only by admin to know client status
|
3 |
+
-->
|
4 |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
5 |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
6 |
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
7 |
<style type="text/css">
|
8 |
+
.page-header {max-width: 1260px;margin: 0 auto;padding: 0 30px;}
|
9 |
+
table {border-spacing: 0;border-collapse: collapse;width: 100%;}
|
10 |
+
.table-hover > tbody > tr:hover {background-color: #f5f5f5;}
|
11 |
+
tbody td, thead th{padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;text-align:left;word-wrap:break-word;white-space: normal;}
|
12 |
+
thead:first-child > tr:first-child > th {border-top: 0;}
|
13 |
+
thead th {vertical-align: bottom;border-bottom:2px solid #ddd;background-color:#f5f5f5;text-align:center;}
|
14 |
+
fieldset { display: block;margin:10px 2px;padding: .35em .625em .75em; border: 1px solid silver; }
|
15 |
+
legend{padding: 0px 5px; width: auto; border: 0px none;margin:0;}
|
16 |
+
fieldset p { text-align: left; display: block; }
|
17 |
+
#searchConfSection input[type="checkbox"]{bottom: 2px;}
|
18 |
+
.setHeadersForm label{padding:0px 10px 10px 0px;}
|
19 |
+
.setHeadersForm input{vertical-align: middle;}
|
20 |
</style>
|
21 |
<script type="text/javascript">
|
22 |
+
function toggle_select(){
|
|
|
23 |
var checkboxes = document.getElementsByName("check_list[]");
|
24 |
var button = document.getElementById("toggleSelect");
|
25 |
+
if(button.value == "Select All"){
|
26 |
+
for (var i in checkboxes){
|
27 |
+
checkboxes[i].checked = "checked";
|
28 |
+
}
|
29 |
+
button.value = "Deselect All"
|
30 |
+
}else{
|
31 |
+
for (var i in checkboxes){
|
32 |
+
checkboxes[i].checked = "";
|
33 |
+
}
|
34 |
+
button.value = "Select All";
|
35 |
+
}
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
</script>
|
38 |
+
<div class="container">
|
39 |
<h4 style='margin:20px auto 10px;'>Extension Version: <span style='color:red;'><?php echo (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version')?></span></h4>
|
40 |
<h4 style='margin:10px auto;'>Extension Build No.: <span style='color:red;'><?php echo Mage::registry('buildno'); ?></span></h4>
|
41 |
<h4 style='margin:10px auto;'>Magento Version: <span style='color:red;'><?php echo Mage::getVersion(); ?></span></h4>
|
42 |
<h4 style='margin:10px auto;'>Merchant ID: <span style='color:red;'><?php echo $this->getMerchantID(); ?></span></h4>
|
43 |
<ul class="nav nav-tabs" style="margin-top:20px;">
|
44 |
+
<li class="active"><a data-toggle="tab" href="#apiSection">Api</a></li>
|
45 |
+
<li><a data-toggle="tab" href="#feedHeader">Feed Header</a></li>
|
46 |
+
<li><a data-toggle="tab" href="#feedEndpointSection">Feed Config</a></li>
|
47 |
+
<li><a data-toggle="tab" href="#searchConfSection">Search</a></li>
|
48 |
+
<li><a data-toggle="tab" href="#siteDetailsSection">Details</a></li>
|
49 |
+
</ul>
|
50 |
+
<div style="clear:both;"></div>
|
51 |
+
<div class="tab-content">
|
52 |
+
<?php $imageParams = $this->getImageParams();
|
53 |
+
$imgwidth = "";
|
54 |
+
$imgheight = "";
|
55 |
+
$thumbwidth = "";
|
56 |
+
$thumbheight = "";
|
57 |
+
if($imageParams['thumbwidth'] != "" && isset($imageParams['thumbwidth'])){
|
58 |
+
$thumbwidth = $imageParams['thumbwidth'];
|
59 |
+
}
|
60 |
+
if($imageParams['thumbheight'] != "" && isset($imageParams['thumbheight'])){
|
61 |
+
$thumbheight = $imageParams['thumbheight'];
|
62 |
+
}
|
63 |
+
if($imageParams['imgwidth'] != "" && isset($imageParams['imgwidth'])){
|
64 |
+
$imgwidth = $imageParams['imgwidth'];
|
65 |
+
}
|
66 |
+
if($imageParams['imgheight'] != "" && isset($imageParams['imgheight'])){
|
67 |
+
$imgheight = $imageParams['imgheight'];
|
68 |
+
}
|
69 |
+
?>
|
70 |
+
<div id="apiSection" class="tab-pane fade in active"> <!--Defining API Info section-->
|
71 |
+
<div style="margin-top:20px;">
|
72 |
+
<fieldset>
|
73 |
+
<legend>Getting Feeds Api</legend>
|
74 |
+
<table class="table-hover" style="margin: 1em auto;">
|
75 |
+
<thead>
|
76 |
+
<tr>
|
77 |
+
<th>Website ID</th>
|
78 |
+
<th>Website Name</th>
|
79 |
+
<th>Store ID</th>
|
80 |
+
<th>Store Name</th>
|
81 |
+
<th>Store Language</th>
|
82 |
+
<th>Total# Products</th>
|
83 |
+
<th>Filtered Products</th>
|
84 |
+
<th>Url</th>
|
85 |
+
</tr>
|
86 |
+
</thead>
|
87 |
+
<tbody>
|
88 |
+
<?php foreach ($this->getWebsiteStoreInfo() as $_item): ?>
|
89 |
+
<tr>
|
90 |
+
<td style="text-align:center;"><?php echo $_item['wid'] ?></td>
|
91 |
+
<td style="text-align:center;"><?php echo $_item['wname'] ?></td>
|
92 |
+
<td style="text-align:center;"><?php echo $_item['sid'] ?></td>
|
93 |
+
<td style="text-align:center;"><?php echo $_item['sname'] ?></td>
|
94 |
+
<td style="text-align:center;"><?php echo Mage::getStoreConfig('general/locale/code', $_item['sid']); ?></td>
|
95 |
+
<?php if(isset($_item['pcount'])): ?>
|
96 |
+
<td style="text-align:center;"><?php echo $_item['pcount'] ?></td>
|
97 |
+
<?php endif;?>
|
98 |
+
<?php if(isset($_item['pcounterr'])): ?>
|
99 |
+
<td style="text-align:center;"><b style="color:red;">Error: </b><?php echo $_item['pcounterr'] ?></td>
|
100 |
+
<?php endif;?>
|
101 |
+
<?php if(isset($_item['fcount'])): ?>
|
102 |
+
<td style="text-align:center;"><?php echo $_item['fcount'] ?></td>
|
103 |
+
<?php endif;?>
|
104 |
+
<?php if(isset($_item['fcounterr'])): ?>
|
105 |
+
<td style="text-align:center;"><b style="color:red;">Error: </b><?php echo $_item['fcounterr'] ?></td>
|
106 |
+
<?php endif;?>
|
107 |
+
<td>
|
108 |
+
<form method="post" action="<?php echo $_item['surl'] ?>" id="webform<?php echo $_item['sid']; ?>" name="webform<?php echo $_item['sid']; ?>">
|
109 |
+
<p><?php echo $_item['link'] ?></p>
|
110 |
+
<input type="hidden" name="secret" value="<?php echo $_item['secret']?>">
|
111 |
+
<input type="hidden" name="cmd" value="<?php echo $_item['cmd']?>">
|
112 |
+
<input type="hidden" name="wid" value="<?php echo $_item['wid']?>">
|
113 |
+
<input type="hidden" name="sid" value="<?php echo $_item['sid']?>">
|
114 |
+
<button type="submit" id ="websubmit<?php echo $_item['sid']; ?>" name ="websubmit<?php echo $_item['sid']; ?>">submit</button>
|
115 |
+
</form>
|
116 |
+
</td>
|
117 |
+
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
<?php endforeach; ?>
|
119 |
+
</tbody>
|
120 |
+
</table>
|
121 |
+
</fieldset>
|
122 |
+
</div>
|
123 |
+
<p>
|
124 |
+
<strong>Note:</strong><br/>
|
125 |
+
<span>
|
126 |
+
1. Each page contains 500 products.<br />
|
127 |
+
2. For Getting custom image size, kindly add <b>width</b> and <b>height</b> parameter in the api url.
|
128 |
+
</span>
|
129 |
+
</p>
|
130 |
+
<div style="margin-top:20px">
|
131 |
+
<?php $customImageUrl = $this->getCustomApiUrl()."&width=170&height=170";
|
132 |
+
if((isset($imageParams["imgwidth"]) && $imageParams["imgwidth"] != "") && (isset($imageParams["imgheight"]) && $imageParams["imgheight"] != "")){
|
133 |
+
$customImageUrl = $this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=".$imageParams["imgheight"];
|
134 |
+
}elseif(isset($imageParams["imgwidth"]) && $imageParams["imgwidth"] != ""){
|
135 |
+
$customImageUrl =$this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=170";
|
136 |
+
}elseif(isset($imageParams["imgheight"]) && $imageParams["imgheight"] != ""){
|
137 |
+
$customImageUrl =$this->getCustomApiUrl()."&width=170&height=".$imageParams["imgheight"];
|
138 |
+
}
|
139 |
+
$customApi = $this->getCustomApiUrl();
|
140 |
+
?>
|
141 |
+
<fieldset>
|
142 |
+
<legend>Example</legend>
|
143 |
+
<form method="post" action="<?php echo $customApi['surl'] ?>" id="custImgForm" name="custImgForm">
|
144 |
+
<p><b>With Custom Image</b></p>
|
145 |
+
<p><?php echo $customApi['link'].'&width=170&height=170' ?></p>
|
146 |
+
<input type="hidden" name="secret" value="<?php echo $customApi['secret']?>">
|
147 |
+
<input type="hidden" name="cmd" value="<?php echo $customApi['cmd']?>">
|
148 |
+
<input type="hidden" name="wid" value="<?php echo $customApi['wid']?>">
|
149 |
+
<input type="hidden" name="sid" value="<?php echo $customApi['sid']?>">
|
150 |
+
<input type="hidden" name="width" value="170">
|
151 |
+
<input type="hidden" name="height" value="170">
|
152 |
+
<button id="custsub" name="custsub" type="submit" name="onsubmit" value="custom">submit</button>
|
153 |
+
</form>
|
154 |
+
<form method="post" action="<?php echo $customApi['surl'] ?>">
|
155 |
+
<p><b>With pagination without page size(default page size is 500)</b></p>
|
156 |
+
<p><?php echo $customApi['link'].'&ps=1&pe=2' ?></p>
|
157 |
+
<input type="hidden" name="secret" value="<?php echo $customApi['secret']?>">
|
158 |
+
<input type="hidden" name="cmd" value="<?php echo $customApi['cmd']?>">
|
159 |
+
<input type="hidden" name="wid" value="<?php echo $customApi['wid']?>">
|
160 |
+
<input type="hidden" name="sid" value="<?php echo $customApi['sid']?>">
|
161 |
+
<input type="hidden" name="ps" value="1">
|
162 |
+
<input type="hidden" name="pe" value="2">
|
163 |
+
<button type="submit" name="onsubmit" value="custom_nosize">submit</button>
|
164 |
+
</form>
|
165 |
+
<form method="post" action="<?php echo $customApi['surl'] ?>" id="custform1" name="custform1">
|
166 |
+
<p><b>With pagination without page size(default page size is 500)</b></p>
|
167 |
+
<p><?php echo $customApi['link'].'&ps=1&pe=2&psize=50' ?></p>
|
168 |
+
<input type="hidden" name="secret" value="<?php echo $customApi['secret']?>">
|
169 |
+
<input type="hidden" name="cmd" value="<?php echo $customApi['cmd']?>">
|
170 |
+
<input type="hidden" name="wid" value="<?php echo $customApi['wid']?>">
|
171 |
+
<input type="hidden" name="sid" value="<?php echo $customApi['sid']?>">
|
172 |
+
<input type="hidden" name="ps" value="1">
|
173 |
+
<input type="hidden" name="pe" value="2">
|
174 |
+
<input type="hidden" name="psize" value="50">
|
175 |
+
<button id="custimgsub" name="custimgsub" type="submit" name="onsubmit" value="custom_size">submit</button>
|
176 |
+
</form>
|
177 |
+
</fieldset>
|
178 |
+
</div>
|
179 |
+
<div style="margin-top:20px">
|
180 |
+
<fieldset>
|
181 |
+
<legend>Getting Popular Products Api</legend>
|
182 |
+
<?php $suggestionApi = $this->getSuggestionApiUrl();?>
|
183 |
+
<form method="post" action="<?php echo $suggestionApi['surl'] ?>" id="sugform" name="sugform">
|
184 |
+
<p><b>Without pagination</b></p>
|
185 |
+
<p><?php echo $suggestionApi['link'] ?></p>
|
186 |
+
<input type="hidden" name="secret" value="<?php echo $suggestionApi['secret']?>">
|
187 |
+
<input type="hidden" name="cmd" value="<?php echo $suggestionApi['cmd']?>">
|
188 |
+
<input type="hidden" name="wid" value="<?php echo $suggestionApi['wid']?>">
|
189 |
+
<input type="hidden" name="sid" value="<?php echo $suggestionApi['sid']?>">
|
190 |
+
<button id="sugsub" name="sugsub" type="submit" name="onsubmit" value="sugg">submit</button>
|
191 |
+
</form>
|
192 |
+
<form id="sug1form" name="sug1form" method="post" action="<?php echo $suggestionApi['surl'] ?>">
|
193 |
+
<p><b>With pagination without page size(default page size is 500)</b></p>
|
194 |
+
<p><?php echo $suggestionApi['link'].'&ps=1&pe=2' ?></p>
|
195 |
+
<input type="hidden" name="secret" value="<?php echo $suggestionApi['secret']?>">
|
196 |
+
<input type="hidden" name="cmd" value="<?php echo $suggestionApi['cmd']?>">
|
197 |
+
<input type="hidden" name="wid" value="<?php echo $suggestionApi['wid']?>">
|
198 |
+
<input type="hidden" name="sid" value="<?php echo $suggestionApi['sid']?>">
|
199 |
+
<input type="hidden" name="ps" value="1">
|
200 |
+
<input type="hidden" name="pe" value="2">
|
201 |
+
<button id="sug1sub" name="sug1sub" type="submit" name="onsubmit" value="sugg_nosize">submit</button>
|
202 |
+
</form>
|
203 |
+
<form method="post" id="sug2form" name="sug2form" action="<?php echo $suggestionApi['surl'] ?>">
|
204 |
+
<p><b>With pagination without page size(default page size is 500)</b></p>
|
205 |
+
<p><?php echo $suggestionApi['link'].'&ps=1&pe=2&psize=50' ?></p>
|
206 |
+
<input type="hidden" name="secret" value="<?php echo $suggestionApi['secret']?>">
|
207 |
+
<input type="hidden" name="cmd" value="<?php echo $suggestionApi['cmd']?>">
|
208 |
+
<input type="hidden" name="wid" value="<?php echo $suggestionApi['wid']?>">
|
209 |
+
<input type="hidden" name="sid" value="<?php echo $suggestionApi['sid']?>">
|
210 |
+
<input type="hidden" name="ps" value="1">
|
211 |
+
<input type="hidden" name="pe" value="2">
|
212 |
+
<input type="hidden" name="psize" value="50">
|
213 |
+
<button id="sug2sub" name="sug2sub" type="submit" name="onsubmit" value="sugg_size">submit</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
</form>
|
215 |
+
</fieldset>
|
216 |
+
</div>
|
217 |
+
<div style="margin-top:20px">
|
218 |
+
<fieldset>
|
219 |
+
<legend>Getting log & Cleaning Expertrec Directory Api's</legend>
|
220 |
+
<?php $logApi = $this->getLogUrl();?>
|
221 |
+
<form id="logform" name="logform" method="post" action="<?php echo $logApi['surl'] ?>">
|
222 |
+
<p><b>Get Log Url</b></p>
|
223 |
+
<p><?php echo $logApi['link'] ?></p>
|
224 |
+
<input type="hidden" name="secret" value="<?php echo $logApi['secret']?>">
|
225 |
+
<button id="logsub" name="logsub" type="submit">submit</button>
|
226 |
+
</form>
|
227 |
+
<?php $cleanDir = $this->getCleanDirUrl();?>
|
228 |
+
<form id="cleanform" name="cleanform" method="post" action="<?php echo $cleanDir['surl'] ?>" target="_blank">
|
229 |
+
<p><b>Get Cleandir Url</b></p>
|
230 |
+
<p><?php echo $cleanDir['link'] ?></p>
|
231 |
+
<input type="hidden" name="secret" value="<?php echo $cleanDir['secret']?>">
|
232 |
+
<button id="cleansub" name="cleansub" type="submit">submit</button>
|
233 |
+
</form>
|
234 |
+
</fieldset>
|
235 |
+
</div>
|
236 |
+
<div style="margin-top:20px">
|
237 |
+
<fieldset>
|
238 |
+
<legend>Pull Feed</legend>
|
239 |
+
<?php $pullFeed = $this->pullFeed();?>
|
240 |
+
<form method="post" action="<?php echo $pullFeed['surl'];?>">
|
241 |
<input type="hidden" name="secret" value="<?php echo $pullFeed['secret'];?>">
|
242 |
<p><?php echo $pullFeed['link']; ?></p>
|
243 |
<button type="submit">submit</button>
|
244 |
</form>
|
245 |
+
</fieldset>
|
246 |
+
</div>
|
247 |
+
<!-- <div style="margin-top:20px">
|
248 |
+
<fieldset>
|
249 |
+
<legend>Xml File</legend>
|
250 |
+
<form method="post" action="<?php //echo $this->getBaseUrl().'xml.php';?>" target="_blank">
|
251 |
+
<input type="hidden" name="secret" value="<?php //echo $this->getSecret();?>">
|
252 |
+
<p><?php //echo $this->getBaseUrl().'xml.php'; ?></p>
|
253 |
+
<button type="submit">submit</button>
|
254 |
+
</form>
|
255 |
+
</fieldset>
|
256 |
+
</div> -->
|
257 |
+
</div> <!--End of API Info section-->
|
258 |
+
<div id="feedHeader" class="tab-pane fade"> <!--Defining the feed header page-->
|
259 |
+
<div style="margin-top:20px">
|
260 |
+
<fieldset>
|
261 |
+
<legend>Configure Feed Headers</legend>
|
262 |
+
<form class="setHeadersForm" action="<?php echo $this->getBaseUrl()."index.php/expertrec-feed/config/saveheaders" ; ?>" method="post" role="form" target="_blank">
|
263 |
+
<?php $storedFilters = $this->getStoredFilters();
|
264 |
+
$storedHeaders = $this->getStoredHeaders();
|
265 |
+
?>
|
266 |
+
<?php foreach ($this->getAllAttributes() as $_attr): ?>
|
267 |
+
<?php if($storedHeaders!= null && in_array($_attr, $storedHeaders)): ?>
|
268 |
+
<input type="checkbox" id="<?php echo $_attr; ?>" name="check_list[]" value="<?php echo $_attr; ?>" checked>
|
269 |
+
<?php else: ?>
|
270 |
+
<input type="checkbox" id="<?php echo $_attr; ?>" name="check_list[]" value="<?php echo $_attr; ?>">
|
271 |
+
<?php endif; ?>
|
272 |
+
<label for="<?php echo $_attr; ?>"><?php echo $_attr; ?></label>
|
273 |
+
<?php endforeach; ?>
|
274 |
+
<div style="display:block"> <!--Image config section-->
|
275 |
+
<h4>Expertrec Image</h4>
|
276 |
+
<label for="imagewidth">Image Width</label>
|
277 |
+
<input type="text" id="imagewidth" name="imagewidth" placeholder="Give image width" value="<?php echo $imgwidth; ?>">
|
278 |
+
</div>
|
279 |
+
<div style="display:block">
|
280 |
+
<label for="imageheight">Image Height</label>
|
281 |
+
<input type="text" id="imageheight" name="imageheight" placeholder="Give image height" value="<?php echo $imgheight; ?>">
|
282 |
+
</div>
|
283 |
+
<div style="display:block"> <!--Thumbnail Image config section-->
|
284 |
+
<h4>Expertrec Thumbnail</h4>
|
285 |
+
<label for="thumbnailwidth">Thumbnail Width</label>
|
286 |
+
<input type="text" id="thumbnailwidth" name="thumbnailwidth" placeholder="Give thumbnail width" value="<?php echo $thumbwidth ?>">
|
287 |
+
</div>
|
288 |
+
<div style="display:block">
|
289 |
+
<label for="thumbnailheight">Thumbnail Height</label>
|
290 |
+
<input type="text" id="thumbnailheight" name="thumbnailheight" placeholder="Give thumbnail height" value="<?php echo $thumbheight ?>">
|
291 |
+
</div>
|
292 |
+
<fieldset> <!--Configure Filters section-->
|
293 |
+
<legend>Configure Filters</legend>
|
294 |
+
<p>filter_by_visiblity -- choose from ( not_visible_individually , visible_catalog , visible_search , visible_catalog_search ).</p>
|
295 |
+
<?php foreach ($this->getAllFilters() as $_filter): ?>
|
296 |
+
<?php if($storedFilters != null && in_array($_filter, $storedFilters)): ?>
|
297 |
+
<input type="checkbox" id="<?php echo $_filter; ?>" name="filter_check_list[]" value="<?php echo $_filter; ?>" checked>
|
298 |
+
<?php else: ?>
|
299 |
+
<input type="checkbox" id="<?php echo $_filter; ?>" name="filter_check_list[]" value="<?php echo $_filter; ?>">
|
300 |
+
<?php endif; ?>
|
301 |
+
<label for="<?php echo $_filter; ?>"><?php echo $_filter; ?></label>
|
302 |
+
<?php endforeach; ?>
|
303 |
+
</fieldset>
|
304 |
+
<div style="text-align:center;margin:10px auto;">
|
305 |
+
<input type="hidden" name="secret" value="<?php echo $this->getSecret();?>">
|
306 |
+
<input type="button" class="btn btn-md btn-primary" id="toggleSelect" value="Select All" onClick="toggle_select()" style="padding:5px; margin: 5px;"/>
|
307 |
+
<input type="submit" class="btn btn-md btn-primary" name="selected_headers" value="Submit" style= "padding:5px; margin: 5px;"/>
|
308 |
+
</div>
|
309 |
+
</form>
|
310 |
+
</fieldset>
|
311 |
+
<?php if($storedHeaders != "" && isset($storedHeaders) && count($storedHeaders) > 0): ?>
|
312 |
+
<fieldset style="margin-top:20px;"> <!--Displaying selected headers-->
|
313 |
+
<legend>Selected Headers</legend>
|
314 |
+
<div class="setHeadersForm">
|
315 |
+
<?php foreach ($this->getStoredHeaders() as $_header): ?>
|
316 |
+
<input type="checkbox" name="<?php echo $_header; ?>" value="<?php echo $_header; ?>" disabled checked>
|
317 |
+
<label><?php echo $_header; ?></label>
|
318 |
+
<?php endforeach; ?>
|
319 |
+
</div>
|
320 |
+
</fieldset>
|
321 |
+
<?php endif;?>
|
322 |
+
<?php $filter = Mage::getStoreConfig('expertrec/general/filters');
|
323 |
+
if($filter != "" && isset($storedFilters) && count($storedFilters) > 0): ?>
|
324 |
+
<fieldset style="margin-top:20px;"> <!--Displaying selected filters-->
|
325 |
+
<legend>Selected Filters</legend>
|
326 |
+
<div class="setHeadersForm">
|
327 |
+
<?php foreach ($this->getStoredFilters() as $_sfilter): ?>
|
328 |
+
<input type="checkbox" name="<?php echo $_sfilter; ?>" value="<?php echo $_sfilter; ?>" disabled checked>
|
329 |
+
<label><?php echo $_sfilter; ?></label>
|
330 |
+
<?php endforeach; ?>
|
331 |
+
</div>
|
332 |
+
</fieldset>
|
333 |
+
<?php endif;?>
|
334 |
+
</div>
|
335 |
+
</div> <!--End of feed header section-->
|
336 |
+
<div id="feedEndpointSection" class="tab-pane fade"> <!-- Feed api configuration section start -->
|
337 |
+
<div style="margin-top:20px">
|
338 |
+
<fieldset>
|
339 |
+
<legend>Configure Feed</legend>
|
340 |
+
<form class="form-horizontal" action="<?php echo $this->getBaseUrl()."index.php/expertrec-feed/config/savefeedconf" ; ?>" method="post" role="form" target="_blank">
|
341 |
+
<?php foreach ($this->getFeedConfUrl() as $_feedUrl): ?>
|
342 |
+
<div class="form-group">
|
343 |
+
<label class="control-label col-sm-2" for="search_<?php echo $_feedUrl['tkey'] ?>"><?php echo $_feedUrl['label'] ?>:</label>
|
344 |
+
<div class="col-sm-8">
|
345 |
+
<?php if(isset($_feedUrl["storevalue"])): ?>
|
346 |
+
<input type="text" class="form-control"
|
347 |
+
id="<?php echo $_feedUrl['tkey'] ?>"
|
348 |
+
name="<?php echo $_feedUrl['tkey'] ?>"
|
349 |
+
value="<?php echo $_feedUrl['storevalue'] ?>"
|
350 |
+
placeholder="<?php echo $_feedUrl['placeholder'] ?>">
|
351 |
+
<?php else: ?>
|
352 |
+
<input type="text" class="form-control"
|
353 |
+
id="<?php echo $_feedUrl['tkey'] ?>"
|
354 |
+
name="<?php echo $_feedUrl['tkey'] ?>" placeholder="<?php echo $_feedUrl['placeholder'] ?>">
|
355 |
+
<?php endif; ?>
|
356 |
+
</div>
|
357 |
+
</div>
|
358 |
+
<?php endforeach; ?>
|
359 |
+
<div class="row">
|
360 |
+
<div class="col-sm-offset-2 col-sm-8" style="clear:both;">
|
361 |
+
<label class="checkbox-inline" style="padding-left: 20px;">
|
362 |
+
<?php if($this->isFeedUpload() != null && $this->isFeedUpload() == 'true'): ?>
|
363 |
+
<input type="checkbox" name="upload_feed" value="is_upload" checked>
|
364 |
+
<?php else: ?>
|
365 |
+
<input type="checkbox" name="upload_feed" value="is_upload">
|
366 |
+
<?php endif; ?> Upload Feed
|
367 |
+
</label>
|
368 |
+
</div>
|
369 |
+
</div>
|
370 |
+
<div style="text-align:center;margin:10px auto;">
|
371 |
+
<input type="hidden" name="secret" value="<?php echo $this->getSecret() ;?>">
|
372 |
+
<input type="submit" class="btn btn-md btn-primary" name="feed_conf" value="Submit"
|
373 |
+
style="padding:5px; "/>
|
374 |
+
</div>
|
375 |
+
</form>
|
376 |
+
</fieldset>
|
377 |
+
</div>
|
378 |
+
</div> <!-- Feed api configuration section end -->
|
379 |
+
<div id="searchConfSection" class="tab-pane fade"> <!-- search section start -->
|
380 |
+
<div style="margin-top:20px">
|
381 |
+
<fieldset>
|
382 |
+
<legend>Configure Search</legend>
|
383 |
+
<form class="form-horizontal" action="<?php echo $this->getBaseUrl()."index.php/expertrec-feed/config/savesearch" ; ?>" method="post" role="form" target="_blank">
|
384 |
+
<?php foreach ($this->getSearchFields() as $_searchFields): ?>
|
385 |
+
<div class="form-group">
|
386 |
+
<label class="control-label col-sm-2" for="search_<?php echo $_searchFields['tkey'] ?>"><?php echo $_searchFields['label'] ?>:</label>
|
387 |
+
<div class="col-sm-8">
|
388 |
+
<?php if(isset($_searchFields["storevalue"])): ?>
|
389 |
+
<input type="text" class="form-control" name="<?php echo $_searchFields['tkey'] ?>" id="search_<?php echo $_searchFields['tkey'] ?>" value="<?php echo $_searchFields['storevalue'] ?>" placeholder="<?php echo $_searchFields['placeholder'] ?>">
|
390 |
+
<?php else: ?>
|
391 |
+
<input type="text" class="form-control" name="<?php echo $_searchFields['tkey'] ?>" id="search_<?php echo $_searchFields['tkey'] ?>" placeholder="<?php echo $_searchFields['placeholder'] ?>">
|
392 |
+
<?php endif; ?>
|
393 |
+
</div>
|
394 |
+
</div>
|
395 |
+
<?php endforeach; ?>
|
396 |
+
<div class="form-group">
|
397 |
+
<div class="col-sm-2"></div>
|
398 |
+
<div class="col-sm-8">
|
399 |
+
<?php foreach ($this->getSearchCheckedValues() as $_searchParams): ?>
|
400 |
+
<div class="col-sm-2">
|
401 |
+
<div class="checkbox">
|
402 |
+
<label>
|
403 |
+
<input type="checkbox" name="search_check_list[]" value="<?php echo $_searchParams['val'] ?>" <?php echo $_searchParams['checked'] ?>>
|
404 |
+
<?php echo $_searchParams['label'] ?>
|
405 |
+
</label>
|
406 |
+
</div>
|
407 |
+
</div>
|
408 |
<?php endforeach; ?>
|
409 |
+
</div>
|
410 |
+
</div>
|
411 |
+
<div style="text-align:center;margin:10px auto;">
|
412 |
+
<input type="hidden" name="secret" value="<?php echo $this->getSecret() ;?>">
|
413 |
+
<input type="submit" class="btn btn-md btn-primary" name="selected_search" value="Submit" style="padding:5px; "/>
|
414 |
+
</div>
|
415 |
+
</form>
|
416 |
+
</fieldset>
|
417 |
+
</div>
|
418 |
+
</div> <!-- search section ended-->
|
419 |
+
<div id="siteDetailsSection" class="tab-pane fade"> <!--site details section-->
|
420 |
+
<div style="margin-top:20px">
|
421 |
+
<fieldset>
|
422 |
+
<legend>Site Info</legend>
|
423 |
+
<table class="table table-hover" style="table-layout: fixed;">
|
424 |
+
<tbody>
|
425 |
+
<?php $siteDetails = $this->getSiteDetails();?>
|
426 |
+
<?php $installedExtensions = $this->getInstalledExtensions(); ?>
|
427 |
+
<?php $activeExtensions = $this->getActiveExtensions($installedExtensions['modulearr']); ?>
|
428 |
+
<?php if(isset($siteDetails["adminName"])): ?>
|
429 |
+
<tr>
|
430 |
+
<td style="width: 20%;"><strong>Admin name: </strong></td>
|
431 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["adminName"]; ?></td>
|
432 |
+
</tr>
|
433 |
+
<?php endif; ?>
|
434 |
+
<?php if(isset($siteDetails["adminEmail"])): ?>
|
435 |
+
<tr>
|
436 |
+
<td style="width: 20%;"><strong>Admin email: </strong></td>
|
437 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["adminEmail"]; ?></td>
|
438 |
+
</tr>
|
439 |
+
<?php endif; ?>
|
440 |
+
<?php if(isset($siteDetails["salesName"])): ?>
|
441 |
+
<tr>
|
442 |
+
<td style="width: 20%;"><strong>Sales name: </strong></td>
|
443 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["salesName"]; ?></td>
|
444 |
+
</tr>
|
445 |
+
<?php endif; ?>
|
446 |
+
<?php if(isset($siteDetails["salesEmail"])): ?>
|
447 |
+
<tr>
|
448 |
+
<td style="width: 20%;"><strong>Sales email: </strong></td>
|
449 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["salesEmail"]; ?></td>
|
450 |
+
</tr>
|
451 |
+
<?php endif; ?>
|
452 |
+
<?php if(isset($siteDetails["secureUrl"])): ?>
|
453 |
+
<tr>
|
454 |
+
<td style="width: 20%;"><strong>Web secure base URL: </strong></td>
|
455 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["secureUrl"]; ?></td>
|
456 |
+
</tr>
|
457 |
+
<?php endif; ?>
|
458 |
+
<?php if(isset($siteDetails["unsecureUrl"])): ?>
|
459 |
+
<tr>
|
460 |
+
<td style="width: 20%;"><strong>Web unsecure base URL: </strong></td>
|
461 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["unsecureUrl"]; ?></td>
|
462 |
+
</tr>
|
463 |
+
<?php endif; ?>
|
464 |
+
<?php if(isset($siteDetails["baseCurrency"])): ?>
|
465 |
+
<tr>
|
466 |
+
<td style="width: 20%;"><strong>Base currency: </strong></td>
|
467 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["baseCurrency"]; ?></td>
|
468 |
+
</tr>
|
469 |
+
<?php endif; ?>
|
470 |
+
<?php if(isset($siteDetails["defaultCurrency"])): ?>
|
471 |
+
<tr>
|
472 |
+
<td style="width: 20%;"><strong>Default currency: </strong></td>
|
473 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["defaultCurrency"]; ?></td>
|
474 |
+
</tr>
|
475 |
+
<?php endif; ?>
|
476 |
+
<?php if(isset($siteDetails["allowCurrency"])): ?>
|
477 |
+
<tr>
|
478 |
+
<td style="width: 20%;"><strong>Allowed currencies: </strong></td>
|
479 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["allowCurrency"]; ?></td>
|
480 |
+
</tr>
|
481 |
+
<?php endif; ?>
|
482 |
+
<?php if(isset($siteDetails["installedCurrency"])): ?>
|
483 |
+
<tr>
|
484 |
+
<td style="width: 20%;"><strong>Installed currencies: </strong></td>
|
485 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["installedCurrency"]; ?></td>
|
486 |
+
</tr>
|
487 |
+
<?php endif; ?>
|
488 |
+
<?php if(isset($siteDetails["defaultCountry"])): ?>
|
489 |
+
<tr>
|
490 |
+
<td style="width: 20%;"><strong>Default country: </strong></td>
|
491 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["defaultCountry"]; ?></td>
|
492 |
+
</tr>
|
493 |
+
<?php endif; ?>
|
494 |
+
<?php if(isset($siteDetails["timezone"])): ?>
|
495 |
+
<tr>
|
496 |
+
<td style="width: 20%;"><strong>Timezone: </strong></td>
|
497 |
+
<td style="word-wrap:break-word;"><?php echo $siteDetails["timezone"]; ?></td>
|
498 |
+
</tr>
|
499 |
+
<?php endif; ?>
|
500 |
+
<?php if(isset($installedExtensions["modulestr"])): ?>
|
501 |
+
<tr>
|
502 |
+
<td style="width: 20%;"><strong>Installed Extensions: </strong></td>
|
503 |
+
<td style="word-wrap:break-word;"><?php echo $installedExtensions["modulestr"]; ?></td>
|
504 |
+
</tr>
|
505 |
+
<?php endif; ?>
|
506 |
+
<?php if(isset($installedExtensions["errorstr"])): ?>
|
507 |
+
<tr>
|
508 |
+
<td style="width: 20%;"><strong>Installed Extensions(Error): </strong></td>
|
509 |
+
<td style="color:red;word-wrap:break-word;"><?php echo $installedExtensions['errorstr'];?></td>
|
510 |
+
</tr>
|
511 |
+
<?php endif; ?>
|
512 |
+
<?php if(isset($activeExtensions["modulestr"])): ?>
|
513 |
+
<tr>
|
514 |
+
<td style="width: 20%;"><strong>Active Extensions: </strong></td>
|
515 |
+
<td style="word-wrap:break-word;"><?php echo $activeExtensions["modulestr"]; ?></td>
|
516 |
+
</tr>
|
517 |
+
<?php endif; ?>
|
518 |
+
<?php if(isset($activeExtensions["errorstr"])): ?>
|
519 |
+
<tr>
|
520 |
+
<td style="width: 20%;"><strong>Active Extensions(Error): </strong></td>
|
521 |
+
<td style="color:red;word-wrap:break-word;"><?php echo $activeExtensions['errorstr'];?></td>
|
522 |
+
</tr>
|
523 |
+
<?php endif; ?>
|
524 |
+
</tbody>
|
525 |
+
</table>
|
526 |
+
</fieldset>
|
527 |
+
</div>
|
528 |
+
</div><!--site details section ended-->
|
529 |
+
</div><!-- end tab-content -->
|
530 |
+
</div><!-- end container-fluid -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/expertrec/recommendation/tracker.phtml
CHANGED
@@ -1,45 +1,35 @@
|
|
1 |
-
|
2 |
<script type="text/javascript">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
$
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
|
17 |
-
Mage::logException($e);
|
18 |
-
}
|
19 |
-
|
20 |
-
?>
|
21 |
-
|
22 |
-
if(typeof expertSiteConf == 'undefined' || expertSiteConf == null) {
|
23 |
-
var expertSiteConf = {
|
24 |
-
currency: "<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>",
|
25 |
-
formkey:"<?php echo $formKey; ?>"
|
26 |
-
<?php if (isset($category)) { ?>
|
27 |
-
,category:"<?php echo $category->getName(); ?>"
|
28 |
-
<?php } ?>
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
//Add website and store id
|
33 |
-
window.expertrecconf = {
|
34 |
merchantId:"<?php echo Mage::getStoreConfig('expertrec/general/mid');?>",
|
35 |
webId:"<?php echo Mage::app()->getWebsite()->getId();?>",
|
36 |
storeId: "<?php echo Mage::app()->getStore()->getId(); ?>",
|
37 |
-
currency: "<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"
|
38 |
-
|
39 |
-
/* * * DON'T EDIT BELOW LINE * * */
|
40 |
-
|
41 |
-
(function(){var domain=window.location.hostname.replace(/\./g,""),ea=document.createElement('script');ea.type='text/javascript';ea.async=true;ea.src='//d3qm5o86jyjko6.cloudfront.net/magento/expertrec_'+domain+'.js';var m=document.getElementsByTagName('script')[0];m.parentNode.insertBefore(ea,m)})();var _eaq=_eaq || [];function expertApi(){if(window.expertrec_true){var args=Array.prototype.slice.call(arguments);window.ea_apispec[args[0]](args.slice(1,args.length))}else{_eaq.push(arguments);}}
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
|
|
1 |
+
<!-- loads on all pages once extension installed and include expertrec js -->
|
2 |
<script type="text/javascript">
|
3 |
+
<?php $category = Mage::registry("current_category");
|
4 |
+
$formKey = '';
|
5 |
+
try{
|
6 |
+
$formkey_html = $this->getBlockHtml('formkey');
|
7 |
+
$pattern = '/.*form_key.*value=\"([^\"]+)\"/s';
|
8 |
+
if (preg_match($pattern, $formkey_html, $match)){
|
9 |
+
if ($match){
|
10 |
+
$formKey = $match[1];
|
11 |
+
}
|
12 |
+
}
|
13 |
+
} catch (Exception $e){
|
14 |
+
Mage::logException($e);
|
15 |
}
|
16 |
+
?>
|
17 |
+
if(typeof expertSiteConf == 'undefined' || expertSiteConf == null) {
|
18 |
+
var expertSiteConf = {
|
19 |
+
currency: "<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>",
|
20 |
+
formkey:"<?php echo $formKey; ?>"
|
21 |
+
<?php if (isset($category)) { ?>
|
22 |
+
,category:"<?php echo $category->getName(); ?>"
|
23 |
+
<?php } ?>
|
24 |
+
};
|
25 |
}
|
26 |
+
window.expertrecconf = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
merchantId:"<?php echo Mage::getStoreConfig('expertrec/general/mid');?>",
|
28 |
webId:"<?php echo Mage::app()->getWebsite()->getId();?>",
|
29 |
storeId: "<?php echo Mage::app()->getStore()->getId(); ?>",
|
30 |
+
currency: "<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"
|
31 |
+
};
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
/* * * DON'T EDIT BELOW LINE * * */
|
34 |
+
(function(){var domain=window.location.hostname.replace(/\./g,""),ea=document.createElement('script');ea.type='text/javascript';ea.async=true;ea.src='//d3qm5o86jyjko6.cloudfront.net/magento/expertrec_'+domain+'.js';var m=document.getElementsByTagName('script')[0];m.parentNode.insertBefore(ea,m)})();var _eaq=_eaq || [];function expertApi(){if(window.expertrec_true){var args=Array.prototype.slice.call(arguments);window.ea_apispec[args[0]](args.slice(1,args.length))}else{_eaq.push(arguments);}}
|
35 |
+
</script>
|
app/design/frontend/base/default/template/expertrec/recommendation/tracking/product.phtml
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
-
|
2 |
<script type="text/javascript">
|
3 |
-
<?php $product = Mage::registry('current_product');
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
</script>
|
14 |
-
<?php ?>
|
1 |
+
<!-- loads on product_view and get product_id -->
|
2 |
<script type="text/javascript">
|
3 |
+
<?php $product = Mage::registry('current_product');
|
4 |
+
if (isset($product)) { ?>
|
5 |
+
expertSiteConf["pid"] = "<?php echo Mage::helper('expertrec_recommendation')->getUniqueId($product); ?>";
|
6 |
+
<?php } ?>
|
7 |
+
(function(){
|
8 |
+
var pid = expertSiteConf.pid ? expertSiteConf.pid : window.location.href;
|
9 |
+
expertApi(1,pid);
|
10 |
+
})();
|
11 |
+
</script>
|
|
|
|
|
|
app/design/frontend/base/default/template/expertrec/search/custom.phtml
CHANGED
@@ -1,2 +1,5 @@
|
|
|
|
|
|
|
|
1 |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
|
2 |
<div id="expertrec_search_result_list"></div>
|
1 |
+
<!--
|
2 |
+
loads expertrec_search_result_list div
|
3 |
+
-->
|
4 |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
|
5 |
<div id="expertrec_search_result_list"></div>
|
app/design/frontend/base/default/template/expertrec/search/list.phtml
CHANGED
@@ -1,23 +1,20 @@
|
|
|
|
|
|
|
|
1 |
<div class="page-title">
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
</div>
|
6 |
-
|
7 |
<div id="expertrec_search_result_list">
|
8 |
-
<?php
|
9 |
-
|
10 |
-
?>
|
11 |
</div>
|
12 |
-
|
13 |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
14 |
<script type="text/javascript">
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
function erAttachFilterEvent(){erjq("#er_Filteroption .filter-search a").each(function(){var b=this,c="",e="",d=[],a=erjq(window).width();erjq(this).click(function(){if(a<771){erCloseFilter()}erjq("#expertrec-overlay").css("display","block");c=erjq(b).find("input").val();if(c){d=c.split("?");if(d.length==2){e=/\/$/.test(d[0])?d[0]+"ajax":d[0]+"/ajax";e+="?"+d[1];e=typeof erGetFilterPrice=="function"?erGetFilterPrice(e):e;erMakeDealsCall(e)}else{window.location.href=c}}})})}erjq(document).ready(function(){erAttachFilterEvent()});
|
20 |
-
|
21 |
-
<?php }?>
|
22 |
-
|
23 |
</script>
|
1 |
+
<!--
|
2 |
+
loads expertrec_search_result_list js
|
3 |
+
-->
|
4 |
<div class="page-title">
|
5 |
+
<h1>
|
6 |
+
<?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
|
7 |
+
</h1>
|
8 |
</div>
|
|
|
9 |
<div id="expertrec_search_result_list">
|
10 |
+
<?php
|
11 |
+
echo Mage::registry('expertrec_search_list');
|
12 |
+
?>
|
13 |
</div>
|
|
|
14 |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
15 |
<script type="text/javascript">
|
16 |
+
var erjq=jQuery.noConflict(true);function erOpenFilter(){erjq("#er_Filteroption").css("width","100%");erjq("body").css("overflow","hidden")}function erCloseFilter(){erjq("#er_Filteroption").css("width","0px");erjq("body").css("overflow","visible")}function erShowProduct(a){var c=a,d=c.listHtml||"",b=c.facetHtml||"";d&&erjq("#expertrec_search_result_list").html(d);b&&erjq("#expertrec_search_result_navigation").html(b);if(typeof erDisplayPriceFilter=="function"){erDisplayPriceFilter()}erjq("#expertrec-overlay").css("display","none");erAttachFilterEvent();erToggleNavigation()}function erMakeDealsCall(a){erjq.ajax({url:a,type:"GET",dataType:"json",success:erShowProduct,error:function(){erjq("#expertrec-overlay").css("display","none")}})}function erToggleNavigation(){erjq(".toggle-content").each(function(){var a=erjq(this);var c=a.hasClass("tabs");var g=a.hasClass("accordion");var e=a.hasClass("open");var j=a.children("dl:first");var d=j.children("dt");var l=j.children("dd");var b=new Array(d,l);if(c){var k=erjq('<ul class="toggle-tabs"></ul>');d.each(function(){var n=erjq(this);var i=erjq("<li></li>");i.html(n.html());k.append(i)});k.insertBefore(j);var m=k.children();b.push(m)}var f;for(f=0;f<b.length;f++){b[f].filter(":last").addClass("last")}function h(o,q){var n=q.index(o);var p;for(p=0;p<b.length;p++){b[p].removeClass("current");b[p].eq(n).addClass("current")}}d.on("click",function(i){if(erjq(this).hasClass("current")&&a.hasClass("accordion-open")){a.removeClass("accordion-open")}else{a.addClass("accordion-open")}h(erjq(this),d)});if(c){m.on("click",function(i){h(erjq(this),m)});m.eq(0).trigger("click")}if(e){d.eq(0).trigger("click")}})}erjq(document).ready(function(){var a=function(){if(erjq(window).width()<=771){erjq("#er_Filteroption").css("width","0px");erjq("#expertrec_search_result_navigation").prependTo(erjq("#expertrec_search_result_list"))}else{erjq("#er_Filteroption").css("width","100%");erjq(".col-left").first().prepend(erjq("#expertrec_search_result_navigation"))}};a();erjq(window).resize(function(){a()})});
|
17 |
+
<?php if(Mage::helper('expertrec_recommendation/search_layout')->getIsAjax()){ ?>
|
18 |
+
function erAttachFilterEvent(){erjq("#er_Filteroption .filter-search a").each(function(){var b=this,c="",e="",d=[],a=erjq(window).width();erjq(this).click(function(){if(a<771){erCloseFilter()}erjq("#expertrec-overlay").css("display","block");c=erjq(b).find("input").val();if(c){d=c.split("?");if(d.length==2){e=/\/$/.test(d[0])?d[0]+"ajax":d[0]+"/ajax";e+="?"+d[1];e=typeof erGetFilterPrice=="function"?erGetFilterPrice(e):e;erMakeDealsCall(e)}else{window.location.href=c}}})})}erjq(document).ready(function(){erAttachFilterEvent()});
|
19 |
+
<?php }?>
|
|
|
|
|
|
|
|
|
20 |
</script>
|
app/design/frontend/base/default/template/expertrec/search/view.phtml
CHANGED
@@ -1,16 +1,14 @@
|
|
|
|
|
|
|
|
1 |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
|
2 |
<style type="text/css">
|
3 |
#expertrec_search_result_list .note-msg {color:red;font-size:1.2em;}#er_Filteroption .no-display {display: block !important;}#expertrec_search_result_list .products-grid>li{position:relative;margin-bottom:20px;text-align:center}#expertrec_search_result_list .products-grid>li{float:left;width:47.72727%;}#expertrec_search_result_list .products-grid>li:nth-child(2n+1){clear:left}#expertrec_search_result_list .products-grid .product-image{margin-bottom:5px;text-align:center;margin-left:auto;margin-right:auto;display:block;width:100%}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important;position:relative}#expertrec_search_result_list .products-grid .product-name,#expertrec_search_result_list .products-list .product-name{text-transform:uppercase;margin-bottom:5px;font-size:14px;font-weight:normal;line-height:1.4;font-style:normal}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0;padding-top:10px;min-height:85px;width:100%;font-size:14px}#expertrec_search_result_list .add-to-links{margin:7px 0}#expertrec_search_result_list .add-to-links a{display:inline-block;padding:0 3px 3px}#expertrec_search_result_list .products-grid li.item button.btn-cart{width:100%}#expertrec_search_result_list .currently ol li .value,#expertrec_search_result_list .currently ol li .multivalue{padding:0 10px}#expertrec_search_result_list .currently ol li .label{text-transform:capitalize;font-weight:bold}#expertrec_search_result_list .currently ol li{margin-bottom:5px}#expertrec_search_result_list .currently ol li::after{content:'';display:table;clear:both}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:none}#expertrec_search_result_navigation .listing-filter{display:none}#er_Filteroption .toggle-content .block-subtitle{float:none;text-align:center}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .block-content>dl>dd{background:#fff}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a .count{color:#949494;font-size:12px}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected{color:#5a647c}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected:hover{text-decoration:none}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .currently ol{padding-left:0;margin-bottom:10px}#expertrec_search_result_navigation #narrow-by-list{border-radius:3px;box-shadow:0 0 4px rgba(0,0,0,.2)}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:250px;overflow-y:auto}.expertrec-filter-attr .fa-square-o,.expertrec-filter-cat .fa-square-o{display:inline-block}.expertrec-filter-attr .fa-check-square-o,.expertrec-filter-cat .fa-check-square-o{display:none}.expertrec-filter-attr-selected .fa-square-o,.expertrec-filter-cat-selected .fa-square-o{display:none}.expertrec-filter-attr-selected .fa-check-square-o,.expertrec-filter-cat-selected .fa-check-square-o{display:inline-block}#expertrec-overlay{display:none;background-color:#000;height:100%;left:0;opacity:.7;filter:alpha(opacity= 50);position:fixed;top:0;width:100%;z-index:999}#expertrec-overlay img{top:45%;left:48%;display:block;position:fixed;z-index:900}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important}#expertrec_search_result_list .products-grid .product-image img{width:100%;height:auto}@media only screen and (max-width:770px){#er_Filteroption .block-title{display:none}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:150px}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:block}#expertrec_search_result_navigation .mobile-filter-closer{text-align:center;padding:10px 5px;background:#f04f25;color:#fff;width:99%;margin:10px auto;max-width:300px;clear:both;cursor:pointer}#expertrec_search_result_navigation .listing-filter{display:block;font-size:12px}#expertrec_search_result_navigation .listing-filter{display:block;border:1px solid #e7e7e7;text-align:center;margin-bottom:15px;width:80%;margin:0 auto 15px;padding:10px 5px;border-radius:5px}#expertrec_search_result_navigation .overlay-filter{height:100%;width:0;position:fixed;z-index:2000;top:0;left:0;background-color:#f3f3f3;overflow-x:hidden;transition:.5s}}@media only screen and (max-width:600px){#expertrec_search_result_list .products-list .desc{display:none}}@media only screen and (min-width:480px){#expertrec_search_result_list .products-grid>li:nth-child(odd){clear:none}#expertrec_search_result_list .products-grid>li:nth-child(even){margin-right:3.7037%}#expertrec_search_result_list .products-grid>li{width:30.8642%;margin-right:3.7037%}#expertrec_search_result_list .products-grid>li:nth-child(3n+1){clear:left}#expertrec_search_result_list .products-grid>li:nth-child(3n){margin-right:0}}
|
4 |
</style>
|
5 |
-
|
6 |
-
|
7 |
<div id="expertrec_search_result_navigation">
|
8 |
-
<?php
|
9 |
-
|
10 |
-
echo $expertrec_search_navigation;
|
11 |
-
?>
|
12 |
</div>
|
13 |
-
|
14 |
<div id="expertrec-overlay">
|
15 |
-
|
16 |
</div>
|
1 |
+
<!--
|
2 |
+
loads expertrec_search_result_list css
|
3 |
+
-->
|
4 |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
|
5 |
<style type="text/css">
|
6 |
#expertrec_search_result_list .note-msg {color:red;font-size:1.2em;}#er_Filteroption .no-display {display: block !important;}#expertrec_search_result_list .products-grid>li{position:relative;margin-bottom:20px;text-align:center}#expertrec_search_result_list .products-grid>li{float:left;width:47.72727%;}#expertrec_search_result_list .products-grid>li:nth-child(2n+1){clear:left}#expertrec_search_result_list .products-grid .product-image{margin-bottom:5px;text-align:center;margin-left:auto;margin-right:auto;display:block;width:100%}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important;position:relative}#expertrec_search_result_list .products-grid .product-name,#expertrec_search_result_list .products-list .product-name{text-transform:uppercase;margin-bottom:5px;font-size:14px;font-weight:normal;line-height:1.4;font-style:normal}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0;padding-top:10px;min-height:85px;width:100%;font-size:14px}#expertrec_search_result_list .add-to-links{margin:7px 0}#expertrec_search_result_list .add-to-links a{display:inline-block;padding:0 3px 3px}#expertrec_search_result_list .products-grid li.item button.btn-cart{width:100%}#expertrec_search_result_list .currently ol li .value,#expertrec_search_result_list .currently ol li .multivalue{padding:0 10px}#expertrec_search_result_list .currently ol li .label{text-transform:capitalize;font-weight:bold}#expertrec_search_result_list .currently ol li{margin-bottom:5px}#expertrec_search_result_list .currently ol li::after{content:'';display:table;clear:both}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:none}#expertrec_search_result_navigation .listing-filter{display:none}#er_Filteroption .toggle-content .block-subtitle{float:none;text-align:center}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .block-content>dl>dd{background:#fff}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a .count{color:#949494;font-size:12px}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected{color:#5a647c}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected:hover{text-decoration:none}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .currently ol{padding-left:0;margin-bottom:10px}#expertrec_search_result_navigation #narrow-by-list{border-radius:3px;box-shadow:0 0 4px rgba(0,0,0,.2)}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:250px;overflow-y:auto}.expertrec-filter-attr .fa-square-o,.expertrec-filter-cat .fa-square-o{display:inline-block}.expertrec-filter-attr .fa-check-square-o,.expertrec-filter-cat .fa-check-square-o{display:none}.expertrec-filter-attr-selected .fa-square-o,.expertrec-filter-cat-selected .fa-square-o{display:none}.expertrec-filter-attr-selected .fa-check-square-o,.expertrec-filter-cat-selected .fa-check-square-o{display:inline-block}#expertrec-overlay{display:none;background-color:#000;height:100%;left:0;opacity:.7;filter:alpha(opacity= 50);position:fixed;top:0;width:100%;z-index:999}#expertrec-overlay img{top:45%;left:48%;display:block;position:fixed;z-index:900}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important}#expertrec_search_result_list .products-grid .product-image img{width:100%;height:auto}@media only screen and (max-width:770px){#er_Filteroption .block-title{display:none}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:150px}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:block}#expertrec_search_result_navigation .mobile-filter-closer{text-align:center;padding:10px 5px;background:#f04f25;color:#fff;width:99%;margin:10px auto;max-width:300px;clear:both;cursor:pointer}#expertrec_search_result_navigation .listing-filter{display:block;font-size:12px}#expertrec_search_result_navigation .listing-filter{display:block;border:1px solid #e7e7e7;text-align:center;margin-bottom:15px;width:80%;margin:0 auto 15px;padding:10px 5px;border-radius:5px}#expertrec_search_result_navigation .overlay-filter{height:100%;width:0;position:fixed;z-index:2000;top:0;left:0;background-color:#f3f3f3;overflow-x:hidden;transition:.5s}}@media only screen and (max-width:600px){#expertrec_search_result_list .products-list .desc{display:none}}@media only screen and (min-width:480px){#expertrec_search_result_list .products-grid>li:nth-child(odd){clear:none}#expertrec_search_result_list .products-grid>li:nth-child(even){margin-right:3.7037%}#expertrec_search_result_list .products-grid>li{width:30.8642%;margin-right:3.7037%}#expertrec_search_result_list .products-grid>li:nth-child(3n+1){clear:left}#expertrec_search_result_list .products-grid>li:nth-child(3n){margin-right:0}}
|
7 |
</style>
|
|
|
|
|
8 |
<div id="expertrec_search_result_navigation">
|
9 |
+
<?php $expertrec_search_navigation = Mage::registry('expertrec_search_navigation');
|
10 |
+
echo $expertrec_search_navigation; ?>
|
|
|
|
|
11 |
</div>
|
|
|
12 |
<div id="expertrec-overlay">
|
13 |
+
<img src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif">
|
14 |
</div>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Expertrec_Recommendation</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Expertrec search extension helps you have complete control over your site search results. You will be able to add instant autocomplete, spell corrections that learn from the user behaviour on your site, and show product recommendations within the search user interface. It also adds search results pages with facets, sorting by different attributes.</description>
|
11 |
<notes>Expertrec Recommendation plugin for magento sites.</notes>
|
12 |
<authors><author><name>melchi</name><user>melchi</user><email>magento@cloudinfra.in</email></author><author><name>magento</name><user>magento</user><email>magento-team@cloudinfra.in</email></author></authors>
|
13 |
-
<date>2017-04-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Expertrec_Recommendation</name>
|
4 |
+
<version>1.2.12</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Expertrec search extension helps you have complete control over your site search results. You will be able to add instant autocomplete, spell corrections that learn from the user behaviour on your site, and show product recommendations within the search user interface. It also adds search results pages with facets, sorting by different attributes.</description>
|
11 |
<notes>Expertrec Recommendation plugin for magento sites.</notes>
|
12 |
<authors><author><name>melchi</name><user>melchi</user><email>magento@cloudinfra.in</email></author><author><name>magento</name><user>magento</user><email>magento-team@cloudinfra.in</email></author></authors>
|
13 |
+
<date>2017-04-20</date>
|
14 |
+
<time>05:42:44</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="e7997269c80ea4c7bc24ad67f843ca00"/></dir><dir name="Helper"><file name="Autocompletehelper.php" hash="2a4f4202f7414158764a8e05cbefd596"/><file name="Data.php" hash="7e3728b4efa9ee373f73878a6a665528"/><file name="Filehelper.php" hash="f0deaedcbef965a14b905aea7946d533"/><dir name="Search"><file name="Layout.php" hash="6b0681539b719913caa5107a16ba8549"/></dir><file name="Suggestionhelper.php" hash="9316b6a6412961fbcd05d5a33dc23bcd"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="cd9a43c25e5251df1af848d6a8d371fb"/></dir><dir name="Feed"><file name="Feedconfig.php" hash="77a806249b1a64a5e0e83d010f835130"/><file name="Feedcreator.php" hash="e32cb528c8fb5085adfa06aaae9a92a7"/><file name="Feedfilter.php" hash="1413a1b24f7352a4a592fa5eb9ea395a"/><file name="Formatter.php" hash="a5a92069c5985fc678dd19ebca13e2ce"/></dir><file name="Feed.php" hash="3ddfbd9ba5d9845d1d546581a9f71701"/><file name="Log.php" hash="a96f0a142abc0a2c49e8134599d1eb93"/><file name="Observer.php" hash="5eba7369db2404b0c38633082a0a3835"/><dir name="Translator"><file name="Category.php" hash="a1d8248562da426aab2ca319cebbb3c9"/></dir><file name="Validate.php" hash="c4be906568d7e10e51e6a4a42541bf5c"/><dir name="Writer"><file name="Abstract.php" hash="cafb19a4f943e200b775caec92bebd93"/><file name="Csv.php" hash="27d3188526f885de87b882d196a16c6d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="4aec75bacab301a25c34bc2eecb57bcf"/></dir><file name="ApiController.php" hash="924efcd99baff64ff284b88e61763451"/><dir name="CatalogSearch"><file name="ResultController.php" hash="e740f44c0cef4aa83545f2278626e7de"/></dir><file name="ConfigController.php" hash="07af2da00256ce6ab54a98b2980ea348"/><file name="IndexController.php" hash="842d75f0f36821bf930c46230ff85f6c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4d5ac7be55302f8555d5b3191e8cb70d"/><file name="config.xml" hash="374bb9d086230e7c4e678d1ead140c79"/></dir><dir name="sql"><dir name="expertrec_setup"><file name="mysql4-install-1.2.12.php" hash="76402116039c9d3d6c2510deb8fa6e88"/><file name="mysql4-upgrade-1.2.11-1.2.12.php" hash="de530347d7766950d3f98d1a4994e244"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Expertrec_Recommendation.xml" hash="c314465f907c89dfe912035be8d48e71"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="42f5f223bf42b357cb43829ac3d74fe1"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="feed"><file name="info.phtml" hash="a41d86f3cc01eb09a7dab6da3b203612"/></dir><dir name="recommendation"><file name="tracker.phtml" hash="e903c52c49f3e8c6b5c3ba939e652dfd"/><dir name="tracking"><file name="product.phtml" hash="3dda590a1cdfb25461fbdecd0b548860"/></dir></dir><dir name="search"><file name="custom.phtml" hash="b1bccc7ed9a04472add4192e05dcca24"/><file name="list.phtml" hash="9ff42c7a725ecab6274b1ab768fed95b"/><file name="view.phtml" hash="f86df8e975bf5bfb7733b85655f1911c"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="640762ea93c7657975314b8282f53498"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="recommendation"><file name="notifications.phtml" hash="f264dfe05d0fd53c754a071a28cd415c"/></dir></dir></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>
|