* @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ require_once(dirname(__FILE__) . '/../RetailcrmPrestashopLoader.php'); class RetailcrmIcmlEvent extends RetailcrmAbstractEvent implements RetailcrmEventInterface { /** * @inheritDoc */ public function execute() { if ($this->isRunning()) { return false; } $this->setRunning(); $shops = $this->getShops(); $isMultiStoreActive = Shop::isFeatureActive(); foreach ($shops as $shop) { RetailcrmTools::setShopContext(intval($shop['id_shop'])); $job = new RetailcrmCatalog(); $data = $job->getData(); if ($isMultiStoreActive) $icmlFileName = 'retailcrm_' . $shop['id_shop'] . '.xml'; else $icmlFileName = 'retailcrm.xml'; $icml = new RetailcrmIcml($shop['name'], _PS_ROOT_DIR_ . '/' . $icmlFileName); $icml->generate($data[0], $data[1]); } return true; } /** * @inheritDoc */ public function getName() { return 'RetailcrmIcmlEvent'; } }