Esempio n. 1
0
    /**
     * Get orders details to create Tickets
     *
     * @static
     * @param array $orderIdList
     * @param int $filterEntries
     * @param int $weight_coefficient
     * @return array
     */
    public static function getOrders($orderIdList = array(), $filterEntries = MondialRelay::NO_FILTER, $weight_coefficient = 0)
    {
        $account_shop = MondialRelay::getAccountDetail();
        $id_order_state = $account_shop['MR_ORDER_STATE'];
        $sql = MondialRelay::getBaseOrdersSQLQuery($id_order_state, $weight_coefficient);
        if (count($orderIdList)) {
            $sql .= ' AND o.id_order IN (';
            foreach ($orderIdList as $id_order) {
                $sql .= (int) $id_order . ', ';
            }
            $sql = rtrim($sql, ', ') . ')';
        }
        switch ($filterEntries) {
            case MondialRelay::WITHOUT_HOME_DELIVERY:
                $sql .= 'AND mr.mr_ModeLiv != "LD1" AND mr.mr_ModeLiv != "LDS"';
                break;
        }
        $sql .= '
			GROUP BY o.`id_order`
			ORDER BY o.`date_add` ASC';
        return Db::getInstance()->executeS($sql);
    }
Esempio n. 2
0
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include_once '../../config/config.inc.php';
include_once 'mondialrelay.php';
if (Tools::getValue('secure_key') != Configuration::get('MONDIAL_RELAY_SECURE_KEY')) {
    exit;
}
$account_shop = MondialRelay::getAccountDetail();
$expeditions = Db::getInstance()->executeS('
SELECT ms.`exp_number`, ms.`id_cart`, o.`id_order`
FROM `' . _DB_PREFIX_ . 'mr_selected` ms
LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_cart` = ms.`id_cart`) 
WHERE `exp_number` != 0');
if (empty($expeditions)) {
    exit;
}
$params = array('Enseigne' => $account_shop['MR_ENSEIGNE_WEBSERVICE'], 'Langue' => 'FR');
require_once dirname(__FILE__) . '/lib/nusoap/nusoap.php';
$client_mr = new nusoap_client("http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL", true);
$client_mr->soap_defencoding = 'UTF-8';
$client_mr->decode_utf8 = false;
foreach ($expeditions as $expedition) {
    if ($expedition['id_order'] == NULL) {