1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| if (!empty($files)) {
$nb = 1;
$tfile = -1;
$total = 0;
foreach ($files as $file) {
$tfile++;
$this->flushbuffers();
$this->category_srv = new ToolCategory($this);
$this->manufacturer_srv = new ToolManufacturer($this);
$this->product_srv = new ToolProduct($this);
$this->level_srv = new ToolLevel($this);
$file = _PS_ROOT_DIR_.$this->config->_directory.$this->DefautSupplier.'_part'.$tfile.'.csv';
$filepart = $file;
try {
$lines = file($filepart);
$alllines = file(_PS_ROOT_DIR_.$this->config->_directory.$this->DefautSupplier.'.csv');
} catch (Exception $e) {
$lines = false;
}
//$_nbsend = (Configuration::get($this->DefautSupplier.'_nbsend') - 1);
if (Configuration::get($this->DefautSupplier.'_nbsend_check') == 2) {
$_nbsend = 100;
} else {
$_nbsend = (count($alllines) - 1);
}
if (is_array($lines)) {
$linebreak = "\r\n";
ob_start();
if (!empty(Tools::getValue('cron'))) {
$total = (count($alllines) - 1);
} else {
if (Configuration::get($this->DefautSupplier.'_nbsend_check') == 2) {
if ($_nbsend > count($alllines)) {
Configuration::updateValue(
$this->DefautSupplier.'_nbsend',
count($alllines)
);
$_nbsend = count($alllines);
$total = ($_nbsend - 1);
} else {
$total = (Configuration::get($this->DefautSupplier.'_nbsend') - 1);
}
} else {
$total = (count($alllines) - 1);
}
}
$data = '';
while (($line = array_shift($lines))) {
ob_start();
unset($data);
unset($fields);
unset($Categorye);
unset($categoryss);
unset($Category); |
Partager