@@ -42,12 +42,6 @@ class Pimgento_Api_Helper_Configuration extends Mage_Core_Helper_Abstract
42
42
* @var string $productFilterConfigGroup
43
43
*/
44
44
private $ productFilterConfigGroup = 'products_filters ' ;
45
- /**
46
- * Logs config group
47
- *
48
- * @var string $logsConfigGroup
49
- */
50
- private $ logsConfigGroup = 'logs ' ;
51
45
/**
52
46
* Akeneo Url config field
53
47
*
@@ -84,12 +78,6 @@ class Pimgento_Api_Helper_Configuration extends Mage_Core_Helper_Abstract
84
78
* @var string $passConfigField
85
79
*/
86
80
private $ passConfigField = 'pass ' ;
87
- /**
88
- * Module log enabled config field
89
- *
90
- * @var string $logEnabledConfigField
91
- */
92
- private $ logEnabledConfigField = 'log ' ;
93
81
/**
94
82
* Import reindexation enabling select field
95
83
*
@@ -246,12 +234,6 @@ class Pimgento_Api_Helper_Configuration extends Mage_Core_Helper_Abstract
246
234
* @var string $productsFiltersCompletenessValue
247
235
*/
248
236
private $ productsFiltersCompletenessValue = 'completeness_value ' ;
249
- /**
250
- * Product Filter Completness Scope config field
251
- *
252
- * @var string $productsFiltersCompletenessScope
253
- */
254
- private $ productsFiltersCompletenessScope = 'completeness_scope ' ;
255
237
/**
256
238
* Product Filter Completness Locales config field
257
239
*
@@ -270,12 +252,42 @@ class Pimgento_Api_Helper_Configuration extends Mage_Core_Helper_Abstract
270
252
* @var string $productsFiltersFamilies
271
253
*/
272
254
private $ productsFiltersFamilies = 'families ' ;
255
+ /**
256
+ * Product Filter Updated Mode config field
257
+ *
258
+ * @var string $productsFiltersUpdatedMode
259
+ */
260
+ private $ productsFiltersUpdatedMode = 'updated_mode ' ;
261
+ /**
262
+ * Product Filter Updated Lower config field
263
+ *
264
+ * @var string $productsFiltersUpdatedLower
265
+ */
266
+ private $ productsFiltersUpdatedLower = 'updated_lower ' ;
267
+ /**
268
+ * Product Filter Updated Greater config field
269
+ *
270
+ * @var string $productsFiltersUpdatedGreater
271
+ */
272
+ private $ productsFiltersUpdatedGreater = 'updated_greater ' ;
273
+ /**
274
+ * Product Filter Updated Between Upper config field
275
+ *
276
+ * @var string $productsFiltersUpdatedBetweenUpper
277
+ */
278
+ private $ productsFiltersUpdatedBetweenAfter = 'updated_between_after ' ;
279
+ /**
280
+ * Product Filter Updated Between Lower config field
281
+ *
282
+ * @var string $productsFiltersUpdatedBetweenLower
283
+ */
284
+ private $ productsFiltersUpdatedBetweenBefore = 'updated_between_before ' ;
273
285
/**
274
286
* Product Filter Updated config field
275
287
*
276
288
* @var string $productsFiltersUpdated
277
289
*/
278
- private $ productsFiltersUpdated = 'updated ' ;
290
+ private $ productsFiltersUpdatedSince = 'updated ' ;
279
291
/**
280
292
* Product Filter Advanced Filter config field
281
293
*
@@ -453,41 +465,75 @@ public function getPaginationSize()
453
465
return $ paginationSize ;
454
466
}
455
467
468
+ /**
469
+ * Get Admin Website Default Channel from configuration
470
+ *
471
+ * @return string
472
+ */
473
+ public function getAdminDefaultChannel ()
474
+ {
475
+ return $ this ->getGeneralConfigValue ($ this ->adminWebsiteChannelConfigField );
476
+ }
477
+
456
478
/**
457
479
* Retrieve website mapping
458
480
*
481
+ * @param bool $withDefault
482
+ *
459
483
* @return mixed[]
460
- * @throws Exception
484
+ * @throws Mage_Core_Exception
461
485
*/
462
- public function getWebsiteMapping ()
486
+ public function getWebsiteMapping ($ withDefault = true )
463
487
{
464
- /** @var string $adminChannel */
465
- $ adminChannel = $ this ->getGeneralConfigValue ($ this ->adminWebsiteChannelConfigField );
466
- if (empty ($ adminChannel )) {
467
- return [];
468
- }
469
- /** @var mixed[] $fullMapping */
470
- $ fullMapping = [
471
- [
488
+ /** @var mixed[] $mapping */
489
+ $ mapping = [];
490
+
491
+ if ($ withDefault === true ) {
492
+ /** @var string $adminChannel */
493
+ $ adminChannel = $ this ->getAdminDefaultChannel ();
494
+ if (empty ($ adminChannel )) {
495
+ return $ mapping ;
496
+ }
497
+
498
+ $ mapping [] = [
472
499
'channel ' => $ adminChannel ,
473
500
'website ' => Mage::app ()->getWebsite (0 )->getCode (),
474
- ],
475
- ];
476
- /** @var string $mapping */
477
- $ mapping = $ this ->getGeneralConfigValue ($ this ->websiteMappingConfigField );
478
- if (empty ($ mapping )) {
479
- return $ fullMapping ;
501
+ ];
502
+ }
503
+
504
+ /** @var string $websiteMapping */
505
+ $ websiteMapping = $ this ->getGeneralConfigValue ($ this ->websiteMappingConfigField );
506
+ if (empty ($ websiteMapping )) {
507
+ return $ mapping ;
480
508
}
481
509
482
510
/** @var Mage_Core_Helper_UnserializeArray $unserializeHelper */
483
511
$ unserializeHelper = Mage::helper ('core/unserializeArray ' );
484
- /** @var mixed[] $mapping */
485
- $ mapping = $ unserializeHelper ->unserialize ($ mapping );
486
- if (! empty ($ mapping ) && is_array ($ mapping )) {
487
- $ fullMapping = array_merge ( $ fullMapping , $ mapping) ;
512
+ /** @var mixed[] $websiteMapping */
513
+ $ websiteMapping = $ unserializeHelper ->unserialize ($ websiteMapping );
514
+ if (empty ($ websiteMapping ) || ! is_array ($ websiteMapping )) {
515
+ return $ mapping ;
488
516
}
489
517
490
- return $ fullMapping ;
518
+ $ mapping = array_merge ($ mapping , $ websiteMapping );
519
+
520
+ return $ mapping ;
521
+ }
522
+
523
+ /**
524
+ * Get mapped channels
525
+ *
526
+ * @return string[]
527
+ * @throws Mage_Core_Exception
528
+ */
529
+ public function getMappedChannels ()
530
+ {
531
+ /** @var mixed[] $mapping */
532
+ $ mapping = $ this ->getWebsiteMapping ();
533
+ /** @var string[] $channels */
534
+ $ channels = array_column ($ mapping , 'channel ' , 'channel ' );
535
+
536
+ return $ channels ;
491
537
}
492
538
493
539
/**
@@ -929,16 +975,6 @@ public function getCompletenessValueFilter()
929
975
return $ this ->getProductFilterConfigValue ($ this ->productsFiltersCompletenessValue );
930
976
}
931
977
932
- /**
933
- * Retrieve the scope to apply the completeness filter on
934
- *
935
- * @return string
936
- */
937
- public function getCompletenessScopeFilter ()
938
- {
939
- return $ this ->getProductFilterConfigValue ($ this ->productsFiltersCompletenessScope );
940
- }
941
-
942
978
/**
943
979
* Retrieve the locales to apply the completeness filter on
944
980
*
@@ -962,13 +998,63 @@ public function getStatusFilter()
962
998
}
963
999
964
1000
/**
965
- * Retrieve the updated filter
1001
+ * Retrieve updated mode
1002
+ *
1003
+ * @return string
1004
+ */
1005
+ public function getUpdatedMode ()
1006
+ {
1007
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedMode );
1008
+ }
1009
+
1010
+ /**
1011
+ * Retrieve the updated before filter
1012
+ *
1013
+ * @return string
1014
+ */
1015
+ public function getUpdatedLowerFilter ()
1016
+ {
1017
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedLower );
1018
+ }
1019
+
1020
+ /**
1021
+ * Retrieve the updated after filter
1022
+ *
1023
+ * @return string
1024
+ */
1025
+ public function getUpdatedGreaterFilter ()
1026
+ {
1027
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedGreater );
1028
+ }
1029
+
1030
+ /**
1031
+ * Retrieve the updated after for between filter
1032
+ *
1033
+ * @return string
1034
+ */
1035
+ public function getUpdatedBetweenAfterFilter ()
1036
+ {
1037
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedBetweenAfter );
1038
+ }
1039
+
1040
+ /**
1041
+ * Retrieve the = updated before for between filter
1042
+ *
1043
+ * @return string
1044
+ */
1045
+ public function getUpdatedBetweenBeforeFilter ()
1046
+ {
1047
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedBetweenBefore );
1048
+ }
1049
+
1050
+ /**
1051
+ * Retrieve the updated since filter
966
1052
*
967
1053
* @return string
968
1054
*/
969
- public function getUpdatedFilter ()
1055
+ public function getUpdatedSinceFilter ()
970
1056
{
971
- return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdated );
1057
+ return $ this ->getProductFilterConfigValue ($ this ->productsFiltersUpdatedSince );
972
1058
}
973
1059
974
1060
/**
0 commit comments