コード例 #1
0
ファイル: import.php プロジェクト: ventsiwad/presta_addons
    $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'];
            $pdt_final['shop'] = (int) $pdt['id_shop'];
            $idC = (int) $import->getCategory($pdt['category_1'], 0, $pdt['id_shop'], 0);
            $idSSC = (int) $import->getCategory($pdt['ss_category_1'], $idC, $pdt['id_shop'], 1);
            $pdt_final['categories'] = (int) $idC;
            $pdt_final['sscategories'] = (int) $idSSC;
            $pdt_final['id_category_default'] = (int) $idSSC;
            $pdt_final['id_supplier'] = (int) $catalog->tabConfig['PARAM_SUPPLIER'];