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

@ -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) {

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).'"]}');