public function getInfoPdt()
    {
        if (Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'ec_ecopresto_info` WHERE `id`=12 AND((UNIX_TIMESTAMP(NOW()) - `value`)/86400)>7')) {
            self::updateInfoEco('ECO_INFO', time());
            $resu = '<export_info>';
            $resu .= '<password>' . $this->tabConfig['ID_ECOPRESTO'] . '</password>';
            $resu .= '<info_pdt>';
            $lst_pdt = Db::getInstance()->executeS('SELECT `price`, `date_add`, `date_upd`, `active`, `supplier_reference`
				FROM  `' . _DB_PREFIX_ . 'product` p, `' . _DB_PREFIX_ . 'ec_ecopresto_product_shop` ps
				WHERE p.`supplier_reference` = ps.`reference`');
            foreach ($lst_pdt as $pdt) {
                $resu .= '<sku>' . (isset($pdt['supplier_reference']) ? $pdt['supplier_reference'] : '') . '</sku>';
                $resu .= '<price>' . (isset($pdt['price']) ? $pdt['price'] : '') . '</price>';
                $resu .= '<date_add>' . (isset($pdt['date_add']) ? $pdt['date_add'] : '') . '</date_add>';
                $resu .= '<date_upd>' . (isset($pdt['date_upd']) ? $pdt['date_upd'] : '') . '</date_upd>';
                $resu .= '<active>' . (isset($pdt['active']) ? $pdt['active'] : '') . '</active>';
            }
            $resu .= '</info_pdt>';
            $resu .= '</export_info>';
            include_once 'class/send.class.php';
            $send = new sendEco();
            $send->sendInfo(self::getInfoEco('ECO_URL_STAT'), $resu);
        }
    }
Example #2
0
                $resu .= '<tot_ht><![CDATA[' . Tools::safeOutput($TotCom['STT']) . ']]></tot_ht>';
                $resu .= '<tot_tva><![CDATA[' . Tools::safeOutput($TotCom['STT'] * ($TotCom['tax_rate'] / 100)) . ']]></tot_tva>';
                $resu .= '<tot_ttc><![CDATA[' . Tools::safeOutput($TotCom['STT'] + $TotCom['STT'] * $TotCom['tax_rate'] / 100) . ']]></tot_ttc>';
                $resu .= '</order_head>';
                $resu .= '<all_detail>';
            }
            $tem = 1;
            $resu .= '<order_item>';
            $resu .= '<sku><![CDATA[' . Tools::safeOutput($cr['product_supplier_reference']) . ']]></sku>';
            $resu .= '<product_name></product_name>';
            $resu .= '<qty><![CDATA[' . Tools::safeOutput($cr['product_quantity']) . ']]></qty>';
            $resu .= '</order_item>';
        }
        if ($tem > 0) {
            $resu .= '</all_detail></export_order>';
        }
        $reqExp[] = 'INSERT INTO `' . _DB_PREFIX_ . 'ec_ecopresto_export_com` (`id`,`id_order`) VALUES ("",' . (int) $com['id_order'] . ')';
        $resu .= '</gen>';
        if (isset($reqExp) && count($reqExp) > 0) {
            $send = new sendEco();
            $log = $send->sendInfo($server, $resu);
            if ($log == 1) {
                foreach ($reqExp as $req) {
                    Db::getInstance()->execute($req);
                }
            }
        }
    }
}
$catalog->UpdateUpdateDate('DATE_ORDER');
$catalog->getInfoPdt();