Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
8ea5b281e5
@ -21,6 +21,28 @@ $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
include dirname(__FILE__).'/../../config/config.inc.php';
|
||||
|
||||
// CLEAN DISCOUNT QUAND CHANGEMENTS
|
||||
// $discount_toclean = array();
|
||||
// foreach(Db::getInstance()->ExecuteS('
|
||||
// SELECT dh.id_discount
|
||||
// FROM `ps_ant_discount_history` dh
|
||||
// LEFT JOIN `ps_order_discount` o ON (o.`id_discount` = dh.`id_discount`)
|
||||
// WHERE o.`id_order` IS NULL
|
||||
// AND dh.`used` = 0
|
||||
// ') as $d){
|
||||
// $discount_toclean[] = (int)$d['id_discount'];
|
||||
// }
|
||||
// Db::getInstance()->ExecuteS('
|
||||
// UPDATE ps_discount
|
||||
// SET
|
||||
// `value` = 0,
|
||||
// `id_discount_type` = 3,
|
||||
// `minimal` = 10,
|
||||
// `include_tax`= 0,
|
||||
// `id_currency` = 0
|
||||
// WHERE id_discount IN ('.implode(',',$discount_toclean).')
|
||||
// ');
|
||||
|
||||
$user_discounts = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_customer`
|
||||
@ -66,12 +88,12 @@ function generateDiscount($id_customer)
|
||||
{
|
||||
$discount = new Discount();
|
||||
$discount->id_customer = (int)$id_customer;
|
||||
$discount->id_discount_type = 2;
|
||||
$discount->id_discount_type = 3; // free shipping
|
||||
$discount->behavior_not_exhausted = 1;
|
||||
$discount->cumulable = 0;
|
||||
$discount->cumulable_reduction = 1;
|
||||
$discount->minimal = 50;
|
||||
$discount->include_tax = 1;
|
||||
$discount->minimal = 10;
|
||||
$discount->include_tax = 0;
|
||||
$discount->cart_display = 0;
|
||||
$discount->active = 1;
|
||||
$discount->quantity = 1;
|
||||
@ -98,8 +120,8 @@ function generateDiscount($id_customer)
|
||||
$discount->description[$language['id_lang']] = $description[$language['id_lang']];
|
||||
}
|
||||
|
||||
$discount->id_currency = 1;
|
||||
$discount->value = 10;
|
||||
$discount->id_currency = 0;
|
||||
$discount->value = 0;
|
||||
|
||||
if($discount->add(true, false, array(1)) ) {
|
||||
return $discount;
|
||||
|
60
modules/ant_configurations/cron_reorder_braderie.php
Normal file
60
modules/ant_configurations/cron_reorder_braderie.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if(isset($_SERVER['REMOTE_ADDR'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
$_SERVER['SERVER_NAME'] = 'www.bebeboutik.com';
|
||||
$_SERVER['HTTP_PORT'] = 80;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
include dirname(__FILE__).'/../../config/config.inc.php';
|
||||
|
||||
$categories = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT pc.`id_category`
|
||||
FROM `'._DB_PREFIX_.'privatesale_category` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale` p ON (p.id_sale = pc.id_sale)
|
||||
WHERE p.`braderie` = 1
|
||||
') as $c){
|
||||
$categories[] = $c['id_category'];
|
||||
}
|
||||
|
||||
foreach ($categories as $key => $id_category) {
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
RIGHT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product=cp.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product=p.id_product AND pl.`id_lang` = 1)
|
||||
WHERE cp.id_category ='.(int)$id_category.' AND p.quantity != 0
|
||||
ORDER BY cp.`position`
|
||||
');
|
||||
|
||||
foreach ($products as $key => $product) {
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '. (int)($key) .'
|
||||
WHERE `id_product` = '.(int)($product['id_product']).'
|
||||
AND `id_category`='.(int)$id_category
|
||||
);
|
||||
}
|
||||
|
||||
$products_zero = Db::getInstance()->ExecuteS('
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
RIGHT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product=cp.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product=p.id_product AND pl.`id_lang` = 1)
|
||||
WHERE cp.id_category ='.(int)$id_category.' AND p.quantity == 0
|
||||
ORDER BY cp.`position`
|
||||
');
|
||||
$position = count($products);
|
||||
foreach ($$products_zero as $key => $product) {
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '. (int)($position) .'
|
||||
WHERE `id_product` = '.(int)($product['id_product']).'
|
||||
AND `id_category`='.(int)$id_category
|
||||
);
|
||||
$position++;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user