$tabLang[$lang['id_lang']] = $lang['id_lang_eco']; } $lstAttr = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `value`, `id_attribute` FROM `' . _DB_PREFIX_ . 'ec_ecopresto_attribute_shop` s, `' . _DB_PREFIX_ . 'ec_ecopresto_attribute` a WHERE s.`id_attribute_eco` = a.`id_attribute_eco` AND `id_shop`=' . (int) $id_shop); foreach ($lstAttr as $Attr) { $tabAtt[$Attr['value']] = $Attr['id_attribute']; } foreach ($lstPdt as $pdt) { $pdt_final = array(); if (time() - $time <= $catalog->limitMax) { $reference = new importerReference($pdt['thereference']); $pdt_final['id_product'] = (int) $reference->id_product; if ($pdt['imported'] == 1 && $pdt_final['id_product']) { $import->deleteProduct($reference->id_product, $pdt['thereference'], $pdt['id_shop']); Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'ec_ecopresto_product_imported` WHERE `reference`= "' . pSQL($pdt['thereference']) . '"'); $etp++; } elseif ($pdt['imported'] == 1 && !$reference->id_product) { Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'ec_ecopresto_product_imported` WHERE `reference`= "' . pSQL($pdt['thereference']) . '"'); Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'ec_ecopresto_product_shop` SET `imported`=2 WHERE `reference`= "' . pSQL($pdt['thereference']) . '" AND `id_shop`=' . (int) $pdt['id_shop']); $etp++; } elseif ($reference->id_product && $catalog->tabConfig['PARAM_MAJ_NEWPRODUCT'] == 1 && !$reference->getShopProduct($pdt['id_shop'], $reference->id_product)) { $etp++; } else { $tempRate = $pdt['rate'] / 1; $id_tax = isset($tabTax['id_tax'][(string) $tempRate]) ? (int) $tabTax['id_tax'][(string) $tempRate] : 0; $pdt_final['upd_index'] = (int) $catalog->tabConfig['PARAM_INDEX']; $pdt_final['upd_img'] = (int) $catalog->tabConfig['UPDATE_IMAGE']; $pdt_final['id_manufacturer'] = (int) $import->getManufacturer($pdt['manufacturer']); $pdt_final['id_shop_default'] = (int) $pdt['id_shop'];
$import = new importerProduct(); $catalog = new catalog(); if (Tools::getValue('ec_token') != $catalog->getInfoEco('ECO_TOKEN')) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Location: ../"); exit; } $time = time(); $etp = (int) Tools::getValue('etp'); $total = (int) Tools::getValue('total'); $typ = (int) Tools::getValue('typ'); $id_shop = (int) Tools::getValue('ids'); $maxR = $total - $etp > 20 ? 20 : $total - $etp; $lstPdt = Db::getInstance()->ExecuteS('SELECT `reference` FROM `' . _DB_PREFIX_ . 'ec_ecopresto_product_deleted` WHERE status=0 LIMIT ' . (int) $etp . ', ' . (int) $maxR); foreach ($lstPdt as $pdt) { if (time() - $time <= $catalog->limitMax) { $reference = new importerReference($pdt['reference']); $import->deleteProduct($reference->id_product, $pdt['reference']); $etp++; } else { break; } } echo $etp . ',' . $total . ',' . $typ . ',' . $pdt['reference'];
$return = $catalog->GetFilecsv(); echo $return; break; case 9: $return = $catalog->GetDereferencement(); echo $return; break; case 10: $catalog->synchroManuelOrder(Tools::getValue('idc'), Tools::getValue('typ')); break; case 11: echo $catalog->SetDerefencement(); break; case 12: include dirname(__FILE__) . '/class/importProduct.class.php'; include dirname(__FILE__) . '/class/reference.class.php'; $import = new importerProduct(); $catalog->UpdateDereferencement(Tools::getValue('ref')); $reference = new importerReference(Tools::getValue('ref')); $import->deleteProduct($reference->id_product, Tools::getValue('ref')); $import->deleteProductShop(); echo Tools::safeOutput(Tools::getValue('actu')) . ',' . Tools::safeOutput(Tools::getValue('tot')); break; case 13: include dirname(__FILE__) . '/class/importProduct.class.php'; $import = new importerProduct(); $import->deleteProductShop(); break; default: break; }