mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-01 19:03:14 +03:00
Added loading catalog in CRM after ICML generation
This commit is contained in:
parent
c27a932f2e
commit
960ed4438a
@ -87,6 +87,34 @@ class RetailcrmCatalogHelper
|
||||
return _PS_ROOT_DIR_ . '/' . self::getIcmlFileName();
|
||||
}
|
||||
|
||||
public static function isIcmlFileLinkActual()
|
||||
{
|
||||
$api = RetailcrmTools::getApiClient();
|
||||
if (empty($api)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$reference = new RetailcrmReferences($api);
|
||||
$site = $reference->getSite();
|
||||
|
||||
if (empty($site)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$newYmlUrl = RetailcrmCatalogHelper::getIcmlFileLink();
|
||||
|
||||
RetailcrmLogger::writeDebug(
|
||||
__METHOD__, sprintf(
|
||||
'Comparing %s and %s: %s',
|
||||
$newYmlUrl,
|
||||
$site['ymlUrl'],
|
||||
$newYmlUrl === $site['ymlUrl'] ? 'true' : 'false'
|
||||
)
|
||||
);
|
||||
|
||||
return $newYmlUrl === $site['ymlUrl'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $productsCount
|
||||
* @param int $offersCount
|
||||
|
@ -61,6 +61,20 @@ class RetailcrmIcmlEvent extends RetailcrmAbstractEvent implements RetailcrmEven
|
||||
|
||||
$icml = new RetailcrmIcml($shop['name'], RetailcrmCatalogHelper::getIcmlFilePath());
|
||||
$icml->generate($data[0], $data[1]);
|
||||
|
||||
if (true !== RetailcrmCatalogHelper::isIcmlFileLinkActual()) {
|
||||
RetailcrmLogger::writeDebug(
|
||||
__METHOD__,
|
||||
'Skip statistic update due to non consistent ICML file link'
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$api = RetailcrmTools::getApiClient();
|
||||
if (null !== $api) {
|
||||
$api->statisticUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user