bebeboutik-scripts/bbb.php
2017-12-18 17:14:31 +01:00

36 lines
1.1 KiB
PHP

<?php
die;
$_SERVER['HTTP_PORT'] = 80;
$_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = 'www.bebeboutik.com';
include dirname(__FILE__).'/config/config.inc.php';
include dirname(__FILE__).'/init.php';
require_once(dirname(__FILE__).'/modules/product_vouchers/product_vouchers.php');
define('_PS_BASE_URL_', 'http://www.bebeboutik.com');
global $cookie;
if (!$cookie || !$cookie->id_lang){
@$cookie->id_lang = 2;
}
$sql = '
SELECT o.`id_order`, (od.`product_quantity` - ( od.`product_quantity_refunded` + od.`product_quantity_return`)) AS `quantity`
FROM `ps_order_detail` od
LEFT JOIN `ps_orders` o ON (o.`id_order` = od.`id_order`)
WHERE o.`valid` = 1
AND od.`product_id` IN (
SELECT cache.`id_product`
FROM `ps_product_ps_cache` cache
WHERE cache.`id_sale` = 3986
)
AND o.id_order <> 238884
';
$details = Db::getInstance()->executeS($sql);
// :215569 => Commande test pour >>>> thibault@antadis.com
// test sendMail
ProductVouchers::sendMail(1, 215569, 'TEST');
foreach ($details as $key => $detail) {
ProductVouchers::associateCodeToOrder(1, $detail['quantity'], $detail['id_order']);
}