update error mess from add to cart
This commit is contained in:
parent
deec098272
commit
0f5228f6e8
@ -205,6 +205,80 @@ if (!class_exists('SaleDelay')) {
|
|||||||
return 'Unknown';
|
return 'Unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo - remove this function to use short name
|
||||||
|
*/
|
||||||
|
public static function getDelayFrontSmallName($id_delay, $id_lang) {
|
||||||
|
if($id_lang == 2) {
|
||||||
|
switch ($id_delay) {
|
||||||
|
case '1':
|
||||||
|
return '3 semaines';
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
return '48h';
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
return '7 jours';
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
return '10 jours';
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
return 'Noël';
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
return 'Star';
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
return '72h';
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
return '48h';
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
return 'Spé';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'quelques jours';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} elseif($id_lang == 3){
|
||||||
|
switch ($id_delay) {
|
||||||
|
case '1':
|
||||||
|
return '3 semanas';
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
return '48h';
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
return '7 días';
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
return '10 días';
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
return 'Noël';
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
return 'Star';
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
return '72h';
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
return 'Spé';
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
return '48h';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'un poco días';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'few days';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
include_once dirname(__FILE__).'/../../modules/privatesales/Sale.php';
|
include_once dirname(__FILE__).'/../../modules/privatesales/Sale.php';
|
||||||
|
include_once dirname(__FILE__).'/../../modules/privatesales_delay/saledelay.php';
|
||||||
class CartController extends CartControllerCore
|
class CartController extends CartControllerCore
|
||||||
{
|
{
|
||||||
public function preProcess()
|
public function preProcess()
|
||||||
@ -80,20 +81,22 @@ class CartController extends CartControllerCore
|
|||||||
|
|
||||||
if (!empty($current_sale)) {
|
if (!empty($current_sale)) {
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
$current_delay_name = SaleDelay::getDelayFrontSmallName($current_sale['delivery_delay'], self::$cookie->id_lang);
|
||||||
|
$adding_delay_name = SaleDelay::getDelayFrontSmallName($adding_sale['delivery_delay'], self::$cookie->id_lang));
|
||||||
if ((int)$current_sale['delivery_delay'] == 1 && !Sale::isCombinable($current_sale,$adding_sale)){
|
if ((int)$current_sale['delivery_delay'] == 1 && !Sale::isCombinable($current_sale,$adding_sale)){
|
||||||
// Product in cart comes from classic delivery sale
|
// Product in cart comes from classic delivery sale
|
||||||
if (Tools::getValue('ajax') == 'true') {
|
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 3 weeks. To continue, please confirm your order or empty your cart.', false).'"]}');
|
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.sprintf(Tools::displayError('Sorry your cart already contains products from a sale shipped within %s. To continue, please confirm your order or empty your cart.', false), $current_delay_name).'"]}');
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = Tools::displayError('Sorry your cart already contains products from a sale shipped within 3 weeks. To continue, please confirm your order or empty your cart.', false);
|
$this->errors[] = sprintf(Tools::displayError('Sorry your cart already contains products from a sale shipped within %s. To continue, please confirm your order or empty your cart.', false),$current_delay_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (!Sale::isCombinable($current_sale,$adding_sale)){
|
elseif (!Sale::isCombinable($current_sale,$adding_sale)){
|
||||||
// Product in cart comes from special delivery sale
|
// Product in cart comes from special delivery sale
|
||||||
if (Tools::getValue('ajax') == 'true') {
|
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).'"]}');
|
die('{"hasError" : true,"popup_error_cart": true, "errors" : ["'.sprintf(Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. We cannot add products from sales shipped within %s. To continue, please confirm your order or empty your cart.', false),$adding_delay_name).'"]}');
|
||||||
} else {
|
} else {
|
||||||
$this->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);
|
$this->errors[] = sprintf(Tools::displayError('Sorry your cart already contains products from a sale shipped within a special period. We cannot add products from sales shipped within %s. To continue, please confirm your order or empty your cart.', false),$adding_delay_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user