Merge branch 'ticket-10657-PhileaMulti' into develop

This commit is contained in:
Marion Muszynski 2016-11-18 12:09:17 +01:00
commit 3f7d969371
4 changed files with 37 additions and 13 deletions

View File

@ -1182,14 +1182,14 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
AND (`date_end` > NOW() OR `date_end` = "0000-00-00 00:00:00")
AND `enabled` = 1
AND `version` = "'.pSQL($site_version_front).'"
AND `sponsor` = "'.pSQL($email).'"
AND `sponsor` = "'.pSQL($email).'"
');
if (!empty($tr_infos['tag_auth'])) {
$smarty->assign(array(
'tag_auth' => $tr_infos['tag_auth'],
));
}
}
if($c = Db::getInstance()->getRow('
@ -1202,17 +1202,17 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
}
}
}
if(isset($_COOKIE['4598484FDSFDSREFERAL8849FDS'])){
$referal_email = base64_decode($_COOKIE['4598484FDSFDSREFERAL8849FDS']);
$smarty->assign('sponsor_email', $referal_email);
} else {
if (isset($customer)) {
setcookie('4598484FDSFDSREFERAL8849FDS', base64_encode($customer->email), time() + 3600 * 24, '/', 'bebeboutik.com');
setcookie('4598484FDSFDSREFERAL8849FDS', base64_encode($customer->email), time() + 3600 * 24, '/', 'bebeboutik.com');
}
}
// setcookie('554b43403edef30d31412286d5098965', $sponsor, time() + 3600 * 24, '/', 'bebeboutik.com');
// if(isset($_COOKIE['554b43403edef30d31412286d5098965'])){
// $sponsor = $_COOKIE['554b43403edef30d31412286d5098965'];
// $email = base64_decode(strrev(substr($sponsor, 12)));
@ -1548,10 +1548,10 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
break;
}
}
$display_credits = true;
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $customer->id;
if(Db::getInstance()->getValue($sql)){
if(Db::getInstance()->getValue($sql)){
$display_credits = false;
}
@ -1568,6 +1568,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
}
private function _make_rewards($customer, $sponsored=FALSE) {
global $cookie;
$reward_type = Configuration::get('INVITE_REWARD_SPONSOR'.($sponsored? 'ED': '').'_TYPE');
if($reward_type == 1) {
@ -1849,7 +1850,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
AND `id_customer` != 0
');
}
public function getNbFriends($id_customer=FALSE) {
if(!(int) $id_customer) {
return 0;

View File

@ -365,8 +365,10 @@ class AdminPhileaMagistor extends AdminTab {
SELECT p.`id_sale`, c.`name`, c.`id_category`
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON (c.`id_category` = p.`id_category`)
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` pss ON (pss.`id_sale` = p.`id_sale`)
WHERE c.`id_lang` = '.$cookie->id_lang.'
AND p.`date_start` > "2015-01-01 00:00:00"
AND pss.`id_shipping` = 1
ORDER BY p.`id_sale` DESC
') as $row) {
$extrafields = Category::getSalesInfos(array((int) $row['id_category']));

View File

@ -1833,6 +1833,15 @@ class Sale {
return false;
}
public static function getShippingSale($id_sale){
$shipping = Db::getInstance()->getValue('
SELECT `id_shipping`
FROM `'._DB_PREFIX_.'privatesale_shipping_sale`
WHERE `id_sale` = '.(int) $id_sale
);
return (int)$shipping;
}
/**
* Update the percentage or amount in a promotion string
* for each sale with the maximum reduction percentage or amount

View File

@ -70,7 +70,8 @@ class CartController extends CartControllerCore
$sale = Sale::getSaleFromCategory((int)$product['id_category_default'], false);
$current_sale = array(
'id_sale'=> (int) $sale->id,
'delivery_delay'=> (int) $sale->delivery_delay
'delivery_delay'=> (int) $sale->delivery_delay,
'shipping' => Sale::getShippingSale((int)$sale->id)
);
// Only one delivery id per cart, so we can break now
break;
@ -85,13 +86,24 @@ class CartController extends CartControllerCore
$sale2 = Sale::getSaleFromCategory($current_product->id_category_default, false);
$adding_sale = array(
'id_sale'=> (int) $sale2->id,
'delivery_delay'=> (int) $sale2->delivery_delay
'delivery_delay'=> (int) $sale2->delivery_delay,
'shipping' => Sale::getShippingSale((int)$sale2->id)
);
//die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.implode(' , ',$current_sale).' - '.implode(' , ',$adding_sale).'"]}');
if (!empty($current_sale)) {
global $smarty;
// Only classic delivery sales can be added together or product of the same sale
if ((int)$current_sale['delivery_delay'] != 1 && (int)$adding_sale['id_sale'] != (int)$current_sale['id_sale']) {
// Only classic delivery sales can be added together or product of the same sale or philea sales with same delivery delay
if (((int)$current_sale['delivery_delay'] != 1
&& (int)$adding_sale['id_sale'] != (int)$current_sale['id_sale']
&& (
(int)$current_sale['shipping'] != 1
&& (int)$adding_sale['shipping'] != 1
&& (int)$adding_sale['delivery_delay'] != (int)$current_sale['delivery_delay']
))
|| ((int)$current_sale['delivery_delay'] != 1 && (int)$adding_sale['delivery_delay'] == 1)
) {
// Product in cart comes from special delivery sale - only products from the same sale can be added
if (Tools::getValue('ajax') == 'true') {
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. To continue, please confirm your order or empty your cart.', false).'"]}');
@ -258,7 +270,7 @@ class CartController extends CartControllerCore
}
}
// @Adding Antadis - remove whole cart
if ($removeAll) {
foreach(self::$cart->getProducts() as $product) {