mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Add filter for JobManager intervals
This commit is contained in:
parent
6b095b4271
commit
9bf1c88f4b
@ -1,10 +1,10 @@
|
|||||||
# Custom filters
|
# Custom filters
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
If you want to modify data, sent between CRM and CMS you can use custom filters.
|
If you want to modify data, sent between CRM and CMS you can use custom filters.
|
||||||
To use filters you should define a new class in `<prestashop-root>/modules/retailcrm/custom/hooks`. Filename and classname must match the filter name.
|
To use filters you should define a new class in `<prestashop-root>/modules/retailcrm/custom/hooks`. Filename and classname must match the filter name.
|
||||||
Filter class should implement interface *RetailcrmFilterInterface*. In filter class you must define *filter()* function, which will take initial `$object` and return customized `$object`.
|
Filter class should implement interface *RetailcrmFilterInterface*. In filter class you must define *filter()* function, which will take initial `$object` and return customized `$object`.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class RetailcrmFilterSaveCustomerAddress implements RetailcrmFilterInterface
|
|||||||
* @var array $dataCrm CRM address data
|
* @var array $dataCrm CRM address data
|
||||||
* @var Address $object CMS Address object
|
* @var Address $object CMS Address object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$dataCrm = $parameters['dataCrm'];
|
$dataCrm = $parameters['dataCrm'];
|
||||||
|
|
||||||
if (isset($dataCrm['dni'])) {
|
if (isset($dataCrm['dni'])) {
|
||||||
@ -57,3 +57,5 @@ There are list of available filters:
|
|||||||
* *RetailcrmFilterSaveCustomerAddress* - built customer address object, which will be saved to CMS
|
* *RetailcrmFilterSaveCustomerAddress* - built customer address object, which will be saved to CMS
|
||||||
* *RetailcrmFilterSaveCorporateCustomer* - built corporate customer object, which will be saved to CMS
|
* *RetailcrmFilterSaveCorporateCustomer* - built corporate customer object, which will be saved to CMS
|
||||||
* *RetailcrmFilterSaveCorporateCustomerAddress* - built corporate customer address object, which will be saved to CMS
|
* *RetailcrmFilterSaveCorporateCustomerAddress* - built corporate customer address object, which will be saved to CMS
|
||||||
|
|
||||||
|
* *RetailcrmFilterJobManagerIntervals* - array with jobs as keys and intervals as values
|
||||||
|
@ -707,12 +707,17 @@ class RetailcrmTools
|
|||||||
*/
|
*/
|
||||||
public static function startJobManager()
|
public static function startJobManager()
|
||||||
{
|
{
|
||||||
RetailcrmJobManager::startJobs(array(
|
$intervals = array(
|
||||||
'RetailcrmClearLogsEvent' => new \DateInterval('P1D'),
|
'RetailcrmClearLogsEvent' => new \DateInterval('P1D'),
|
||||||
'RetailcrmIcmlEvent' => new \DateInterval('PT4H'),
|
'RetailcrmIcmlEvent' => new \DateInterval('PT4H'),
|
||||||
'RetailcrmInventoriesEvent' => new \DateInterval('PT15M'),
|
'RetailcrmInventoriesEvent' => new \DateInterval('PT15M'),
|
||||||
'RetailcrmSyncEvent' => new \DateInterval('PT7M'),
|
'RetailcrmSyncEvent' => new \DateInterval('PT7M'),
|
||||||
'RetailcrmAbandonedCartsEvent' => new \DateInterval('PT1M')
|
'RetailcrmAbandonedCartsEvent' => new \DateInterval('PT1M')
|
||||||
|
);
|
||||||
|
|
||||||
|
RetailcrmJobManager::startJobs(self::filter(
|
||||||
|
'RetailcrmFilterJobManagerIntervals',
|
||||||
|
$intervals
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user