Exemplo n.º 1
0
 /**
  * Импортирует данные из файла importCatalog.csv.
  * @return boolean
  */
 public function startImport()
 {
     $this->messageSucces = "Процесс запущен";
     $this->messageError = "Неудалось начать импорт";
     $import = new Import($_POST['typeCatalog']);
     if (empty($_POST['rowId'])) {
         unset($_SESSION['stopProcessImportCsv']);
     }
     if ($_POST['delCatalog'] !== null) {
         if ($_POST['delCatalog'] === "true") {
             DB::query('TRUNCATE TABLE `' . PREFIX . 'cache`');
             if ($_POST['rowId'] == 0) {
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product_variant`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product_user_property`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'category`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'category_user_property`');
             }
         }
     }
     $this->data = $import->startUpload($_POST['rowId']);
     if ($this->data['status'] == 'error') {
         $this->messageError = $this->data['msg'] . '';
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Импортирует данные из файла importCatalog.csv.
  * @return boolean
  */
 public function startImport()
 {
     $this->messageSucces = "Процесс запущен";
     $this->messageError = "Неудалось начать импорт";
     $import = new Import($_POST['typeCatalog']);
     if (empty($_POST['rowId'])) {
         unset($_SESSION['stopProcessImportCsv']);
     }
     if ($_POST['delCatalog'] !== null) {
         if ($_POST['delCatalog'] === "true") {
             DB::query('TRUNCATE TABLE `' . PREFIX . 'cache`');
             if ($_POST['rowId'] == 0) {
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product_variant`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'product_user_property`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'category`');
                 DB::query('TRUNCATE TABLE `' . PREFIX . 'category_user_property`');
                 /* 
                  * Характеристики не удаляются потому что их id могут использоваться 
                  * для кастомизированного вывода, и могут быть характеристики созданные из плагинов.
                  */
             }
         }
     }
     $this->data = $import->startUpload($_POST['rowId']);
     if ($this->data['status'] == 'error') {
         $this->messageError = $this->data['msg'] . '';
         return false;
     }
     return true;
 }